Configure pidusage options
mainYou can pass an options object to pidusage() to customize behavior. These options override the corresponding environment variables.
| Option | Type | Env Var | Default | Description |
|---|---|---|---|---|
usePs | boolean | PIDUSAGE_USE_PS | false | If true, uses the ps command instead of parsing /proc files. |
maxage | number | PIDUSAGE_MAXAGE | 60000 | Maximum age of a process in history (ms). |
Additionally, setting the environment variable PIDUSAGE_SILENT=1 will suppress all console messages triggered by the library.
// Use 'ps' instead of proc files
pidusage(pid, { usePs: true })