Documentation for JFProcessMonitor
--------------------------------------------------

short options are prefixed with a single hypen  (-i)
long options are prefixed with a double hypen   (--processId)
values can be separated with a space or a equal (--processId=414 -p 354)
fractional double values are written as 2.75 (--cpuUsageLowPercent 2.75)


  i, processId                       [int] The ID of a runninig process to 
                                     monitor

  n, processName                     [string] The Name of a process to monitor,
                                     without the .exe extension. Actually 
                                     running or started later in combination 
                                     with option -waitForProcess

  p, parentProcessId                 [int] The process has to be a child of 
                                     this parent process. When set to 0, the 
                                     own parent process will be used. When 
                                     omitted, the process will be searched 
                                     anywhere.

  w, waitForProcess                  [int] Time to wait for a matching process 
                                     when specified by processName in 
                                     Milliseconds. When omitted or 0, the 
                                     process has already to be running. When >0
                                     already running processes are ignored and 
                                     the first new matching process within the 
                                     timespan will be monitored.

  titlePrefix                        [string] will ad a prefix to the console 
                                     windows title for identification purposes.

  titleExtension                     [string] will be appended to the console 
                                     windows title for identification purposes.

  saveResultsTo                      [string] relative (to the path containing 
                                     ProcessMonitor.exe) path and file Name 
                                     where to save the results of the monitoring

  killChildProcesses                 when the process will be terminated, all 
                                     child processse are killed, too

  childProcessesWaitForEndTimeSec    timespan how long the program will wait 
                                     for ending of child processes, after main 
                                     process has ended (unit is seconds, 
                                     default is 0 seconds)

  simulateTermination                the termination of a process will be only 
                                     simulated

  runtimeLimitSeconds                [int] the process will be killed after the
                                     speficied time in seconds

  noRespondingGuiSeconds             [int] the process will be killed when its 
                                     GUI does not respond longer then the 
                                     speficied time in seconds

  waitForReturnOnExitSeconds         [int] seconds to wait for return keypress 
                                     before ending the program. Defaults to 0 
                                     for instant exit.

  UseCMMStopMethod                   [bool] if set, a special stop method will 
                                     be used for cmm processes (use with param:
                                     CMMStopBatFile)

  CMMStopBatFile                     [string] file or search mask for cmm stop 
                                     bat file (use with param: 
                                     UseCMMStopMethod)
Example: 
                                     #JobRoot_DP#\*_STOP_CMM.bat

  CMMStopSolidWorksOnEnd             [bool] if set, solid works process will be
                                     killed on end, when it's running

  KillTCServerProcessOnEnd           [bool] if set, corresponding tcserver 
                                     process is searched by its Tctp id, if 
                                     tcserver process was found it will be 
                                     killed on end of the process
