【问题标题】:How do I profile maven tests on windows with JProfiler?如何使用 JProfiler 在 Windows 上分析 Maven 测试?
【发布时间】:2018-04-30 21:27:57
【问题描述】:

我试过了

  <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 中录制,则会获得奖励积分

【问题讨论】:

    标签: maven jprofiler


    【解决方案1】:

    通过

    -agentpath:<path to jprofilerti.dll>=port=8849,nowait
    

    只会加载分析代理,但不会执行任何记录。在您的情况下,还有另一个问题,因为 JVM 没有启动,很可能C:\Program Files 中的空间将参数分成两个参数。我建议将 JProfiler 安装到没有空格的路径中。

    要记录数据并保存快照,您必须配置离线分析。参数如下所示:

    -agentpath:<path to jprofilerti.dll>=port=8849,offline,id=<session ID>
    

    会话 ID 取自会话设置对话框中“应用程序设置”选项卡的右上角。在该会话中,您配置“JVM 启动”触发器开始记录数据,并配置“JVM 退出”触发器以在最后保存快照。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      相关资源
      最近更新 更多