我用args启动了一个Java应用程序:
"-agentpath:C:\Program Files\jprofiler7\bin\windows-x64\jprofilerti.dll=port=8849,id=134,nowait"然后控制台显示:
JProfiler> Protocol version 37
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Don't wait for frontend to connect.
JProfiler> Using config file C:\Users\user\.jprofiler7\config.xml (id: 134)
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> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Hotspot compiler enabled那么我现在可以通过JProfiler图形用户界面连接了。
,但我需要通过另一个JProfiler应用程序将它与JProfiler API连接起来。,我怎么能把它连接起来呢?通过VM参数吗?
我只知道我可能必须先创建一个连接,但我不知道如何选择会话ID。
Connection connection = ConnectionFactory.createRemoteConnection("localhost", 8849, 30);如果我运行代理应用程序,然后首先通过JProfiler GUi连接,我就可以通过GUi应用程序获取JProfiler信息,包括运行Java应用程序。
Profiling data :
Hot spots:
Top 5 hot spots:
Hot spot 1: ProfilerTest.main(java.lang.String[ ]): 34 ms (100 %)
Backtraces:
ProfilerTest.main(java.lang.String[ ]): 34722 (0)
***: 34722 (0)
Cpu tree:
***: 34722 (0)
ProfilerTest.main(java.lang.String[ ]): 34722 (0)
java.util.Scanner.next(): 34722 (0)但是,如果我运行代理应用程序,然后首先通过我的JProfiler API应用程序进行连接,我将一无所获。
Profiling data :
Hot spots:
Top 5 hot spots:
Cpu tree:
***: 0 (0)发布于 2014-05-13 11:22:56
在",nowait“之后添加",config=path到配置文件,id=nnn”,其中“到配置文件的路径”是%USERPROFILE%.jprofiler8\config.xml,"nnn“是会话ID,它在会话设置对话框的应用程序设置选项卡的右上角可见。
https://stackoverflow.com/questions/23605294
复制相似问题