#sysfs #linux #command-line-tool #cli #cpufrequtils

bin+lib mediocore

discover and manipulate linux cpu frequency settings

1 unstable release

Uses old Rust 2015

0.1.0 Jan 20, 2019

#16 in #sysfs

MPL-2.0 license

24KB
485 lines

mediocore - a more convenient cpufrequtils

What is mediocore?

mediocore is a Rust implementation of the cpufrequtils toolkit used to get and set per-CPU-core frequency scaling governor and CPU frequency target.
Like the original cpufrequtils, it uses Linux' sysfs to retrieve and manipulate the current CPU governor parameters located under /sys/devices/system/cpu/cpu/.
The main grief with cpufreq-set is that it only operates on single cores, so it must be wrapped in scripts (for example to set all of your cores to minimum frequency for maximum battery lifetime).
mediocores' mdcr command provides convenient shortcuts to set parameters for all cores or display current settings. Mediocore also sanity checks inputs by first discovering current and viable settings.

Installing

With Rust installed run cargo install mediocore to install the mdcr utility.

Usage

Run mdcr help to show available commands and mdcr help <subcommand> to see per.

  • mdcr show discovers and displays current/possible settings in a console friendly way
  • mdcr show --json writes discovered settings to stdout as json
  • mdcr set [-g governor] [-l lower_threshold] [-h upper_threshold] [-c comma_separated_list_of_core_numbers] applies the settings given via -g/-l/-h to all cores unless a set of cores is specified via -c

There are also two shortcut commands:

  • mdcr ps|powersave sets cpu minimum frequency for both lower and upper frequency limits and applies powersave governor.
  • mdcr p|performance sets cpu maximum frequency as the upper frequency limit and applies performance governor.

License

Licensed under MPL2. See LICENSE for details.

Dependencies

~0.4–1.4MB
~29K SLoC