2

Is there a way to delete the old stats for a fresh start? I have set max CPU-speed to 950 MHz in file cpufrequtils. My issue is that this limitation is not in action when booting up, during which cpufrequtils is collecting data as can be seen from output: cpufreq stats: 1.20 GHz:27,27%. So after boot i would like to reset the stats to zero.

peter@peter-HP-Compaq-2510p:~$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 800 MHz - 1.20 GHz
  available frequency steps: 1.20 GHz, 1.07 GHz, 933 MHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 800 MHz and 950 MHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 933 MHz.
  cpufreq stats: 1.20 GHz:27,27%, 1.07 GHz:0,48%, 933 MHz:47,91%, 800   MHz:24,34%  (1449)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 10.0 us.
  hardware limits: 800 MHz - 1.20 GHz
  available frequency steps: 1.20 GHz, 1.07 GHz, 933 MHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace,  powersave, performance
  current policy: frequency should be within 800 MHz and 950 MHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 933 MHz.
  cpufreq stats: 1.20 GHz:30,29%, 1.07 GHz:0,29%, 933 MHz:51,91%, 800  MHz:17,52%  (763)
peter@peter-HP-Compaq-2510p:~$ 

![enter image description here

Edit: Trying to follow advice given in answer, but there is no reset in folder:

peter@peter-HP-Compaq-2510p:~$ cd /sys/devices/system/cpu/cpu0/cpufreq/stats
peter@peter-HP-Compaq-2510p:/sys/devices/system/cpu/cpu0/cpufreq/stats$ ls -l
total 0
-r--r--r-- 1 root root 4096 apr 28 09:46 time_in_state
-r--r--r-- 1 root root 4096 apr 28 09:46 total_trans
-r--r--r-- 1 root root 4096 apr 28 09:46 trans_table
peter@peter-HP-Compaq-2510p:/sys/devices/system/cpu/cpu0/cpufreq/stats$ dir
time_in_state  total_trans  trans_table
peter@peter-HP-Compaq-2510p:/sys/devices/system/cpu/cpu0/cpufreq/stats$ 
3

From: CPU frequency and voltage scaling statistics in the Linux(TM) kernel

<mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
total 0
drwxr-xr-x  2 root root    0 May 14 16:06 .
drwxr-xr-x  3 root root    0 May 14 15:58 ..
--w-------  1 root root 4096 May 14 16:06 reset
-r--r--r--  1 root root 4096 May 14 16:06 time_in_state
-r--r--r--  1 root root 4096 May 14 16:06 total_trans
-r--r--r--  1 root root 4096 May 14 16:06 trans_table

reset

Write-only attribute that can be used to reset the stat counters. This can be useful for evaluating system behaviour under different governors without the need for a reboot.

This should reset all the stats:

echo '1' | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/stats/reset

From: How to use cpufrequtils

cpufreq-set

Allows setting

-d  minimum frequency,
-u  maximum frequency,
-f  specific frequency (userspace governor must be set first) and
-g  governor on a
-c  specific CPU.

cpufreq-set needs root privileges in order to work.

Look for this in your setup:

sudo cpufreq-set -u 950MGhz

and remove it. Or add this to your setup:

sudo cpufreq-set -u 1.20Ghz

From: HowTo CpuFrequencyScaling

GOVERNOR variable from /etc/default/cpufrequtils not taking effect

So, you configured the GOVERNOR variable in /etc/default/cpufrequtils and after reboot you notice by running cpufreq-info that the active governor is still "ondemand".

This may happen if you have laptop-mode-tools installed. laptop-mode configures the active governor via the following variables: BATT_CPU_GOVERNOR, LM_AC_CPU_GOVERNOR, NOLM_AC_CPU_GOVERNOR. You can override them to your liking in /etc/laptop-mode/laptop-mode.conf:

BATT_CPU_GOVERNOR=powersave
LM_AC_CPU_GOVERNOR=conservative
NOLM_AC_CPU_GOVERNOR=ondemand

From: Arch Linux CPU frequency scaling

Setting maximum and minimum frequencies

In rare cases, it may be necessary to manually set maximum and minimum frequencies.

To set the maximum clock frequency (clock_freq is a clock frequency with units: GHz, MHz):

sudo cpupower frequency-set -u clock_freq

To set the minimum clock frequency:

sudo cpupower frequency-set -d clock_freq

To set the CPU to run at a specified frequency:

sudo cpupower frequency-set -f clock_freq
  • Thanks. Directly after booting up, the percentage for 1.20 GHz is the highest. Then, for each cpufreq-info, it is sinking. That's why I would like to get rid of stats invoving data from startup, so I can better see how the max of 950 MHz works . Changed to userspace, but no obvious difference. – PeterEriksson Apr 27 at 22:42
  • 1
    @PeterEriksson Almost all Ubuntu based laptops start at maximum frequency during the first minute and then speed governors are engaged. See: askubuntu.com/questions/1021748/… – WinEunuuchs2Unix Apr 27 at 22:48
  • Seems like cpufreq collects stats during boot, and that the set max CPU-speed is not yet activated. – PeterEriksson Apr 27 at 22:53
  • The max is deliberatly set to 950 MHz. Fan not working. – PeterEriksson Apr 27 at 22:59
  • @PeterEriksson I misunderstood the question at first. Check the first part of the answer now. Additionally a new fan can be as little as $20. – WinEunuuchs2Unix Apr 28 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.