歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 讓你的Ubuntu系統支持CPU動態調頻

讓你的Ubuntu系統支持CPU動態調頻

日期:2017/2/28 15:45:08   编辑:Linux教程

首先,你得確保你的電腦是支持並且打開了CPU動態調頻功能的,方法如下:

(我用的是的DELL機)

(1)開機後進入BIOS,找到performance選項,在speedset子選項中你會看到你的CPU動態調頻是否開啟了,如果未開啟,要開啟。

(2)查看你的內核是否安裝了支持動態調頻的模塊:

$cd sys/devices/system/cpu/cpufreq

如果這個文件夾是空的,則說明你並沒有安裝相應的模塊,否則,該文件夾下應該有ondemand文件夾。

如果沒有安裝,則需要你手動安裝了:

$sudo apt-get install cpufrequtils

(3)重啟你的電腦,查看/sys/devices/system/cpu/cpufreq文件夾是否有了ondemand文件夾。

如果你還是不確定,則可以運行如下的一個systemtap腳本:

  1. global times
  2. #probe kernel.function("do_dbs_timer@drivers/cpufreq/cpufreq_conservative.c") {
  3. probe kernel.function("do_dbs_timer") {
  4. times++
  5. }
  6. probe timer.ms(1000) {
  7. if(times) {
  8. printf("%s %d\n", execname(), times)
  9. }
  10. }

這個腳本用來統計進入do_dbs_timer函數多少次,這個函數是負責CPU調頻的,執行這個腳本

$sudo stap -v cpuload.stp

會有如下的運行 結果:

  1. sun@sun-pc:dbs_timer$ clear
  2. sun@sun-pc:dbs_timer$ sudo stap -v cpuload.stp
  3. Pass 1: parsed user script and 76 library script(s) using 24216virt/13692res/2276shr kb, in 130usr/20sys/146real ms.
  4. Pass 2: analyzed script: 3 probe(s), 1 function(s), 3 embed(s), 1 global(s) using 221608virt/33032res/3264shr kb, in 610usr/170sys/783real ms.
  5. Pass 3: using cached /home/sun/.systemtap/cache/70/stap_70945be0878032891000488a733f9b86_2071.c
  6. Pass 4: using cached /home/sun/.systemtap/cache/70/stap_70945be0878032891000488a733f9b86_2071.ko
  7. Pass 5: starting run.
  8. swapper/1 136
  9. swapper/1 272
  10. swapper/1 409
  11. swapper/1 544
  12. swapper/1 681
  13. swapper/1 816
  14. swapper/1 950
  15. swapper/1 1095
  16. swapper/1 1236
  17. Xorg 1397
  18. swapper/1 1543
  19. swapper/1 1679
  20. swapper/1 1815
  21. swapper/1 1951
  22. swapper/1 2087
Copyright © Linux教程網 All Rights Reserved