如何使用 JProfiler 在 windows 上分析 Maven 测试?
How do I profile maven tests on windows with JProfiler?
我试过了
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>com.my.test.IntegrationTest</excludedGroups>
<argLine>-agentpath:C:\Program Files\jprofiler10\bin\windows-x64\jprofilerti.dll=port=8849,nowait</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>com.my.test.IntegrationTest</groups>
<argLine>-agentpath:C:\Program/ Files\jprofiler10\bin\windows-x64\jprofilerti.dll=port=8849,nowait</argLine>
</configuration>
<executions>
这导致
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project my-util: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_162\jre\bin\java" -agentpath:C:\Program Files\jprofiler10\bin\windows-x64\jprofilerti.dll=port=8849,nowait -jar C:\Users\xeno\IdeaProjects\my-util\target\surefire\surefirebooter6221605500745834451.jar C:\Users\xeno\IdeaProjects\my-util\target\surefire\surefire4500791091163286071tmp C:\Users\xeno\IdeaProjects\my-util\target\surefire\surefire_07989865501871806496tmp"
如果它在 UI 可用时自动开始录制,则奖励积分
通过
-agentpath:<path to jprofilerti.dll>=port=8849,nowait
将只加载分析代理但不执行任何记录。在您的情况下,还有另一个问题,因为 JVM 没有启动,很可能 C:\Program Files
中的 space 将参数拆分为两个参数。我建议将 JProfiler 安装到没有 spaces.
的路径中
要记录数据并保存快照,您必须配置离线分析。参数看起来像这样:
-agentpath:<path to jprofilerti.dll>=port=8849,offline,id=<session ID>
会话 ID 取自会话设置对话框中 "Application settings" 选项卡的右上角。在该会话中,您配置一个 "JVM startup" 触发器以开始记录数据,并配置一个 "JVM exit" 触发器以在最后保存快照。
我试过了
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludedGroups>com.my.test.IntegrationTest</excludedGroups>
<argLine>-agentpath:C:\Program Files\jprofiler10\bin\windows-x64\jprofilerti.dll=port=8849,nowait</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>com.my.test.IntegrationTest</groups>
<argLine>-agentpath:C:\Program/ Files\jprofiler10\bin\windows-x64\jprofilerti.dll=port=8849,nowait</argLine>
</configuration>
<executions>
这导致
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project my-util: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_162\jre\bin\java" -agentpath:C:\Program Files\jprofiler10\bin\windows-x64\jprofilerti.dll=port=8849,nowait -jar C:\Users\xeno\IdeaProjects\my-util\target\surefire\surefirebooter6221605500745834451.jar C:\Users\xeno\IdeaProjects\my-util\target\surefire\surefire4500791091163286071tmp C:\Users\xeno\IdeaProjects\my-util\target\surefire\surefire_07989865501871806496tmp"
如果它在 UI 可用时自动开始录制,则奖励积分
通过
-agentpath:<path to jprofilerti.dll>=port=8849,nowait
将只加载分析代理但不执行任何记录。在您的情况下,还有另一个问题,因为 JVM 没有启动,很可能 C:\Program Files
中的 space 将参数拆分为两个参数。我建议将 JProfiler 安装到没有 spaces.
要记录数据并保存快照,您必须配置离线分析。参数看起来像这样:
-agentpath:<path to jprofilerti.dll>=port=8849,offline,id=<session ID>
会话 ID 取自会话设置对话框中 "Application settings" 选项卡的右上角。在该会话中,您配置一个 "JVM startup" 触发器以开始记录数据,并配置一个 "JVM exit" 触发器以在最后保存快照。