offline - 首次连接JProfiler时如何跳过 "Waiting for a connection from the JProfiler GUI"的信息

标签 offline platform jprofiler

我想使用离线模式连接应用程序,并且我已经关闭了防火墙软件。

我会得到一些信息,例如:

C:\workspace\newperflog\TestThread\bin>java "-agentpath:C:\Program Files\jprofil
er7\bin\windows-x64\jprofilerti.dll=port=8849" ProfilerTest
JProfiler> Protocol version 37
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...

我无法使用消息连接应用程序:

Exception in thread "main" java.lang.NullPointerException
    at com.jprofiler.core.comm.d.a.getThreadInfos(ejt:229)
    at TestProfiler.dumpProfilingData(TestProfiler.java:59)
    at TestProfiler.main(TestProfiler.java:46)

但是如果我首先使用 JProfiler GUI 连接,那么我可以使用离线命令连接它。

调用 JProfiler GUI 时是否缺少任何参数?

通过 JProfiler GUI 连接后,我可以通过 Java 离线应用程序获取信息,如下所示:

JProfiler> Protocol version 37
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
JProfiler> Hotspot compiler enabled
JProfiler> Using sampling (5 ms)
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Disconnected. Waiting for reconnection.
JProfiler> Listening on port: 8849.
JProfiler> Reconnection.
JProfiler> Disconnected. Waiting for reconnection.
JProfiler> Listening on port: 8849.
JProfiler> Reconnection.
JProfiler> Disconnected. Waiting for reconnection.
JProfiler> Listening on port: 8849.


Before Connected
Connected
Profiling data :
Hot spots:

Top 5 hot spots:
Hot spot 1: ProfilerTest.main(java.lang.String[ ]): 50 ms (100 %)
Backtraces: 
ProfilerTest.main(java.lang.String[ ]): 50045 (0)
   ***: 50045 (0)

Cpu tree:

***: 50045 (0)
   ProfilerTest.main(java.lang.String[ ]): 50045 (0)
      java.util.Scanner.next(): 50045 (0)

Custom payload hot spots:

Tested load factors:

最佳答案

只需将“,nowait”添加到 -agentpath 命令中,然后就可以跳过该消息。这不是“离线分析”,您可以稍后连接 JProfiler。

对于离线分析,您可以添加 ,offline 参数并引用包含触发器和操作的特殊配置,这样您就不必连接 JProfiler GUI。

分析 API(在 TestProfiler 中使用)与此无关。

关于offline - 首次连接JProfiler时如何跳过 "Waiting for a connection from the JProfiler GUI"的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23563372/

相关文章:

javascript - 文件 ://protocol 上的 localStorage 回退尝试

javascript - 离线网站如何保存数据?

maven - 在没有互联网接入的情况下使用 Maven 或 Gradle 的最佳实践

javascript - 简单的 <script> 标签 - Access-Control-Allow-Origin 不允许 Origin null

指示内存对齐要求的编译器常量

java - JProfiler 调用堆栈拆分

linux - 如何仅在特定平台上运行插件

android - 在 cordova 中升级 Android 平台时出错

java - 什么是 'JNI Global reference'

java - 在JProfiler中如何扩展最大对象的数量?