全部博文(389)
分类: LINUX
2013-11-17 21:42:43
sysbench测试工具安装和测试cpu
在redhat 5.5(2.6.18-194.el5)上安装 sysbench-0.4.12的时候,在make阶段报错
/bin/sh ../libtool --tag=CC --mode=link gcc -pthread -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/usr/local/mysql/lib/ -lmysqlclient_r -lrt -lm
../libtool: line 838: X--tag=CC: command not found
../libtool: line 871: libtool: ignoring unknown tag : command not found
../libtool: line 838: X--mode=link: command not found
../libtool: line 1004: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1005: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 2231: X-g: command not found
../libtool: line 2231: X-O2: command not found
../libtool: line 1951: X-L/usr/local/mysql/lib/: No such file or directory
../libtool: line 2400: Xsysbench: command not found
。。。。。。。。。。。。。。。。。。。。。。。
使用自带的autogent.sh就可以编译过去了
[root@localhost sysbench-0.4.12]# ./autogen.sh
[root@localhost sysbench-0.4.12]#
[root@localhost sysbench-0.4.12]# make
计算素数长度,cpu为4核,8线程,Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz
[root@localhost sysbench-0.4.12]# sysbench --test=cpu --cpu-max-prime=20000 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 20000
Test execution summary:
total time: 24.6386s
total number of events: 10000
total time taken by event execution: 24.6356
per-request statistics:
min: 2.38ms
avg: 2.46ms
max: 5.55ms
approx. 95 percentile: 2.49ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 24.6356/0.00
看看多核带来的性能提升,四个线程
[root@localhost sysbench-0.4.12]# sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 4
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 20000
Test execution summary:
total time: 6.8127s
total number of events: 10000
total time taken by event execution: 27.2394
per-request statistics:
min: 2.48ms
avg: 2.72ms
max: 364.02ms
approx. 95 percentile: 2.50ms
Threads fairness:
events (avg/stddev): 2500.0000/169.64
execution time (avg/stddev): 6.8098/0.00
[root@localhost sysbench-0.4.12]# sysbench --test=cpu --cpu-max-prime=20000 --num-threads=8 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 8
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 20000
Test execution summary:
total time: 6.5670s
total number of events: 10000
total time taken by event execution: 52.2949
per-request statistics:
min: 2.48ms
avg: 5.23ms
max: 275.50ms
approx. 95 percentile: 2.51ms
Threads fairness:
events (avg/stddev): 1250.0000/132.56
execution time (avg/stddev): 6.5369/0.04
可以看到多线程的性能提升并不明显。不要以线程来计算CPU能力哦,要使用核数来计算。宁要核不要线程!