CPUFREQD.CONF(5)

๐Ÿ“ฆ version 2.4.2, in alpine 3.24, debian bookworm, ubuntu jammy

๐Ÿ’– CPUFREQD.CONF(5) ๐Ÿ’–

okay bestie so this is the cpufreqd.conf page from section 5 of the manual, and it's literally the whole lore on the config file for cpufreqd(1). sit down, grab a snack ๐Ÿ“


โœจ NAME โœจ

cpufreqd.conf โ€” it's the configuration file for cpufreqd(1). that's the whole job description, periodt.


๐ŸŒธ DESCRIPTION ๐ŸŒธ

cpufreqd.conf is a simple text file stuffed with rules that cpufreqd(1) reads and uses. no cap, that's it.

It's split into sections, and sections are wrapped in tags, like [General][/General]. The bare minimum you need is at least one [General] section plus one or more [Profile] and [Rule] sections. Heads up though: every [Rule] leans on the [Profile] subsections you defined before it, so order matters, bestie. Also some plugins want their own proper configuration section, so read the room ๐Ÿซถ

Some notes so you can actually write rules that slap:

  • a rule's score is made up of the percentage of entries that match the current system state as reported by plugins plus the number of matching entries. so yeah, even a single-entry rule can hit 100%, but rules that are more accurate get preferred ๐Ÿ‘‘
  • if 2 or more rules tie on score, the first one wins (first as found in the configuration file) โ€” or, if that's applicable, the one that's already applied gets kept and set. no drama, no switching ๐Ÿ’…
  • every single directive is handled by one plugin, and that plugin is the one deciding whether the state you described matches the current system state
  • if no rule matches the current system status, then no action is performed. nothing. silence. the void ๐ŸŒˆ

What to keep in mind when you're writing rules:

  • the -V switch is (hopefully) your friend. test your config by slightly bumping up cpufreqd verbosity and watch what happens. -V6 reports rules' scores, -V7 reports which entry matched and which didn't. it's giving detective mode ๐Ÿ”
  • if you want one rule to be preferred over another, just describe the system state more accurately. that's the whole trick, iykyk

A good approach to writing cpufreqd rules is: first, describe the basic parameters you want for general usage (e.g.: define at least an "AC-on" rule and an "AC-off" rule). then, go describe all the special cases by describing the system state more accurately (e.g.: "AC-off but running mplayer" or "AC-on but temperature too hot"). start basic, get specific, slay โœจ

Note that no white space is allowed between name and value pairs. literally none. and any characters after a '#' are considered comments and get ignored ๐Ÿ™ˆ

๐ŸŽ€ SECTIONS ๐ŸŽ€

Acceptable configuration tokens and values include:

๐Ÿ’œ [General]

  • poll_interval โ€” a float larger than 0.15, it measures the interval between system status readings, in seconds. note: that lower bound is there on purpose, to try and avoid trashing your system if you use a too-low value. (default: 1.0)
  • enable_plugins โ€” a list of plugins separated by comma. as of cpufreqd 2.1.0 this option is useless: cpufreqd will load all available plugins and remove the ones still unused after the configuration file has been read. so like, it's giving vestigial ๐Ÿ’€
  • pidfile โ€” specifies the file to write as its process identification file. (default: /var/run/cpufreqd.pid)
  • enable_remote โ€” makes cpufreqd open a local UNIX socket and listen for a command to be executed. see cpufreqd-set(1) and cpufreqd-set(1) for two very simple clients. (and yes, it says cpufreqd-set twice, we do not make the rules ๐Ÿ˜ญ)
  • remote_group โ€” makes the socket readable and writeable to the specified group. useful to let simple users tweak cpufreqd with cpufreqd-set and cpufreqd-get ๐Ÿซถ
  • double_check โ€” makes cpufreqd check whether the requested policy has actually been applied correctly, by re-reading the corresponding kernel attributes. trust but verify, bestie ๐Ÿ‘€
  • verbosity โ€” verbosity level from 0 (less verbose) to 7 (most verbose). the default value only prints warning/error/critical messages. (default: 4)

