First, make sure that your computer supports and enables the CPU dynamic frequency modulation function. The method is as follows: (I use a DELL machine) (1) enter the BIOS after the boot, find the performance option. In the speedset sub-option, you will see whether your CPU dynamic frequency modulation is enabled. If not, enable it. (2) Check whether your kernel has a module that supports dynamic frequency modulation: $ cdsys/devices/system/cpu/cpufreq. If the folder is empty
First, make sure that your computer supports and enables the CPU dynamic frequency modulation function. The method is as follows:
(I am using a DELL host)
(1) enter the BIOS after the boot, and find the performance option. In the speedset sub-option, you will see whether your CPU dynamic frequency modulation is enabled. If not, enable it.
(2) Check whether your kernel has a module that supports dynamic frequency modulation:
$ Cd sys/devices/system/cpu/cpufreq
If the folder is empty, it indicates that you have not installed the corresponding module. Otherwise, the ondemand folder should exist.
If no installation is available, you need to manually install it:
$ Sudo apt-get install cpufrequtils
(3) restart your computer and check whether the ondemand folder exists in the/sys/devices/system/cpu/cpufreq folder.
If you are not sure, you can run the following systemtap script:
- Global times
- # Probe kernel. function ("do_dbs_timer @ drivers/cpufreq/cpufreq_conservative.c "){
- Probe kernel. function ("Do_dbs_timer"){
- Times ++
- }
- Probe timer. ms (1000 ){
- If(Times ){
- Printf ("% S % d \ n", Execname (), times)
- }
- }
This script is used to count how many times the do_dbs_timer function is entered. This function is responsible for CPU frequency modulation and runs this script.
$ Sudo stap-v cpuload. stp
The following running result is displayed:
- Sun @ sun-pc: dbs_timer $ clear
- Sun @ sun-pc: dbs_timer $ sudo stap-v cpuload. stp
- Pass 1: parsed user script and 76 library script (s)Using24216 virt/13692res/2276shr kb, in 130usr/20sys/146 real ms.
- Pass 2: analyzed script: 3 probe (s), 1 function (s), 3 embed (s), 1 global (s)Using221608 virt/33032res/3366shr kb, in 610usr/170sys/783 real ms.
- Pass 3:UsingCached/home/sun/. systemtap/cache/70/stap_70945be0878032891000488a733f9b86_2071.c
- Pass 4:UsingCached/home/sun/. systemtap/cache/70/stap_70945be0878032891000488a733f9b86_2071.ko
- Pass 5: starting run.
- Swapper/1 136
- Swapper/1 272
- Swapper/1 409
- Swapper/1 544
- Swapper/1 681
- Swapper/1 816
- Swapper/1 950
- Swapper/1 1095
- Swapper/1 1236
- X.org 1397
- Swapper/1 1543
- Swapper/1 1679
- Swapper/1 1815
- Swapper/1 1951
- Swapper/1 2087