首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Jprofiler中传递命令文件

无法在Jprofiler中传递命令文件
EN

Stack Overflow用户
提问于 2021-06-16 14:56:48
回答 1查看 28关注 0票数 2

我尝试使用下面的批处理脚本在脱机模式下自动执行JProfiler,以连接到正在运行的JVM。我无法传递将输入带到JProfiler的命令文件。我仍然不确定需要向JProfiler传递什么格式。我尝试以文本和文件格式传递,但没有成功。

BatchScript.bat

代码语言:javascript
复制
@echo off
TITLE "Profiling an application using JPofiler"

echo ***********Running JProfiler in non-interactive mode*****************

set "JPROFILER_HOME=C:\dev\jprofiler11"
set JPROFILER_CONFIG_FILE_LOCATION=C:\dev\profiler_start_script\config.xml

"%JPROFILER_HOME%"\bin\jpenable.exe --offline --id=116 --config=%JPROFILER_CONFIG_FILE_LOCATION%

if %ERRORLEVEL% NEQ 0 (
    set ERROR= Jpenable is not able to profile the selected JVM, check JPROFILER_HOME and JPROFILER_CONFIG_FILE_LOCATION is set to correct location.
    goto endError)

set /p PID=Enter the process id of the JVM:

SET "JPCONTRL=%JPROFILER_HOME%\bin\jpcontroller.exe"

"%JPCONTRL%" -n --non-interactive -f **--command-file=C:\dev\profiler_start_script\commands** %PID%

goto end
:endError
echo Error: %ERROR%

:end
endlocal

命令

代码语言:javascript
复制
startCPURecording true
saveSnapshot C:\dev\build\trunk\WBScheduler\snapshot.jps
stopCPURecording

谁能告诉我,我需要什么格式的输入文件发送到JProfiler?我使用的是Jprofiler的11+版本。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-16 15:24:35

jpcontroller.exe的参数应该是

代码语言:javascript
复制
-n --non-interactive -f C:\dev\profiler_start_script\commands %PID%

此外,命令应包括休眠,否则快照中将没有数据:

代码语言:javascript
复制
startCPURecording true
sleep 10
stopCPURecording
saveSnapshot C:\dev\build\trunk\WBScheduler\snapshot.jps

刚刚用JProfiler 11.1.4测试了这一点。如果问题仍然存在,请包括错误消息。还可以尝试手动调用这些命令。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67997790

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档