ラズパイのCPUクロック、温度測定

〇CPUクロック測定
 CPUのクロック測定や設定が出来るcpufrequtilsをインストールし、その内クロック測定するcpufreq-infoを使うことでクロック周波数の測定が出来る。
pi@raspi4:~ $ sudo apt-get install cpufrequtils

pi@raspi4:~ $ 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: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 1.50 GHz
  available frequency steps: 600 MHz, 1.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 600 MHz and 1.50 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 600 MHz.
  cpufreq stats: 600 MHz:97.02%, 1.50 GHz:2.98%  (30)
analyzing CPU 1:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 1.50 GHz
  available frequency steps: 600 MHz, 1.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 600 MHz and 1.50 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 600 MHz.
  cpufreq stats: 600 MHz:97.02%, 1.50 GHz:2.98%  (30)
analyzing CPU 2:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 1.50 GHz
  available frequency steps: 600 MHz, 1.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 600 MHz and 1.50 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 600 MHz.
  cpufreq stats: 600 MHz:97.02%, 1.50 GHz:2.98%  (30)
analyzing CPU 3:
  driver: BCM2835 CPUFreq
  CPUs which run at the same hardware frequency: 0 1 2 3
  CPUs which need to have their frequency coordinated by software: 0 1 2 3
  maximum transition latency: 355 us.
  hardware limits: 600 MHz - 1.50 GHz
  available frequency steps: 600 MHz, 1.50 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance, schedutil
  current policy: frequency should be within 600 MHz and 1.50 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 600 MHz.
  cpufreq stats: 600 MHz:97.02%, 1.50 GHz:2.98%  (30)
driver : BCM2835 CPUFreq

これはCPUFreqが使用しているドライバーの名称です。ラズベリーパイはBroadcom社のBCM2835プロセッサを使っているためこのドライバになります。

CPUs which run at the same hardware frequency: 0 1 2 3

ラズベリーパイはクアッドコアですので、0,1,2,3と4つの同じコアがそれぞれ0から3までの番号が振りあてられています。

CPUs which need to have their frequency coordinated by software: 0 1 2 3

ソフトウェアで管理された周波数を持ったCPUが0から4つあるという事です。

maximum transition latency: 355us

CPUが処理速度を変化させるときにかかる時間の最大値です。ここでは355マイクロ秒です。

hardware limits : 600MHz ? 1.50GHz

ラズベリーパイのCPUがサポートするクロック周波数の最小値と最大値の範囲です。

available frequency steps: 600MHz, 1.50GHz

設定できる周波数のステップになります。この2種類の周波数で動作します。

available cpufreq governors : conservative, ondemand, userspace, powersave,performance, schedutil

CPUFreqガバナーといわれるいわゆるクロック周波数などをコントロールするための設定値にはこのようなものを使っているという表示です。

current policy: frequency should be within 600 MHz and 1.50gHz. The governor ‘ondemand” may decide which speed to use within this range

ここではソフトウェア的にコントロールできる周波数の範囲と、そのスピードはondemandという種類のCPUFreqガバナーを使っているという事を表しています。

current CPU frequency is 600 MHz.

このコマンドを実行した現在のクロック周波数です。600MHzで動作しているという事です。

cpufreq status:600 MHz:97.02%, 1.50 GHz:2.98% (30)

今のところどれくらいの割合でCPUが動作しているかと言うのがわかります。600MHzでの動作が全体の97%程度を占めていることがわかります。


〇CPU温度

 現状はファンを3.5Vの低速で回しているが、温度の監視は重要である。

pi@raspi4:~ $ vcgencmd measure_temp
temp=29.0'C

で測定できる。