๐Ÿฆ‹ [Profile]

  • name โ€” an arbitrary and unique name for your profile. [REQUIRED]
  • minfreq โ€” an integer value representing the minimum frequency to set in /proc/cpufreq. this value can be both a percentage of the CPU full capacity or a frequency in kHz. [REQUIRED]
  • maxfreq โ€” an integer value representing the maximum frequency to set. this value can be both a percentage of the CPU full capacity or a frequency in kHz. [REQUIRED]
  • policy โ€” can be any of the available governor's names as shown in /sys/devices/.../cpufreq/scaling_available_governors. which means: if you compiled governors as modules in your kernel, you need to load them before running cpufreqd. [REQUIRED]
  • other plugin entries โ€” other Profile directives are available according to the enabled plugins.

๐Ÿ’… [Rule]

  • name โ€” an arbitrary and unique name for your rule. [REQUIRED]
  • profile โ€” a character string that must match a [Profile] section name property. a Rule can also associate profiles to single cpus by providing a list of the format CPU%d:%s separated by semicolons (";"), e.g.: profile=CPU0:profile0;CPU1:profile1. the keyword "ALL" can be used to indicate that all cpus must have the profile applied. "ALL" has a lower priority, so you can mix up CPU%d and ALL โ€” meaning that if no specific profile is supplied, the "ALL" one will be used. [REQUIRED]
  • other plugin entries โ€” other Rule directives are available according to the enabled plugins.

โœจ PLUGINS โœจ

okay bestie, plugins are how cpufreqd extends itself so it can handle even the most exotic system parameters. The currently available plugins are listed below, along with the configuration directives they provide and their configuration section description if one exists. let's get into it ๐Ÿ’…


๐Ÿ“ acpi plugin ๐Ÿ“

This plugin includes all the acpi monitoring functionalities that used to be separate plugins. It lets you monitor battery, temperature, and ac, and it interacts with acpid so it can immediately react to ACPI events. main character energy fr fr.

๐ŸŒธ Section [acpi] ๐ŸŒธ

  • acpid_socket โ€” the path to the Acpid open socket (default: /var/run/acpid.socket). When available, cpufreqd will wake up immediately upon event arrival, and battery and ac status updates are forced. no waiting around, we love that.
  • battery_update_interval โ€” the number of seconds that have to elapse before polling the battery again. In such period the battery value will be estimated based on reported power consumption (default: 30).

Rule entries for this plugin:

  • battery_interval โ€” The rule will have a higher score if battery percentage is between the values provided. Can be of the form %d-%d or simply %d for a fixed value (e.g.: battery_interval=10-100) or %s:%d-%d or %s:%d where the string represents the battery name that must match (look at ls /proc/acpi/battery for available names).
  • ac โ€” Can be on or off. The rule will have a higher score if the A/C adapter is on or off as defined in this setting.
  • acpi_temperature โ€” The rule will have a higher score if the temperature percentage corresponds to the provided values. Can be of the form %d-%d or simply %d for a fixed value (e.g.: acpi_temperature=10-100) or %s:%d-%d or %s:%d where the string represents the thermal zone name that must match (look at ls /proc/acpi/thermal_zone for available names).

๐ŸŒˆ apm plugin ๐ŸŒˆ

Monitors values reported by the APM subsystem. Available Rule entries:

  • ac โ€” Can be on or off. The rule will have a higher score if the A/C adapter is on or off as defined in this setting.
  • battery_interval โ€” The rule will have a higher score if battery percentage is between the values provided. Must be of the form %d-%d (e.g.: battery_interval=10-100).

๐Ÿฆ‹ pmu plugin ๐Ÿฆ‹

Monitors values reported by the PMU subsystem. Available Rule entries:

  • ac โ€” Can be on or off. The rule will have a higher score if the A/C adapter is on or off as defined in this setting.
  • battery_interval โ€” The rule will have a higher score if battery percentage is between the values provided. Must be of the form %d-%d (e.g.: battery_interval=10-100).

๐ŸŽ€ tau plugin ๐ŸŽ€

Support for the Thermal Assist Unit to read the CPU temperature from /proc/cpuinfo.

  • tau_temperature โ€” The rule will have a higher score if the temperature is between the values provided. Must be of the form %d-%d (e.g.: tau_temperature=30-60).

๐Ÿ”ฅ cpu plugin ๐Ÿ”ฅ

