Linux command – powertop

Loading

除了 turbostat – https://benjr.tw/99181 外還有 cpupower – https://benjr.tw/99146 可以來檢視 CPU 狀態外,還可以透過 powertop .

測試環境為 CentOS 7 x86_64 (虛擬機)

[root@localhost ~]# yum install powertop
[root@localhost ~]# powertop

可以使用 Tab 與 Shift+Tab 鍵來瀏覽分頁 (Overview , Idle Stats , Frequency Stats , Device Stats , Tunables) .

  • Overview
    顯示系統運行的 process ,Timer , Interrupt , kWork 與 Device 的個別電源使用量.
  • Idle Stats
    就是指 CPU 的 C-States ,CPU 在沒有使用時可以被停用或以比較低的效能模式來運行,依據不同的狀態可以區分成為幾種 C-state ,C-state 從 C0 (不閒置)開始,數字越高表示越省電(每一家的 CPU 定義 C-state 會稍微不同).

    CPU 的 C-state 有下面幾種.

    1. C0 – Operating State
    2. C1 – Halt
    3. C1E – Enhanced Halt
    4. C2 – Stop Grant
    5. C2 – Stop Clock
    6. C2E – Extended Stop Grant
    7. C3 – Sleep
    8. C3 – Deep Sleep
    9. C3 – AltVID
    10. C4 – Deeper Sleep
    11. C4E/C5 -Enhanced Deeper Sleep
    12. C6 – Deep Power Down
    13. C7 – C6 + LLC may be flushed
    14. C8 – C7 + LLC must be flushed
  • Frequency Stats
    就是指 CPU 的 P-States ,CPU 依據目前狀態自行調整工作頻率,用以省電.
  • Device Stats
  • Tunables

如果要精準的估算出系統活動時所消耗的功耗,可以使用參數
-c, –calibrate
Runs powertop in calibration mode. When running on battery, powertop can track power consumption as well as system activity. When there are enough measurements, powertop can start to report power estimates. One can get more accurate estimates by using this option to enable a calibration cycle. This will cycle through various display levels and USB device activities and workloads.

[root@localhost ~]# powertop --calibrate
Loaded 0 prior measurements
Starting PowerTOP power estimate calibration 
Calibrating idle
Calibrating: disk usage 
Calibrating backlight
Calibrating idle
Calibrating: CPU usage on 1 threads
Calibrating: CPU usage on 4 threads
Calibrating: CPU wakeup power consumption
Calibrating: CPU wakeup power consumption
Calibrating: CPU wakeup power consumption
Calibrating USB devices
.... device /sys/bus/usb/devices/1-1/power/control 
.... device /sys/bus/usb/devices/2-1/power/control 
.... device /sys/bus/usb/devices/2-2/power/control 
.... device /sys/bus/usb/devices/usb1/power/control 
.... device /sys/bus/usb/devices/usb2/power/control 
.... device /sys/bus/usb/devices/2-2.1/power/control 
Calibrating radio devices
.... device /sys/class/rfkill/rfkill0/soft 
.... device /sys/class/rfkill/rfkill0/soft 
沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料