Skip to content

Watchdog 2.0 (If This, Then That)

  • Menu path: ‘Options / Control / Watchdog…’

Beta

Watchdog 2.0 is only in the current Process Lasso beta versions for now, and arrives in the next final release.

Watchdog 2.0 rules act on a process when the conditions you choose are true. A rule can combine several conditions, such as CPU use, memory use, the process's age or whether another process is running. It then runs one or more actions in order, such as lowering the priority, setting a CPU affinity or running a program. Actions that change a setting can be undone automatically when the conditions no longer hold.

Process Lasso has one Watchdog, with two kinds of rules: Watchdog 2.0 rules, described here, and the older Watchdog 1.0 rules. ‘Options / Control / Watchdog…’ opens the Watchdog 1.0 rules when you have any, so they stay in view, and the Watchdog 2.0 rules otherwise. Each dialog opens the other: click Watchdog 1.0 Rules… in this one, or Watchdog 2.0 Rules… in the Watchdog 1.0 dialog. Each dialog saves its own rules when you click its OK.

Rules of both kinds can apply to the same process, and neither one's "stop" setting affects the other. To move your Watchdog 1.0 rules to Watchdog 2.0, see Converting Watchdog 1.0 Rules.

To create a rule for a specific process, right-click it in the process list and choose ‘More / Watchdog Rules…’. The dialog that opens starts a new rule with the process match filled in for you.

Rules

The list at the top of the dialog shows every rule with what it checks (If) and what it does (Then). Rules are checked from top to bottom each time Process Lasso checks the running processes; use Move Up and Move Down to change the order. Clear Run Watchdog 2.0 rules to stop every rule from running without deleting any.

Select a rule to edit it below the list:

  • Name: An optional label, shown in the list and in the log. Without a name, the process match is shown.
  • Enabled: Clear it to keep the rule without running it.
  • Process match: The process(es) the rule applies to. Wildcards and Regular Expressions are supported, as with other rules, and the box accepts phrases from the Process Lasso Rule Builder. See Process Matching.
  • If all of these conditions / any of them: Whether every condition must be true, or at least one. A rule without conditions applies to every matching process.
  • Hold for … seconds: How long the conditions must stay true before the actions run. If they stop being true, the time starts over. 0 runs the actions at the first check.
  • Then: The actions, run in the order listed.
  • Run the actions: Once per process runs them once in each process's life. Again every … seconds while true repeats them while the conditions hold. Each time the conditions become true runs them again whenever the conditions stop being true and then become true again.
  • Undo after the conditions clear for … seconds: Available when an action is set to be undone. The change stays until the conditions have stopped being true for this long; if they become true again sooner, nothing is undone and the actions don't run again. 0 undoes at the first check. See Undoing Actions.
  • Skip the rules below while this rule applies: While this rule's conditions hold for a process (after the hold time), the rules below it are skipped for that process.
  • Write to the log: Log each time the rule's actions run, and each time they are undone. Errors are always logged.

If a rule can't run, for example because it has no actions, the dialog says why below the rule, and asks before saving it.

Conditions

Number conditions are compared with >, ≥, <, ≤, = or ≠. Priority conditions are compared with = or ≠, and yes/no conditions with Is true or Is false.

Condition Value Notes
CPU use (all cores) % 100% means every logical processor is busy, as in Task Manager.
CPU use (one core) % 100% means one logical processor is busy, so a process can go above 100%.
Working set MB
Private working set MB
Private bytes MB
Commit charge MB
Page faults per second
I/O rate MB per second Bytes read and written.
Thread count
Handle count
Process age seconds
Just started yes/no True at the first check of a process that started after the rule was created or last changed, and after Process Lasso started. Processes that were already running don't count.
Instance count Running processes with the same name that started before this one, plus this one. The newest instance counts them all, so a rule that terminates above a count ends the newest instances and keeps the oldest.
CPU priority priority class
I/O priority I/O priority
Memory priority memory priority
Efficiency mode on yes/no
Elevated yes/no
Session ID
In the foreground yes/no The process owns the window that has input focus.
CPU affinity is CPU list True when the affinity is exactly these CPUs, written as in other rules, e.g. 0-3;6.
CPU affinity includes CPU list True when the affinity includes every CPU in the list.
Parent process matches process match The direct parent only.
Another process is running process match
System CPU use %
System memory load %
Performance Mode active yes/no See Performance Mode.
On battery power yes/no

A condition whose value can't be read, such as a rate at the first check of a new process or a value of a protected process, is not true.

Actions

Action Can be undone Notes
Write a log entry
Terminate the process Services are stopped through the service manager, and terminated if they don't stop.
Restart the process Services are restarted through the service manager.
Set CPU priority Yes
Set I/O priority Yes
Set memory priority Yes
Set CPU affinity Yes Written as in other rules, e.g. 0-3;6.
Set CPU sets Yes Written as a CPU affinity.
Set efficiency mode Yes On or off.
Trim the working set
Hard throttle Yes Level 1 (lightest) to 20. See Hard-Throttling.
Run a program See Run a Program.

While ProBalance is restraining a process, a rule's change to a setting the restraint changed, such as the CPU priority, takes effect when the restraint ends: ProBalance then restores the rule's setting instead of the one the process had before.

Undoing Actions