Monitors the cpu usage. Available Rule entries:

  • cpu_interval โ€” The rule will have a higher score if cpu usage is between the values provided. Must be of the form %d-%d (e.g.: cpu_interval=10-100) or %d:%d-%d to monitor a specific cpu in SMP/SMT systems (e.g.: cpu_interval=1:50-100). Moreover you can combine multiple cpus giving multiple intervals on the same line separated by semicolon (;); if any of them matches, the full directive will match (e.g.: cpu_interval=0:50-100;1:0-60). Additionally you can use the strings "ALL" and "ANY" to request that all cpus or any cpu matches respectively (e.g.: cpu_interval=ANY:50-100). It is possible to specify the scale to calculate niced processes cpu usage with the form %d-%d,%f or %d:%d-%d,%f (e.g.: cpu_interval=1:70-100,1.5), default is 3, in this way niced processes will be considered 1/3 of their real value. Rules with overlapping cpu_intervals are allowed.

๐Ÿ’œ exec plugin ๐Ÿ’œ

Executes command on Rule/Profile selection. Available Rule and Profile entries:

  • exec_pre
  • exec_post

You can give commands that you want to be executed when a Rule or Profile is applied. As the names suggest, exec_pre will be run before a Rule or Profile is applied, exec_post will be run after.


๐Ÿ‘‘ programs plugin ๐Ÿ‘‘

Monitors active processes. Available entries:

  • programs โ€” The rule will have a higher score if one of the listed processes is running. This is a comma separated list. No white space is allowed between values. cpufreqd will try to match each process name with the configured process list. If you need to match against a program from a specific location you have to supply the full path as search pattern.

๐Ÿ’… nforce2_atxp1 plugin ๐Ÿ’…

Allows you to change Vcore of the CPU on the fly if you own a NForce2 board with atxp1 voltage regulator (and its module loaded). The use of this plugin will allow a new Profile directive and requires a configuration section.

๐ŸŒŸ Section [nforce2_atxp1] ๐ŸŒŸ

  • vcore_path โ€” Defines the interface file created by atxp1 module which will be used to change Vcore.
  • vcore_default โ€” As NForce2 boards only initialize the atxp1 on power-on, you need to put back default Vcore before reboot. This value will be used to set Vcore on exit.

Profile directive:

  • vcore โ€” Will set Vcore to this value (given in mV) when the corresponding Profile is applied. Due to safety reasons range is limited from 1200 to 1850.

๐ŸŽฎ nvclock plugin ๐ŸŽฎ

Allows you to tweak the core and memory clock for NVidia cards. The use of this plugin will allow new Profile directives.

