对单个核心进行基准测试?

对单个核心进行基准测试?

如何对单个内核进行基准测试?我想看看它们是否都以相同的速度运行。我有点困惑我的 Cortex A53 设备是否具有大小或者不是,我在网上看到了相互矛盾的信息,所以我想自己测试一下。

答案1

(我假设你有一个具有多个核心的 CPU,每个核心都有多个线程)

您可以使用名为 sysbench 的工具。

使用安装sudo apt-get install sysbench

默认情况下,这是测试单个线程。

sysbench --test=cpu run

或者

sysbench --test=threads --num-threads=1 --thread-locks=1 run

但我似乎不知道如何将其锁定到特定线程。有人知道吗?

您可以通过阅读手册页自己尝试一下:

man sysbench

答案2

我认为@doug-smythies 的评论回答了这个问题。

然而,我意识到只要看看所有 CPU 是否都在同一水平上运行,我就可以这样做:

1 个 CPU

root@amlogic:~# stress-ng --cpu 1 --cpu-method matrixprod  --metrics-brief --perf -t 10
stress-ng: info:  [5921] dispatching hogs: 1 cpu
stress-ng: info:  [5921] cache allocate: using built-in defaults as unable to determine cache details
stress-ng: info:  [5921] cache allocate: default cache size: 2048K
stress-ng: info:  [5921] successful run completed in 10.94s
stress-ng: info:  [5921] stressor      bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
stress-ng: info:  [5921]                          (secs)    (secs)    (secs)   (real time) (usr+sys time)
stress-ng: info:  [5921] cpu                 21     10.93     10.02      0.02         1.92         2.09
stress-ng: info:  [5921] cpu:
stress-ng: info:  [5921]             14,108,856,703 CPU Cycles                     1.29 B/sec
stress-ng: info:  [5921]             13,710,373,770 Instructions                   1.25 B/sec (0.972 instr. per cycle)
stress-ng: info:  [5921]                927,478,656 Cache References              84.76 M/sec
stress-ng: info:  [5921]                 43,400,148 Cache Misses                   3.97 M/sec ( 4.68%)
stress-ng: info:  [5921]                 36,225,340 Branch Misses                  3.31 M/sec ( 0.00%)

4 CPU

root@amlogic:~# stress-ng --cpu 4 --cpu-method matrixprod  --metrics-brief --perf -t 10
stress-ng: info:  [5867] dispatching hogs: 4 cpu
stress-ng: info:  [5867] cache allocate: using built-in defaults as unable to determine cache details
stress-ng: info:  [5867] cache allocate: default cache size: 2048K
stress-ng: info:  [5867] successful run completed in 11.56s
stress-ng: info:  [5867] stressor      bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
stress-ng: info:  [5867]                          (secs)    (secs)    (secs)   (real time) (usr+sys time)
stress-ng: info:  [5867] cpu                 51     10.80     41.05      0.47         4.72         1.23
stress-ng: info:  [5867] cpu:
stress-ng: info:  [5867]             59,953,532,588 CPU Cycles                     5.19 B/sec
stress-ng: info:  [5867]             31,357,210,848 Instructions                   2.71 B/sec (0.523 instr. per cycle)
stress-ng: info:  [5867]              2,127,678,244 Cache References               0.18 B/sec
stress-ng: info:  [5867]                101,073,952 Cache Misses                   8.75 M/sec ( 4.75%)
stress-ng: info:  [5867]                 82,805,524 Branch Misses                  7.17 M/sec ( 0.00%)

8 CPU

root@amlogic:~# stress-ng --cpu 8 --cpu-method matrixprod  --metrics-brief --perf -t 10
stress-ng: info:  [5892] dispatching hogs: 8 cpu
stress-ng: info:  [5892] cache allocate: using built-in defaults as unable to determine cache details
stress-ng: info:  [5892] cache allocate: default cache size: 2048K
stress-ng: info:  [5892] successful run completed in 11.53s
stress-ng: info:  [5892] stressor      bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
stress-ng: info:  [5892]                          (secs)    (secs)    (secs)   (real time) (usr+sys time)
stress-ng: info:  [5892] cpu                126     10.50     81.49      0.58        12.00         1.54
stress-ng: info:  [5892] cpu:
stress-ng: info:  [5892]            118,145,351,216 CPU Cycles                    10.24 B/sec
stress-ng: info:  [5892]             94,066,812,704 Instructions                   8.16 B/sec (0.796 instr. per cycle)
stress-ng: info:  [5892]              6,383,299,240 Cache References               0.55 B/sec
stress-ng: info:  [5892]                304,757,784 Cache Misses                  26.43 M/sec ( 4.77%)
stress-ng: info:  [5892]                248,569,352 Branch Misses                 21.55 M/sec ( 0.00%)

相关内容