REM -------------------------------------------------------------------------
REM  #Description.............: Organices start JFProcessMonitor.exe
REM  #New.....................: 16.10.2024/jopp
REM  #LUp.....................: 16.10.2024/jopp in work not jet ready for use
REM -------------------------------------------------------------------------
if not defined JobMgr_PMon_use set JobMgr_PMon_use=ON
if not defined JobMgr_PMon_Txt set JobMgr_PMon_Txt=%JobName%

if "%JobMgr_PMon_use%" equ "ON" goto :PMonUseYes

goto :PMonUseNo

:PMonUseYes
 Call Echo "--# #Step:Activate PMON --------------------------------------------"
 Call Echo "--# Setp:Start PMon:YES for.....: %JobMgr_PMon_Txt%"
 Call :SetPmon "%CmdCurRoot_DP%\%JobTemp_TP%"
  if /i "%JobMgr_WIMode%" equ "Normal" (
    start "PMon Job:[%JobName%][%TcSiteId%]" %toMon%
  ) else (
    start "PMon Job:[%JobName%][%TcSiteId%]" %toMon%
  )
 goto :next

:PMonUseNo
 Call Echo "--# #Doc:PMON Use:NO -----------------------------------------------"
 Call Echo "--# Setp:Start PMon:NO..........: %JobMgr_PMon_Txt%"
 goto :next

goto :eof


:SetPmon
 set temp=%~1
 set tmp=%temp%
 if not exist "%temp%" md "%temp%"

 set PMon_exeL_DPNE=%BinL_DP%\JFProcessMonitor.exe
 set PMon_SysLog_DPNE=%temp%\zzPLMPerf1_PMon_sys.log
 set PMon_ResultXml_DPNE=%temp%\zzPLMPerf2_PMon_Result.xml

	set toMon=%PMon_exeL_DPNE%
 set toMon=%toMon% --titlePrefix "JobMon:[%JobName%][Step:%JobMgr_PLMPerfStepNo%][Start:%Date%/%time:~0,8%]"
 set toMon=%toMon% --processName run_journal
 set toMon=%toMon% --waitForProcess 150000
 set toMon=%toMon% --parentProcessId 0
rem	set toMon=%toMon% --killChildProcesses
REM 	set toMon=%toMon% --killChildProcesses
 set toMon=%toMon% --fileLastWriteTime "%temp%\*.*;600"
 set toMon=%toMon% --tailTextFile "%temp%\%username%*.syslog"
 set toMon=%toMon% --duraTimeSpanIfGreaterThen 1000
 set toMon=%toMon% --tailForceMilliseconds "500"
 set toMon=%toMon% --tailTextFile_log "%PMon_SysLog_DPNE%"
	set toMon=%toMon% --saveResultsTo "%PMon_ResultXml_DPNE%"
 rem set toMon=%toMon% --runtimeLimitSeconds 600
 Call Echo "Perf.P.Mon use setting..........: 16.02.2024"
goto :eof

