~eckso/knobs

Manage clock frequencies and power limits on Linux systems
update msrv
use inspect rather than map for trace logging
update Cargo.lock, silence dead code warnings for conversion traits

clone

read-only
https://git.sr.ht/~eckso/knobs
read/write
git@git.sr.ht:~eckso/knobs

You can also use your local clone with git send-email.

#knobs

#About

knobs is a command-line tool for setting and displaying clock frequencies, power limits, and related values on Linux systems.

knobs provides a daemon and client that communicate via Unix domain socket. The daemon runs as root and performs system io on behalf of the client, which typically runs as a non-root user. Access to the daemon is determined by ownership and mode of the socket.

knobs can be used on desktops, headless servers, gaming handhelds, smart phones, network devices, and more.

#Commands

Name Capability Feature
amd-pstate epp default
amdgpu perf level, perf mode default
cpu online/offline, smt default
cpufreq min/max frequencies, boost, governor default
drm list cards, drivers, and bus ids default
i915 min/max/boost frequencies default
intel-pstate epb, epp, no_turbo, etc. default
intel-rapl short/long limit, short/long window default
intel-uncore min/max frequencies default
ryzen libryzenadj front-end ryzen

#Usage

When invoked, a knobs subcommand will...

  1. write system values passed via command line flags, if present.
  2. print one or more tables displaying current system values, unless quieted with -q/--quiet.

#Examples

See knobs --help for more information.

  • Set all CPUs offline except for CPU 0.
$ knobs cpu --id 1.. --on 0
  • List available CPU frequency governors.
$ knobs cpufreq --gov list
  • Set CPU frequency governor to ondemand for all cpufreq policies.
$ knobs cpufreq --id .. --gov ondemand
  • List available EPPs (Intel systems).
$ knobs intel-pstate --epp list
  • Set EPP to balance_power for CPUs 0 through 11 (Intel systems).
$ knobs intel-pstate --id ..11 --epp balance_power
  • List amdgpu performance modes.
$ knobs amdgpu --perf-mode list
  • Set amdgpu card 0 performance level to manual and mode to 5 (e.g. COMPUTE on 6900 XT).
$ knobs amdgpu --id 0 --perf-level manual --perf-mode 5

#Multicall

Subcommands (and their aliases) can be run as stand-alone commands via symlinks, a la busybox.

$ ln -s $(which knobs) cpufreq
$ ./cpufreq
 Pol  CPU  Gov          Cur      Min      Max      Min lim  Max lim
 ---  ---  -----------  -------  -------  -------  -------  -------
 0    0    performance  800 MHz  800 MHz  5.3 GHz  800 MHz  5.3 GHz
...etc...
$ ln -s $(which knobs) intel-rapl
$ ./intel-rapl
 Enable  Zone  Name       Long lim  Short lim  Long win     Short win  Usage
 ------  ----  ---------  --------  ---------  -----------  ---------  ------
 yes     0     package-0  250.0 W   250.0 W    55967744 μs  2440 μs    26.6 W
...etc...

#Device IDs

Most device IDs (-i/--id) can be passed as...

  • Integers:
-i 0       --id 0
-i 10      --id 10
  • Bounded ranges:
-i 0..12   --id 0..12
  • Unbounded ranges:
-i 0..     --id 0..
-i ..12    --id ..12
-i ..      --id ..
  • A comma-delimited list of any of the above:
-i ..5,6,7,8..10,20..      --id ..5,6,7,8..10,20..
Do not follow this link