Requirement:
                                     NXSyslog file has to be set as 
                                     tailTextFile (see variable tailTextFile)

  cpuCores                           [int] number of CPU Cores the process will
                                     use, needed for correct calculation of 
                                     CPU-UsagePercent. If omitted or 0, all 
                                     available Cores are used.

  cpuUsageHigh                       [percent;timeoutSec(;averagingTimespanSec)]
                                     the Process will be killed if the 
                                     CPU-Usage is higher then [percent] for 
                                     longer then [timeoutSec] Seconds. Each 
                                     measure is an average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  cpuUsageLow                        [percent;timeoutSec(;averagingTimespanSec)]
                                     the Process will be killed if the 
                                     CPU-Usage is lower then [percent] for 
                                     longer then [timeoutSec] Seconds. Each 
                                     measure is an average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  cpuUsageStatic                     [percentOffset;timeoutSec(;averagingTimespa
                                     nSec)] the Process will be killed if the 
                                     CPU-Usage stays withing -/+ 
                                     [percentOffset] for longer then 
                                     [timeoutSec] Seconds. Each measure is an 
                                     average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  threadCpuCoreUsage                 [percent;timeoutSec(;averagingTimespanSec)]
                                     the Process will be killed if the 
                                     CpuCore-Usage of a single Thread is higher
                                     then [percent] for longer then 
                                     [timeoutSec] Seconds. Each measure is an 
                                     average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  usePrivateWorkingSet               use the private memory working set only 
                                     (instead of the complete working set 
                                     including shared memory)

  memoryUsageHigh                    [megabytes;timeoutSec(;averagingTimespanSec
                                     )] the Process will be killed if the 
                                     memory-Usage is higher then [megabytes] 
                                     for longer then [timeoutSec] Seconds. Each
                                     measure is an average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  memoryUsageLow                     [megabytes;timeoutSec(;averagingTimespanSec
                                     )] the Process will be killed if the 
                                     memory-Usage is Lower then [megabytes] for
                                     longer then [timeoutSec] Seconds. Each 
                                     measure is an average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  memoryUsageStatic                  [megabytesOffset;timeoutSec(;averagingTimes
                                     panSec)] the Process will be killed if the
                                     memory-Usage stays within +/- 
                                     [megabytesOffset] for longer then 
                                     [timeoutSec] Seconds. Each measure is an 
                                     average over a timespan of 
                                     [averagingTimespanSec] milliseconds, which
                                     defaults to 1/10 [timeoutSec].

  monitorExistingFiles               if set, previously existing files are 
                                     monitored, too by [fileLastWriteTime] and 
                                     [fileContainsString], if omitted only new 
                                     created files will be monitored

  tailTextFile                       [C:\temp\MyProcess*.log] find the first 
                                     file in [C:\temp\] 
                                     [C:\temp\.\MyProcess*.log] find the first 
                                     file in any sub dirs [C:\temp\....]. File 
                                     will be monitored and new content will be 
                                     printed to the console of ProcessMonitor 
                                     Window.

  tailForceMilliseconds              [int] interval in milliseconds the file 
                                     will be forced tailed without detected 
                                     changes. #Default:[5000 milliseconds]. 
                                     #Doc:[Value 0 deactivates this methode]

  tailTextFileWaitTimeSec            [int] interval in seconds until the 
                                     process monitor searches for the 
                                     tailTextFile. If the file was not found, 
                                     the Process Monitor will stop and kill all
                                     monitored processes. #Default:[-1 
                                     seconds]. #Doc:[Value -1 deactivates this 
                                     methode]

  tailTextFile_log                   [%JobRoot_DP%\JobTemp\NxSyslogContainsTimeS
                                     tamps_log.txt] if variable is set, a log 
                                     file with the tailed file and included 
                                     timestamps will be created

  duraTimeSpanIfGreaterThen          [1000] if variable is set, duration time 
                                     will be printed out, if duration is 
                                     greater then the defined time (in 
                                     milliseconds), -1 is off

  fileTailLines_ignoreList           [*ignore Test Line 1*;*ignore Text line 
                                     2*] defines strings that will NOT be 
                                     printed in the cmd window and NOT in the 
                                     logfile if they match with the current 
                                     line, you can use wildcards (case 
                                     insensitive, use * and ? as placeholder), 
                                     use ';' to define mutiple ignore mach keys

  fileLastWriteTime                  [x:\path\filemask*.log;timeoutSec] search 
                                     for all files in [x:\path\] 
                                     [x:\path\.\filemask*.log;timeoutSec] 
                                     search for all files including any subdirs
                                     of [x:\path\....]. The process will be 
                                     killed if none of the files specified by 
                                     the [filemask] is changed longer then 
                                     specified by [timeoutSec]

  fileContainsString                 [x:\path\filemask*.*log*;String1(;String2;S
                                     tringN)] search for first file 
                                     'filemask*.*log*' in path x:\path 
                                     [x:\path\.\filemask*.*log*;String1(;String2
                                     ;StringN)] search for first file 
                                     'filemask*.*log*' in any subdir begining 
                                     with path [x:\path\....]. The process will
                                     be killed if one of the files specified by
                                     the [filemask] conains any of the 
                                     specified strings. Caution: if a String 
                                     contains a semicolon you have to escape it
                                     with a backslash (like this \;), otherwise
                                     the String will be split into two strings!


some usage examples
-------------------

JFProcessMonitor --processId 1753 --runtimeLimitSeconds 60

monitors an existing process with PID 1753. The process will be terminated when
 running longer then 60 seconds.


JFProcessMonitor --processName worker --killChildProcesses --cpuCores 1 
--cpuUsageHigh 95;30

monitors an existing process named worker.exe, which is a child process of the 
own parent process. The process will be terminated with all its child processes
 when the cpu usage is beyound 95% for a time longer then 30 seconds. Each 
measure will be an average of 3 seconds (10% of the timeout). The process will 
only use one CPU core.


JFProcessMonitor -n worker -p 0 -w 2500 --memoryUsageStatic 10;120;5

will monitor a process named worker.exe, which should start within 2500ms as a 
child of the own parent process. This process will be terminated if its memory 
usage stays static for more then 120sec within a range of +/- 10MB. Each 
measure will be an average of 5 seconds.


JFProcessMonitor -n worker -w 2500 --parentProcessId 846 --cpuUsageLow 2;600

will monitor a process named worker.exe, which should start within 2500ms as a 
child of the process with ID 846. This process will be terminated if its cpu 
usage keeps lower then 2% for more then 600sec. Each measure will be an average
 of 60 seconds (10% of the timeout).


JFProcessMonitor -i 1000 --threadCpuCoreUsage 90;30;2

will monitor an existing process with the ID 1000. This process will be 
terminated if one of its threads uses more then 90% of a single CPU-Core for 
more then 30sec. Each measure will be an average of 2 seconds.


JFProcessMonitor -i 1000 --fileLastWriteTime "c:\path\to files\*.log;60"

will monitor an existing process with the ID 1000. This process will be 
terminated when no file named [*.log] in [C:\path\to files] is modified for 
longer then 60 seconds. Only files created after monitoring starts are watched.


JFProcessMonitor -i 1000 --monitorExistingFiles --fileContainsString 
"c:\path\to files\*.log;error #7520;failing process;exception\; giving up"

will monitor an existing process with the ID 1000. This process will be 
terminated if any of the strings [error #7520], [failing process] or 
[exception; giving up] is found in any file [*.log] in [C:\path\to files]. 
Previously existing files are monitored, too.

