Raspberry Pi 4 Model B をやっとセットアップできたので、とりあえず UnixBench でベンチマークをしてみた。

UnixBench のダウンロードから実行までの流れ

UnixBench をダウンロードして、

$ curl -O https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/byte-unixbench/UnixBench5.1.3.tgz

展開して、

$ tar zxvf UnixBench5.1.3.tgz

ディレクトリを移動して、

$ cd UnixBench/

実行する。

$ ./Run

UnixBench の実行結果

UnixBench の実行結果は下記の通り。とりあえず、 System Benchmarks Index Score だけを抜粋。( UnixBench の全部の結果は最後に貼り付ける。)

System Benchmarks Index Score                                         863.3

Raspberry Pi 4 Model B は CPU が結構、発熱するらしいので、 UnixBench 中に CPU の温度が上がるかを、下記のような簡単な Ruby スクリプトを実行しながら UnixBench を動かして確認してみた。(ちなみに、 Raspbian v10 には ruby は入っていなかったので、 rbenv で ruby 2.7.0 をインストールした。)

$ vi check_cpu_temp.rb
# ctl + c などで止めない限り動き続ける
while true do
  # get_throttled -> 主に CPU(?)が電力不足になっていないかの確認
  puts "throttled: #{`vcgencmd get_throttled`}"

  # measure_temp -> CPU の温度
  puts "measure_temp: #{`vcgencmd measure_temp`}"

  # measure_volts -> CPU の動作電圧 
  puts "measure_volts: #{`vcgencmd measure_volts`}"

  # measure_clock -> CPU の動作周波数 
  puts "measure_clock arm: #{`vcgencmd measure_clock arm`}"

  sleep 1
end

実行方法は下記の通り。

$ ruby check_cpu_temp.rb

結果は、 UnixBench を動かす前の、特に何もしていないときの CPU の温度が「57.0℃」で、一番温度が高くなるときが「83.0℃」だった。

ちなみに、ヒートシンクをつける前とつけたあとで CPU の温度に違いが出るか確認したけど、 CPU の最高温度はヒートシンクをつけてもつけなくても、変わらず「83.0℃」だった。

あと、ヒートシンクをつけてもつけなくても、 UnixBench の結果はほとんど変わらなかった。 System Benchmarks Index Score だけを見ると、ヒートシンクをつけない場合が 863.3 で、ヒートシンクをつけた場合が 849.9 だった。 (微妙につけない場合の方がスコアがいいけど、誤差の範囲だと思う。)

以下、 CPU 温度の計測の出力結果を参考に貼り付けておく。

CPU の温度が低いとき

throttled: throttled=0x20000
measure_temp: temp=57.0'C
measure_volts: volt=0.8595V
measure_clock arm: frequency(48)=600169920

CPU の温度が高いとき

throttled: throttled=0x20002
measure_temp: temp=83.0'C
measure_volts: volt=0.8595V
measure_clock arm: frequency(48)=1000265600

ヒートシンクをつけた状態で、 CPU の温度が高いとき

throttled: throttled=0x20002
measure_temp: temp=83.0'C
measure_volts: volt=0.8595V
measure_clock arm: frequency(48)=1000265600

UnixBench の実行結果(全部)

ヒートシンクをつけていない状態

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: raspberrypi: GNU/Linux
   OS: GNU/Linux -- 4.19.93-v7l+ -- #1290 SMP Fri Jan 10 16:45:11 GMT 2020
   Machine: armv7l (unknown)
   Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968")
   CPU 0: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   CPU 1: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   CPU 2: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   CPU 3: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   11:49:05 up 0 min,  1 user,  load average: 0.26, 0.06, 0.02; runlevel 5

