ycomp Asked: 2017-07-15 07:58:26 +0800 CST2017-07-15 07:58:26 +0800 CST 2017-07-15 07:58:26 +0800 CST 对单个内核进行基准测试?[复制] 772 如何对单个内核进行基准测试?我想看看它们是否都以相同的速度运行。如果我的 Cortex A53 设备有big.LITTLE与否,我有点困惑,我在互联网上阅读相互矛盾的信息,所以我想自己测试一下。 cpu 2 个回答 Voted urben 2017-07-15T09:01:26+08:002017-07-15T09:01:26+08:00 (我假设您有一个具有多个内核的 CPU,每个内核都有多个线程) 您可以使用名为 sysbench 的工具。 安装它sudo apt-get install sysbench 默认情况下,这是测试单个线程。 sysbench --test=cpu run 或者 sysbench --test=threads --num-threads=1 --thread-locks=1 run 但我似乎无法弄清楚如何将其锁定到特定线程。有人吗? 您可以通过阅读手册页自己尝试: man sysbench Best Answer ycomp 2017-07-15T21:01:32+08:002017-07-15T21:01:32+08:00 我认为@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个中央处理器 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%)
(我假设您有一个具有多个内核的 CPU,每个内核都有多个线程)
您可以使用名为 sysbench 的工具。
安装它
sudo apt-get install sysbench
默认情况下,这是测试单个线程。
或者
但我似乎无法弄清楚如何将其锁定到特定线程。有人吗?
您可以通过阅读手册页自己尝试:
我认为@doug-smythies 的评论回答了这个问题。
但是,我意识到只是看看所有 CPU 是否都在同一级别上执行 - 我可以这样做:
1 个 CPU
4 CPU
8个中央处理器