I wanna use offline mode to connect the application, and I've shutdown my firewall software.
and I'll get some information such as :
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 ...
I couldn't connect the application with a message :
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)
But if I use JProfiler GUI connect first , then I could connect that with my offline command.
Do I have any missing argument on calling JProfiler GUI ?
I could get the information via Java offline application after connected by JProfiler GUI as following:
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:
Just add `,nowait' to the -agentpath command, then you skip that message. This is not "offline profiling", you can just connect with the JProfiler at a later time.
For offline profiling, you add the ,offline
parameter and reference a special config that contains triggers and action so you do not have to connect with the JProfiler GUI.
The profiling API (used in TestProfiler) is not relevant in this respect.