Plugin process.spf

File: process.spf
Author: Nicholas Nemtsev
Description: Assigning a specified priority to a process; tracing the moment when the process stops to load the CPU.

New words:


S" process-name" <priority-class> PRIORITY

Assigns to a process a specified priority from the list of priority classes .

Examples:

S" plugger.exe" HIGH_PRIORITY_CLASS PRIORITY
S" test.exe" IDLE_PRIORITY_CLASS PRIORITY

S" process-name" <interval-sec> <min-usage> <max-count> PROC-WAIT-CPU-USAGE

This postfix word pauses the execution of the task until the specified process stops to load the CPU. When the percentage of time that a process used the CPU becomes lower, than specified in PROC-WAIT-CPU-USAGE arguments, the task execution is resumed.

There is a description of PROC-WAIT-CPU-USAGE arguments:

Let's examine the following code::

S" calculator.exe" 10 20 5 PROC-WAIT-CPU-USAGE

Explanation: pause the task and monitor the calculator.exe CPU time usage for every 10 seconds. Resume the task when the percentage of time that a process used the CPU becomes lower than 20% five time in a row.

Example:

#( test_proc-wait-cpu-usage
WatchHotKey: "^@r"
Action:
    START-APP: d:\tools\robosoft\robosoft.exe
    S" robosoft.exe" 2 1 3 PROC-WAIT-CPU-USAGE
    BEEP: 500 500
    \ ...
)#

This word only works in WinNT/2000/XP.