安装:
yum install sysbench
运行:
#直接运行
sysbench cpu run
# 素数上限2万,默认10秒,2个线程
sysbench cpu –cpu-max-prime=20000 –threads=2 run
返回:
sysbench 1.0.9 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 2 // 指定线程数为2
Initializing random number generator from current time
Prime numbers limit: 20000 // 每个线程产生的素数上限均为2万个
Initializing worker threads…
Threads started!
CPU speed:
events per second: 650.74 // 所有线程每秒完成了650.74次event
General statistics:
total time: 10.0017s // 共耗时10秒
total number of events: 6510 // 10秒内所有线程一共完成了6510次event
Latency (ms):
min: 3.03 // 完成1次event的最少耗时3.03秒
avg: 3.07 // 所有event的平均耗时3.07毫秒
max: 3.27 // 完成1次event的最多耗时3.27毫秒
95th percentile: 3.13 // 95%次event在3.13秒毫秒内完成
sum: 19999.91 // 每个线程耗时10秒,2个线程叠加耗时就是20秒
Threads fairness:
events (avg/stddev): 3255.0000/44.00 // 平均每个线程完成3255次event,标准差为44
execution time (avg/stddev): 10.0000/0.00 // 每个线程平均耗时10秒,标准差为0