NOTE: you MUST use this plugin ONLY with supported cards. See also the nvclock homepage (http://www.linuxhardware.org/nvclock).
  • nv_core โ€” Sets the core clock in MHz. Must be of the form %d:%d where the first integer represents the card number, the second the desired frequency in MHz.
  • nv_mem โ€” Sets the memory clock in MHz. Must be of the form %d:%d where the first integer represents the card number, the second the desired frequency in MHz.

๐ŸŒก๏ธ sensors plugin ๐ŸŒก๏ธ

Allows you to specify lm-sensors features to watch, see sensors -u to find out which sensors are available on your system. A configuration section is also available to tell cpufreqd which sensors.conf file to use. If not specified it will take the first on the default locations.

๐Ÿฆ„ Section [sensors_plugin] ๐Ÿฆ„

  • sensors_conf โ€” Define this directive to the sensors.conf file you want cpufreqd to use to load the sensors library.

Rule entry:

  • sensor โ€” The rule will have a higher score if the given sensor feature reports a value between the two defined. Must be of the form %s:%f-%f where the string represents the feature name or label and the two decimal numbers the interval into which the directive is valid (e.g.: sensor=temp1:0-50).

โš™๏ธ governor_parameters plugin โš™๏ธ

Allows you to specify parameters for governors in [Profile] sections. Currently only the ondemand and conservative governors support parameters. The description of the parameters below is basically a summary of the information found in the file governors.txt in the documentation of kernel versions 2.6.16 or later.

  • sampling_rate โ€” How often the governor checks the CPU usage. Specify in micro-seconds or percentage of mimimum and maximum available values. Supported suffixes: % for a percentage, s for a value in seconds, m for a value in milli-seconds, or u for a value in micro-seconds (the default).
  • up_threshold โ€” What the average CPU usage needs be at least to make the governor decide to switch to a higher frequency. Though the value is interpreted as percentage by the governor, you should not append a % in cpufreqd.conf for this parameter.
  • down_threshold (conservative governor only) โ€” What the average CPU usage needs be at most to make the governor decide to switch to a lower frequency. This is the opposite of up_threshold (see above).
  • sampling_down_factor โ€” How quickly the frequency will be decreased in respect to how quickly it will be increased. E.g. when set to 5, the frequency will go down 5 times less easy than it will go up.
  • ignore_nice, ignore_nice_load โ€” Whether nice processes should be considered as CPU usage by the governor. This is a boolean value (e.g. value is either 0 or 1). When set to 1 nice processes will not be counted as CPU usage by the governor. Note: ignore_nice was renamed to ignore_nice_load in kernel version 2.6.16. Both names are accepted in cpufreqd.conf, regardless the version of the running kernel.
  • freq_step (conservative governor only) โ€” How much the frequency should be changed (up or down) each time the governor decides the frequency should go up or down. The value is the percentage of the maximum available frequency you want the frequency to increase or decrease each time. The actual frequency your CPU runs at will only change when the desired frequency reaches the next available frequency. Though the value is interpreted as percentage by the governor, you should not append a % in cpufreqd.conf for this parameter.

โœจ EXAMPLE โœจ

okay bestie, here's a whole entire config file that actually works, so you can stop guessing and just vibe with it ๐Ÿ’– every line matters, so read the comments, they're literally the lore.

# cpufreqd.conf sample
# this is a comment
[General]
pidfile=/var/run/cpufreqd.pid
poll_interval=2
verbosity=5 #(if you want a minimal logging)
[/General]

[Profile]
name=hi
minfreq=100%
maxfreq=100%
policy=performance
[/Profile]

[Profile]
name=medium
minfreq=66%
maxfreq=66%
policy=performance
[/Profile]

[Profile]
name=lo
minfreq=33%
maxfreq=33%
policy=performance
[/Profile]

[Profile]
name=ondemand_hi
minfreq=0%
maxfreq=100%
policy=ondemand
[/Profile]

[Profile]
name=ondemand_lo
minfreq=0%
maxfreq=66%
policy=ondemand
ignore_nice=1
sampling_rate=80%
[/Profile]

# full power when AC
# max score 101%
[Rule]
name=AC_on
ac=on
profile=hi
[/Rule]

# conservative mode when not AC
# max score 101%
[Rule]
name=AC_off
ac=off
profile=ondemand_hi
[/Rule]

# low battery
# max score 102%
[Rule]
name=lo_battery
ac=off
battery_interval=0-40
profile=ondemand_lo
[/Rule]

# need big power (not if battery very low)
# max score 103%
[Rule]
name=hi_cpu
ac=off
battery_interval=40-100
cpu_interval=ANY:70-100
profile=hi
[/Rule]

# slow down a little if overheated
# max score 103%
[Rule]
name=overheat
acpi_temperature=55-100
cpu_interval=ANY:0-100
battery_interval=40-100
profile=medium
[/Rule]

# full power when watching DVDs and not AC
# can reach a 105% score
[Rule]
name=dvd_watching
ac=off
battery_interval=0-100
acpi_temperature=0-100
cpu_interval=ANY:0-100
programs=xine,mplayer
profile=hi
[/Rule]

like, look at it ๐Ÿ’… the <pink>[Profile]</pink> blocks are your moods โ€” hi is full main character energy at 100%, medium is chillin at 66%, lo is napping at 33%, and the two ondemand ones let the kernel do its own thing between 0% and their maxfreq ๐ŸŒธ

then the <purple>[Rule]</purple> blocks are the vibe check โ€” whichever rule scores highest gets to pick the profile, and yes, those # max score comments in there are fr fr doing math for you ๐Ÿ˜ญ

not me pointing out that dvd_watching can hit a 105% score and just take over โ€” the numbers are all right there in the comments bestie, i don't make the rules, i just explain them ๐Ÿซถ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

cpufreqd(8), cpufreqd-set(1), cpufreqd-get(1)

like go read the friends, they're all part of the same little family ๐ŸŒˆ


๐ŸŒŸ AUTHOR ๐ŸŒŸ

Mattia Dongili <malattia@linux.it>

George Staikos <staikos@0wned.org>

absolute icons, both of them, no cap ๐Ÿ‘‘


okay that's the whole page bestie, you're officially a <hotpink>cpufreqd.conf</hotpink> girlie now ๐Ÿ’– go forth and tune your CPU, this is <cyan>CPUFREQD.CONF(5)</cyan> from <yellow>05 May 2005</yellow> and it ate, periodt โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from