------------------------------------------------------------------------
Benchmark Run: Wed Feb 05 2020 11:49:05 - 12:17:02
4 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       10124314.6 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2393.4 MWIPS (9.6 s, 7 samples)
Execl Throughput                                912.5 lps   (29.7 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        115490.9 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           31533.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        325053.8 KBps  (30.0 s, 2 samples)
Pipe Throughput                              160911.4 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  48996.4 lps   (10.0 s, 7 samples)
Process Creation                               1860.8 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2704.0 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    708.5 lpm   (60.0 s, 2 samples)
System Call Overhead                         492917.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   10124314.6    867.6
Double-Precision Whetstone                       55.0       2393.4    435.2
Execl Throughput                                 43.0        912.5    212.2
File Copy 1024 bufsize 2000 maxblocks          3960.0     115490.9    291.6
File Copy 256 bufsize 500 maxblocks            1655.0      31533.0    190.5
File Copy 4096 bufsize 8000 maxblocks          5800.0     325053.8    560.4
Pipe Throughput                               12440.0     160911.4    129.4
Pipe-based Context Switching                   4000.0      48996.4    122.5
Process Creation                                126.0       1860.8    147.7
Shell Scripts (1 concurrent)                     42.4       2704.0    637.7
Shell Scripts (8 concurrent)                      6.0        708.5   1180.8
System Call Overhead                          15000.0     492917.7    328.6
                                                                   ========
System Benchmarks Index Score                                         326.1

------------------------------------------------------------------------
Benchmark Run: Wed Feb 05 2020 12:17:02 - 12:45:05
4 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables       40271820.3 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     9603.7 MWIPS (9.6 s, 7 samples)
Execl Throughput                               2756.2 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        218366.8 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           59831.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        609570.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                              616968.5 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 197090.1 lps   (10.0 s, 7 samples)
Process Creation                               4722.9 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   5962.8 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    792.7 lpm   (60.2 s, 2 samples)
System Call Overhead                        1867015.5 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   40271820.3   3450.9
Double-Precision Whetstone                       55.0       9603.7   1746.1
Execl Throughput                                 43.0       2756.2    641.0
File Copy 1024 bufsize 2000 maxblocks          3960.0     218366.8    551.4
File Copy 256 bufsize 500 maxblocks            1655.0      59831.0    361.5
File Copy 4096 bufsize 8000 maxblocks          5800.0     609570.0   1051.0
Pipe Throughput                               12440.0     616968.5    496.0
Pipe-based Context Switching                   4000.0     197090.1    492.7
Process Creation                                126.0       4722.9    374.8
Shell Scripts (1 concurrent)                     42.4       5962.8   1406.3
Shell Scripts (8 concurrent)                      6.0        792.7   1321.1
System Call Overhead                          15000.0    1867015.5   1244.7
                                                                   ========
System Benchmarks Index Score                                         863.3

ヒートシンクをつけた状態

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: raspberrypi: GNU/Linux
   OS: GNU/Linux -- 4.19.93-v7l+ -- #1290 SMP Fri Jan 10 16:45:11 GMT 2020
   Machine: armv7l (unknown)
   Language: en_US.utf8 (charmap="ANSI_X3.4-1968", collate="ANSI_X3.4-1968")
   CPU 0: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   CPU 1: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   CPU 2: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   CPU 3: ARMv7 Processor rev 3 (v7l) (0.0 bogomips)
          
   11:50:43 up 14 min,  2 users,  load average: 0.00, 0.00, 0.00; runlevel 5

------------------------------------------------------------------------
Benchmark Run: Mon Feb 03 2020 11:50:43 - 12:18:40
4 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       10207174.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     2393.4 MWIPS (9.6 s, 7 samples)
Execl Throughput                                912.8 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        114212.8 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           31633.8 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        323503.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                              159788.2 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  45280.8 lps   (10.0 s, 7 samples)
Process Creation                               1865.6 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2671.1 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    749.7 lpm   (60.0 s, 2 samples)
System Call Overhead                         493415.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   10207174.9    874.7
Double-Precision Whetstone                       55.0       2393.4    435.2
Execl Throughput                                 43.0        912.8    212.3
File Copy 1024 bufsize 2000 maxblocks          3960.0     114212.8    288.4
File Copy 256 bufsize 500 maxblocks            1655.0      31633.8    191.1
File Copy 4096 bufsize 8000 maxblocks          5800.0     323503.6    557.8
Pipe Throughput                               12440.0     159788.2    128.4
Pipe-based Context Switching                   4000.0      45280.8    113.2
Process Creation                                126.0       1865.6    148.1
Shell Scripts (1 concurrent)                     42.4       2671.1    630.0
Shell Scripts (8 concurrent)                      6.0        749.7   1249.5
System Call Overhead                          15000.0     493415.8    328.9
                                                                   ========
System Benchmarks Index Score                                         324.9

------------------------------------------------------------------------
Benchmark Run: Mon Feb 03 2020 12:18:40 - 12:46:45
4 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables       40809123.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     9579.5 MWIPS (9.7 s, 7 samples)
Execl Throughput                               2734.0 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        218005.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           59396.4 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        596932.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                              612995.6 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 185175.4 lps   (10.0 s, 7 samples)
Process Creation                               4742.7 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   5824.8 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    738.0 lpm   (60.2 s, 2 samples)
System Call Overhead                        1864851.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   40809123.9   3496.9
Double-Precision Whetstone                       55.0       9579.5   1741.7
Execl Throughput                                 43.0       2734.0    635.8
File Copy 1024 bufsize 2000 maxblocks          3960.0     218005.5    550.5
File Copy 256 bufsize 500 maxblocks            1655.0      59396.4    358.9
File Copy 4096 bufsize 8000 maxblocks          5800.0     596932.0   1029.2
Pipe Throughput                               12440.0     612995.6    492.8
Pipe-based Context Switching                   4000.0     185175.4    462.9
Process Creation                                126.0       4742.7    376.4
Shell Scripts (1 concurrent)                     42.4       5824.8   1373.8
Shell Scripts (8 concurrent)                      6.0        738.0   1229.9
System Call Overhead                          15000.0    1864851.8   1243.2
                                                                   ========
System Benchmarks Index Score                                         849.9

以上、 Raspberry Pi 4 Model B で UnixBench でベンチマークをしてみた話でした。