CPU 依據省電模式有區分為 Processor Operating States (C-states) 與 Processor Performance States (P-states),兩者的差別是? ACPI 支援可以參考 https://benjr.tw/257
測試環境為 CentOS 7 x86_64 (虛擬機)
Processor Operating States (C-states)
CPU 在沒有使用時可以被停用或以比較低的效能模式來運行,依據不同的狀態可以區分成為幾種 C-state ,C-state 從 C0 (不閒置)開始,數字越高表示越省電(每一家的 CPU 定義 C-state 會稍微不同).
CPU 的 C-state 有下面幾種.
- C0 – Operating State
- C1 – Halt
- C1E – Enhanced Halt
- C2 – Stop Grant
- C2 – Stop Clock
- C2E – Extended Stop Grant
- C3 – Sleep
- C3 – Deep Sleep
- C3 – AltVID
- C4 – Deeper Sleep
- C4E/C5 -Enhanced Deeper Sleep
- C6 – Deep Power Down
- C7 – C6 + LLC may be flushed
- C8 – C7 + LLC must be flushed
要看 CPU 有支援哪一些 C-state 可以透過指令 cpupower.
[root@localhost ~]# cpupower Usage: cpupower [-d|--debug] [-c|--cpu cpulist ] <command> [<args>] Supported commands are: frequency-info frequency-set idle-info idle-set set info monitor help Not all commands can make use of the -c cpulist option. Use 'cpupower help <command>' for getting help for above commands.
參數 idle-info 可以看到有支援的 C-State
[root@localhost ~]# cpupower idle-info CPUidle driver: none CPUidle governor: menu analyzing CPU 0: CPU 0: No idle states
參數 monitor 可以檢視目前的 C-State 為哪一種.
POLL = C0
[root@localhost ~]# cpupower monitor -l Monitor "SandyBridge" (3 states) - Might overflow after 922000000 s C7 [C] -> Processor Core C7 PC2 [P] -> Processor Package C2 PC7 [P] -> Processor Package C7 [root@localhost ~]# cpupower monitor |SandyBridge PKG |CORE|CPU | C7 | PC2 | PC7 0| 0| 0| 0.00| 0.00| 0.00 2| 0| 1| 0.00| 0.00| 0.00
MPERF increasing with maxium (P0) frequency in C0
APERF increasing with current/actual frequency in C0
Processor Performance States (P-states)
P-States 就是指 CPU 依據目前狀態自行調整工作頻率,用以省電.
透過指令 cpupower ,參數 frequency-info 可以得知目前這個 CPU 支援的工作頻率.
[root@localhost ~]# cpupower frequency-info analyzing CPU 0: no or unknown cpufreq driver is active on this CPU CPUs which run at the same hardware frequency: Not Available CPUs which need to have their frequency coordinated by software: Not Available maximum transition latency: Cannot determine or is not supported. hardware limits: Not Available available cpufreq governors: Not Available Unable to determine current policy current CPU frequency: Unable to call hardware current CPU frequency: Unable to call to kernel boost state support: Supported: no Active: no
透過 turbostat – https://benjr.tw/99181 與 powertop – https://benjr.tw/99175 , 一樣可以觀察目前 CPU 狀態.
如果要設定 CPU 的工作頻率,可以透過指令 # cpupower frequency-set
沒有解決問題,試試搜尋本站其他內容