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.

  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

  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.

  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(;averagingTimespanSec)] 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(;averagingTimespanSec)] 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                  [x:\path\to\file.txt] this file will be monitored and new content 
                                will be printed to the console

  fileLastWriteTime             [x:\path\filemask;timeoutSec] 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;String1(;String2;StringN)] 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 "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.

