How can I benchmark individual cores? I want to see if they are all operating at the same speed. I'm a bit confused if my Cortex A53 device has big.LITTLE or not, I'm reading conflicting information on the internet, so I want to test it myself.
2 Answers
(I am assuming you have a cpu with multiple cores which each has multiple threads)
You can use a tool named sysbench.
Install it with sudo apt-get install sysbench
By default this is testing a single thread.
sysbench --test=cpu run
or
sysbench --test=threads --num-threads=1 --thread-locks=1 run
But I can not seem to figure out how to lock it to a specific thread. Someone?
You can try it yourself by reading the man pages:
man sysbench
-
-
Ok. But still this leaves the question: how to lock it to one core. Alternatively you could disable all the other cores in the bios. And check during sysbench the system monitor gui to be sure.– urbenJul 14, 2017 at 19:41
I think this comment by @doug-smythies answers the question.
However, I realized just to see if all CPUs were performing at the same level - I could do this:
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%)
-
I am glad you figured it out. But can you explain how you see that all cpu's are performing the same? Just by plain simply looking at how long the usr time for 1cpu vs 4cpu vs 8 cpu (resp. ~10s vs ~ 40s vs ~80s) took?– urbenJul 17, 2017 at 23:59
-
Is it faulty logic? I assumed if the cycles are multiples of the cycles of 1 core. The 4 and 8 results have about 4 and 8 times the cycles, that it couldn't possibly be a big . little configuration, since little cores should be at a lower frequency?– ycompJul 18, 2017 at 2:21
taskset
to limit execution to one CPU or two CPUs on the same core, and then whatever stress or benchmark program you want.