无法在Jprofiler中传递命令文件



我尝试在脱机模式下自动运行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:devjprofiler11"
set JPROFILER_CONFIG_FILE_LOCATION=C:devprofiler_start_scriptconfig.xml
"%JPROFILER_HOME%"binjpenable.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%binjpcontroller.exe"
"%JPCONTRL%" -n --non-interactive -f **--command-file=C:devprofiler_start_scriptcommands** %PID%
goto end
:endError
echo Error: %ERROR%
:end
endlocal

命令

startCPURecording true
saveSnapshot C:devbuildtrunkWBSchedulersnapshot.jps
stopCPURecording

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

jpcontroller.exe的参数应该是

-n --non-interactive -f C:devprofiler_start_scriptcommands %PID%

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

startCPURecording true
sleep 10
stopCPURecording
saveSnapshot C:devbuildtrunkWBSchedulersnapshot.jps

刚刚用JProfiler 11.1.4对此进行了测试。如果问题仍然存在,请包含错误消息。同时尝试手动调用命令。

最新更新