|
4 | 4 |
|
5 | 5 | --- |
6 | 6 |
|
7 | | -The `config.json` configuration file is used to manage the behavior of the **Process Governor** application. It allows |
8 | | -you to define how the application will regulate the priorities of processes and services, their I/O priorities, and |
9 | | -correspondence to CPU cores. |
| 7 | +The `config.json` configuration file manages the behavior of the **Process Governor** application. This file allows |
| 8 | +users to define rules for regulating process priorities, I/O priorities, and CPU core affinity, as well as manage |
| 9 | +services with similar settings. |
10 | 10 |
|
11 | | -The configuration file is regularly checked by the application and applied if there are changes. |
| 11 | +The application regularly checks the configuration file for changes and applies the updates accordingly. |
12 | 12 |
|
13 | | -### Configuration File Example |
| 13 | +--- |
| 14 | +## Configuration File Example |
| 15 | + |
| 16 | +Below is an example of the configuration file with several rules defined for processes and services: |
14 | 17 |
|
15 | | -In this example, two rules are defined: one for a process and one for a service. |
| 18 | +<details> |
| 19 | + <summary>See an example</summary> |
16 | 20 |
|
17 | 21 | ```json |
18 | 22 | { |
19 | 23 | "ruleApplyIntervalSeconds": 1, |
20 | | - "logging": { |
21 | | - "enable": true, |
22 | | - "level": "WARN", |
23 | | - "maxBytes": 1024, |
24 | | - "backupCount": 1 |
25 | | - }, |
26 | | - "rules": [ |
| 24 | + "processRules": [ |
| 25 | + { |
| 26 | + "selectorBy": "Name", |
| 27 | + "selector": "aida_bench64.dll", |
| 28 | + "force": "N" |
| 29 | + }, |
| 30 | + { |
| 31 | + "selectorBy": "Name", |
| 32 | + "selector": "bg3*.exe", |
| 33 | + "affinity": "0-15", |
| 34 | + "force": "N", |
| 35 | + "delay": "30" |
| 36 | + }, |
| 37 | + { |
| 38 | + "selectorBy": "Name", |
| 39 | + "selector": "logioptionsplus_*.exe", |
| 40 | + "priority": "Idle", |
| 41 | + "ioPriority": "Low", |
| 42 | + "affinity": "0-15", |
| 43 | + "force": "N" |
| 44 | + }, |
| 45 | + { |
| 46 | + "selectorBy": "Name", |
| 47 | + "selector": "discord.exe", |
| 48 | + "priority": "Normal", |
| 49 | + "affinity": "0-15", |
| 50 | + "force": "Y" |
| 51 | + }, |
27 | 52 | { |
28 | | - "processSelector": "example.exe", |
29 | | - "priority": "High", |
30 | | - "ioPriority": "Normal", |
31 | | - "affinity": "1;3-5" |
| 53 | + "selectorBy": "Name", |
| 54 | + "selector": "audiodg.exe", |
| 55 | + "priority": "Realtime", |
| 56 | + "affinity": "16-23", |
| 57 | + "force": "N" |
32 | 58 | }, |
33 | 59 | { |
34 | | - "serviceSelector": "Audio*", |
| 60 | + "selectorBy": "Name", |
| 61 | + "selector": "*", |
| 62 | + "affinity": "0-15", |
| 63 | + "force": "N" |
| 64 | + } |
| 65 | + ], |
| 66 | + "serviceRules": [ |
| 67 | + { |
35 | 68 | "priority": "Realtime", |
36 | | - "ioPriority": "High", |
37 | | - "affinity": "0;2;4" |
| 69 | + "selector": "*audio*", |
| 70 | + "force": "N" |
38 | 71 | } |
39 | | - ] |
| 72 | + ], |
| 73 | + "version": 3 |
40 | 74 | } |
41 | 75 | ``` |
| 76 | +</details> |
| 77 | + |
| 78 | +--- |
42 | 79 |
|
43 | 80 | ## Structure of the `config.json` |
44 | 81 |
|
45 | | -The configuration file consists of several key sections: |
| 82 | +The configuration file contains several sections, each serving a specific purpose. |
46 | 83 |
|
47 | 84 | ### `ruleApplyIntervalSeconds` |
48 | 85 |
|
49 | | -This parameter defines the interval in seconds at which rules will be applied to processes and services. The default |
50 | | -value is `1`, which means that rules are applied every second. |
| 86 | +This parameter defines the interval, in seconds, at which the application applies the rules to processes and services. |
| 87 | +The default value is `1`, meaning rules are applied every second. |
51 | 88 |
|
52 | | -### `logging` |
| 89 | +### `processRules` |
53 | 90 |
|
54 | | -This section contains logging settings. It allows you to enable or disable logging, set the logging level, the maximum |
55 | | -size of the log file, and the number of backup log files to keep. |
| 91 | +This section lists the rules applied to processes. Each rule object specifies how the application should manage a |
| 92 | +process based on several key parameters: |
56 | 93 |
|
57 | 94 | #### Possible parameters: |
58 | 95 |
|
59 | | -- `enable`: Enables or disables logging. |
60 | | -- `level`: The logging level (`INFO`, `WARN`, etc.). |
61 | | -- `maxBytes`: The maximum size of the log file in bytes. |
62 | | -- `backupCount`: The number of backup log files. |
63 | | - |
64 | | -### `rules` |
65 | | - |
66 | | -This section defines the list of rules by which **Process Governor** will manage processes and services. Each rule is |
67 | | -defined by an object with a set of parameters. |
68 | | - |
69 | | -#### Possible parameters: |
| 96 | +- **`selectorBy`** (string): Determines how the `selector` value is interpreted for process matching. |
| 97 | + **Valid values:** |
| 98 | + - `"Name"`: Match by process name (e.g., `"notepad.exe"`). |
| 99 | + - `"Path"`: Match by full executable path (e.g., `"C:/Windows/System32/notepad.exe"`). |
| 100 | + - `"Command line"`: Match by command line (e.g., `"App.exe Document.txt"`). |
70 | 101 |
|
71 | | -- `processSelector` (string, optional): Specifies the process name or pattern to match. |
72 | | - You can use wildcards, including `*` and `?`, to match multiple processes. |
73 | | - - Example: `"processSelector": "example.exe"` |
74 | | - - Example with wildcards: `"processSelector": "logioptionsplus_*.exe"` |
75 | 102 |
|
| 103 | +- **`selector`** (string): Specifies the name, pattern, or path to the process. |
| 104 | + **Supported wildcards:** |
| 105 | + - `*`: Matches any number of characters. |
| 106 | + - `?`: Matches a single character. |
| 107 | + - `**`: Matches any sequence of directories. |
76 | 108 |
|
77 | | -- `serviceSelector` (string, optional): Specifies the service name or pattern to match. |
78 | | - You can use wildcards, including `*` and `?`, to match multiple services. |
79 | | - - Example: `"serviceSelector": "MyService"` |
80 | | - - Example with wildcards: `"serviceSelector": "Audio*"` |
| 109 | + **Examples:** |
| 110 | + - `"selector": "name.exe"` |
| 111 | + - `"selector": "logioptionsplus_*.exe"` |
| 112 | + - `"selector": "C:/Program Files/**/app.exe --file Document.txt"` |
81 | 113 |
|
82 | 114 |
|
83 | | -- `priority` (string, optional): Sets the process or service priority. |
84 | | - Valid values are: |
| 115 | +- **`priority`** (string, optional): Sets the priority level of the process. |
| 116 | + **Valid values:** |
85 | 117 | - `"Idle"` |
86 | 118 | - `"BelowNormal"` |
87 | 119 | - `"Normal"` |
88 | 120 | - `"AboveNormal"` |
89 | 121 | - `"High"` |
90 | 122 | - `"Realtime"` |
91 | | - - Example: `"priority": "High"` |
| 123 | + |
| 124 | + **Example:** `"priority": "High"` |
92 | 125 |
|
93 | 126 |
|
94 | | -- `ioPriority` (string, optional): Sets the I/O priority for the process or service. |
95 | | - Valid values are: |
| 127 | +- **`ioPriority`** (string, optional): Sets the I/O priority of the process. |
| 128 | + **Valid values:** |
96 | 129 | - `"VeryLow"` |
97 | 130 | - `"Low"` |
98 | 131 | - `"Normal"` |
99 | | - - `"High"`: Setting the I/O priority to "High" may result in an AccessDenied error in most cases. |
100 | | - - Example: `"ioPriority": "Normal"` |
| 132 | + |
| 133 | + **Example:** `"ioPriority": "Low"` |
101 | 134 |
|
102 | 135 |
|
103 | | -- `affinity` (string, optional): Specifies CPU core affinity. |
104 | | - You can define affinity as: |
| 136 | +- **`affinity`** (string, optional): Sets the CPU core affinity for the process. |
| 137 | + **Formats:** |
105 | 138 | - Range (inclusive): `"affinity": "0-3"` |
106 | 139 | - Specific cores: `"affinity": "0;2;4"` |
107 | 140 | - Combination: `"affinity": "1;3-5"` |
108 | 141 |
|
109 | | -### Validation |
110 | 142 |
|
111 | | -Built-in validation prevents the simultaneous assignment of `processSelector` and `serviceSelector` within a single |
112 | | -rule. If you attempt to set both parameters, the program will notify you of the error and require you to correct the |
113 | | -rule. |
| 143 | +- **`force`** (string, optional): Forces the application of the settings. |
| 144 | + **Valid values:** |
| 145 | + - `"Y"` for continuous enforcement. |
| 146 | + - `"N"` for one-time application. |
| 147 | + |
| 148 | + |
| 149 | +- **`delay`** (integer, optional): Delay in seconds before applying the settings. |
| 150 | + **Examples:** |
| 151 | + - If not specified, the settings are applied immediately. |
| 152 | + - Positive values set a delay in seconds before applying the settings. |
| 153 | + |
| 154 | +### `serviceRules` |
| 155 | + |
| 156 | +This section contains a list of rules applied to services. Unlike `processRules`, the **Service Rule** does not include |
| 157 | +the `selectorBy` field because service rules only match by service name using the `selector` field. |
| 158 | + |
| 159 | +#### Possible parameters: |
| 160 | + |
| 161 | +- **`selector`** (string): Specifies the name or pattern of the service to match. |
| 162 | + **Supported wildcards:** |
| 163 | + - `*`: Matches any number of characters. |
| 164 | + - `?`: Matches a single character. |
| 165 | + |
| 166 | + **Examples:** |
| 167 | + - `"selector": "ServiceName"` |
| 168 | + - `"selector": "*audio*"` |
| 169 | + |
| 170 | +Other parameters such as `priority`, `ioPriority`, `affinity`, `force`, and `delay` are similar to those |
| 171 | +in `processRules`. |
| 172 | + |
| 173 | +### `version` |
| 174 | + |
| 175 | +This field specifies the version of the configuration. It is required for ensuring proper migration and updates when the |
| 176 | +program configuration changes over time. |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## Validation |
| 181 | + |
| 182 | +The configuration file undergoes validation to ensure consistency and correctness. If there are any issues, such as |
| 183 | +invalid parameter combinations or missing required fields, the application will notify the user and prevent the |
| 184 | +configuration from being applied until the errors are resolved. |
0 commit comments