查看CPU核数的方法
查看物理cpu个数
grep "physical id" /proc/cpuinfo | sort -u | wc -l
查看核心数量
grep "core id" /proc/cpuinfo | sort -u | wc -l
查看线程数量
grep "processor" /proc/cpuinfo | sort -u | wc -l
在sysbench的测试中,--num-threads取值为"线程数量"即可,再大的值没有什么意义,对测试结果也没有什么影响。
3.2 线程(thread)测试
测试线程调度器的性能。对于高负载情况下测试线程调度器的行为非常有用。
sysbench --test=threads --num-threads=64 run
下面是输出结果:
Number of threads: 64 Doing thread subsystem performance test Thread yields per test: 1000 Locks used: 8 Threads started! Done. Test execution summary: total time: 4.5845s total number of events: 10000 total time taken by event execution: 291.9995 per-request statistics: min: 0.76ms avg: 29.20ms max: 152.71ms approx. 95 percentile: 71.11ms Threads fairness: events (avg/stddev): 156.2500/5.81 execution time (avg/stddev): 4.5625/0.02 |
Number of threads: 64 Doing thread subsystem performance test Thread yields per test: 1000 Locks used: 8 Threads started! Done. Test execution summary: total time: 2.4829s total number of events: 10000 total time taken by event execution: 157.3468 per-request statistics: min: 0.21ms avg: 15.73ms max: 166.69ms approx. 95 percentile: 119.14ms Threads fairness: events (avg/stddev): 156.2500/22.25 execution time (avg/stddev): 2.4585/0.02 |