37

I want to get the current CPUPower governor.

When I type cpupower frequency-info I get a lot of information. I just want to get the governor, just like "ondemand" with no more information, to use its value in a program.

2 Answers 2

52

The current governor can be obtained as follows:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 

Note that cpu* will give you the scaling governor of all your cores and not just e.g. cpu0.

This solution might be system dependent, though. I'm not 100% sure this is portable.

3
  • 1
    Working in Fedora 23! With cpupower frequency-info --governors you can see the governors and with cpupower frequency-info --governor <gov> you can set it. Commented May 23, 2016 at 18:21
  • Wow! That is so user-friendly that it boggles the mind! Commented Oct 12, 2020 at 13:19
  • still works in fedora 40. to change to performance mode (if supported)... dnf install kernel-tools ... cpupower frequency-set --governor performance . Commented Sep 10, 2024 at 13:07
6

In the latest Fedora release (26 alpha) on my Ryzen 7 system, I did this:

Fedora 26 alpha didn't have cpupower installed - so get it:

dnf install kernel-tools 

This installs /etc/sysconfig/cpupower which should set performance level by default (edit the first line if you want a different level):

CPUPOWER_START_OPTS="frequency-set -g performance" CPUPOWER_STOP_OPTS="frequency-set -g ondemand" 

Now the critical bit - enable and start the cpupower service

systemctl enable --now cpupower 

Confirm that performance level is set:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 

Reboot and repeat that cat command to confirm still performance

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.