码迷,mamicode.com
首页 > 其他好文 > 详细

CPU性能压测

时间:2017-09-20 16:24:50      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:cpu性能测试

有时候为了项目需求需要对CPU性能做一个压力测试,这里提供一种方法。通过对圆周率位数进行计算进而确定CPU性能,根据定义预计执行时间,具体操作如下:

time echo "scale=1000; 4*a(1)" | bc -l -q

通过该命令运行,如果3、4分钟没有出现结果,基本问题就可以定位在CPU上,这里我通过自己的测试机,得出如下数字:

技术分享

"scale=1000; 4*a(1)"这个表达式具体什么意思我没看明白,但是大概意思应该是将该表达式的交给计算器bc来处理,然后将处理结果的时间输出到屏幕

[root@node01 ~]# bc -h
usage: bc [options] [file ...]
  -h  --help         print this usage and exit
  -i  --interactive  force interactive mode
  -l  --mathlib      use the predefined math routines
  -q  --quiet        don‘t print initial banner
  -s  --standard     non-standard bc constructs are errors
  -w  --warn         warn about non-standard bc constructs
  -v  --version      print version information and exit
[root@node01 ~]#

CPU性能压测

标签:cpu性能测试

原文地址:http://ucode.blog.51cto.com/10837891/1967029

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!