Check Undo when the conditions clear on an action to put the setting back as it was when the conditions no longer hold, when the rule is disabled, changed or removed, and when Process Lasso exits.

By default the change is undone at the first check where the conditions are no longer true. Set Undo after the conditions clear for … seconds to wait instead: the change stays until the conditions have been false for that long, and if they become true again before then, the change simply stays in place. This gives a rule hysteresis, so a value hovering around the threshold doesn't flip the setting back and forth. For example, one rule can lower a browser's priority when it uses more than 25% CPU for 15 seconds and restore it once it has stayed below for 10 seconds, instead of a pair of rules.

If something else changed the setting after the rule did, the setting is left as it is, and the log says the action was not undone. On versions of Windows that can't report a process's efficiency mode, such as Windows 10, a change to efficiency mode isn't undone.

Run a Program

Enter the program and its command line. In the command line, %1 is the process's PID, %2 its name, %3 its path, %4 its user and %5 its session ID.

The program runs without administrator rights unless Run elevated is checked. When the Process Lasso governor runs as a service, it can't start programs in your session, so these actions are not run and the log says why. The dialog then offers to run the governor as a normal process instead.

Converting Watchdog 1.0 Rules

Converting is optional: Watchdog 1.0 rules keep working as they are. To move them to Watchdog 2.0, open the Watchdog 1.0 dialog and click Convert to Watchdog 2.0….

  • Every Watchdog 1.0 rule is converted, never just some of them. If you changed the list and haven't saved, Process Lasso asks you to click OK first, then open Watchdog again and convert.
  • Process Lasso first shows how many rules it will convert, with a note on any rule that will work differently (see below). Nothing changes until you confirm.
  • The converted rules open in the Watchdog 2.0 dialog, not yet saved, and Run Watchdog 2.0 rules is switched on. Check them there. OK saves them and removes the Watchdog 1.0 rules in the same step, so no rule ever runs twice. Cancel leaves everything as it was. Until you choose, the Watchdog 1.0 Rules… button is unavailable.
  • Each converted rule is named after what it does, for example Set CPU priority: Below normal when CPU use (all cores) > 25% (for 15 s), in the language Process Lasso shows at the time. You can rename it.
  • Each converted rule remembers the Watchdog 1.0 rule it came from. Converting again skips rules that were already converted, and importing an older rules export doesn't bring back a Watchdog 1.0 rule that has been converted.

A converted rule acts as its Watchdog 1.0 rule did:

Watchdog 1.0 Watchdog 2.0
CPU above or below a percentage CPU use (all cores) above or below it
Memory above or below a number of MB Working set or Commit charge; "any memory metric" becomes both, with any of them
Time over the threshold Hold for … seconds
The action runs once, and again only after the process went back within the threshold Each time the conditions become true
Terminate Terminate the process, tried again at every check while the conditions hold
Trim virtual memory Trim the working set (repeated at every check if the Watchdog 1.0 trim was set to repeat)
Log occurrence Write a log entry
Execute Run a program, elevated, as the Watchdog 1.0 action ran
Stop processing rules A rule with no conditions and Skip the rules below while this rule applies
Change affinity, CPU priority, I/O priority, Restart The same action. Watchdog 1.0 never undid a change, so Undo when the conditions clear is off

The confirmation notes these rules:

  • Rules that never ran. A Watchdog 1.0 rule that compared total virtual memory with "greater than", or had no comparison, never took action. It is converted switched off, so it still doesn't run.
  • Rules that always ran. A total virtual memory "less than" rule took action whenever the process was running. It is converted with no conditions, which does the same.
  • Rules with the same settings. When two Watchdog 1.0 rules differ only in their process match and both match a process, Watchdog 1.0 ran them once for it. Watchdog 2.0 runs each.

While ProBalance is restraining a process, a converted rule's priority or affinity change now lasts after the restraint ends, as described under Actions. Watchdog 1.0's change was undone when the restraint ended.

Testing a Rule

Click Test Rule… to check the selected rule against the processes running now. Each matching process is listed with whether the conditions hold and the current value of each condition. The test ignores the hold time and runs no action. Click Refresh to check again.

Log Entries

Log entry Meaning
Watchdog 2.0 rule applied A rule's actions ran. The entry names the rule, the conditions that held and the actions.
Watchdog 2.0 action undone A setting was put back because the rule no longer applies.
Watchdog 2.0 action not undone A setting was left as it is, because it changed after the rule made it or could not be put back.
Watchdog 2.0 action error An action could not be completed, or this version can't do it.
Watchdog 2.0 rule error A rule will not run, and why.

Entries for the same rule and process are written at most once every 10 seconds. See Logging.

Rules From Other Versions

A rule written by a newer version of Process Lasso, or one with a condition or action this version doesn't know, is kept exactly as it is and doesn't run. The list shows why. It can be moved or deleted, but not edited.

Where Rules Are Stored

Rules are stored in the [Watchdog2] group of the INI configuration file, one JSON object per rule. They are included in rules exports and in Copy Rules and Paste Rules in the process list.

Processes with a Watchdog rule of either kind show a ‘W’ in the Rules column. The Rules window (‘Options / View All Rules’) shows both kinds in its Watchdog rules column: the number of Watchdog 1.0 rules, then the Watchdog 2.0 rules by name.