Follow Excellent, Success will Chase you

0%

Linux性能测试工具---sysbench

Linux环境下的性能测试:

sysbench

1
sudo apt install sysbench

源码:

1
git clone https://github.com/akopytov/sysbench.git

CPU测试

CPU的性能测试通常有:

  1. 质数计算;
  2. 圆周率计算.

cpu测试主要是进行质数加法运算, 找指定范围内最大质数时间越短,性能越好

1
sysbench cpu run
1
sysbench cpu --cpu-max-prime=100000 --num-threads=`grep "processor" /proc/cpuinfo | sort -u | wc -l` run
1
mpstat -P ALL 1

间隔1s,打印当前所有CPU核的使用情况

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$sysbench cpu run
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1 #指定线程数为1
Initializing random number generator from current time


Prime numbers limit: 10000 #每个线程产生的素数上限均为10000个

Initializing worker threads...

Threads started!

CPU speed:
events per second: 1181.65 #所有线程每秒完成的event次数

General statistics:
total time: 10.0007s #总消耗时间
total number of events: 11819 #event次数

Latency (ms):
min: 0.78
avg: 0.85
max: 4.57
95th percentile: 0.99
sum: 9996.65

Threads fairness:
events (avg/stddev): 11819.0000/0.00
execution time (avg/stddev): 9.9967/0.00

圆周率测试

1
time echo "scale=5000;4*a(1)"|bc -l -q
-------------本文结束感谢您的阅读-------------
  • 本文作者: Winddoing
  • 本文链接: https://winddoing.github.io/post/37666.html
  • 作者声明: 本博文为个人笔记, 由于个人能力有限,难免出现错误,欢迎大家批评指正。
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!