我尝试使用下面的批处理脚本在脱机模式下自动执行JProfiler,以连接到正在运行的JVM。我无法传递将输入带到JProfiler的命令文件。我仍然不确定需要向JProfiler传递什么格式。我尝试以文本和文件格式传递,但没有成功。
BatchScript.bat
@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命令
startCPURecording true
saveSnapshot C:\dev\build\trunk\WBScheduler\snapshot.jps
stopCPURecording谁能告诉我,我需要什么格式的输入文件发送到JProfiler?我使用的是Jprofiler的11+版本。
发布于 2021-06-16 15:24:35
jpcontroller.exe的参数应该是
-n --non-interactive -f C:\dev\profiler_start_script\commands %PID%此外,命令应包括休眠,否则快照中将没有数据:
startCPURecording true
sleep 10
stopCPURecording
saveSnapshot C:\dev\build\trunk\WBScheduler\snapshot.jps刚刚用JProfiler 11.1.4测试了这一点。如果问题仍然存在,请包括错误消息。还可以尝试手动调用这些命令。
https://stackoverflow.com/questions/67997790
复制相似问题