为在Linux上运行的应用程序对CPU和文件IO进行基准测试

时间:2014-04-23 05:38:37

标签: linux benchmarking

我编写了两个在Linux上运行的程序,每个程序使用不同的算法,我想找到一种方法(最好使用基准测试软件)来比较这两个程序之间的CPU使用率和IO操作。

有这样的事吗?如果是,我在哪里可以找到它们。感谢。

2 个答案:

答案 0 :(得分:0)

您可以尝试hardinfo

如果在运行您的应用程序时测量它可以解决您的目的,那么测量系统的性能会有不同的tools

您还可以查看this thread

答案 1 :(得分:0)

您可以尝试使用vmstat命令:

vmstat 2 20 > vmstat.txt
20 samples of 2 seconds

bi = KB in, bo = KB out with wa = waiting for I/O
I/O can also increase cache demands
%CPU utilisation = us (user) = sy (system)

procs -----------memory---------- ---swap-- -----io----  -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo    in   cs us sy id wa
 0  0      0 277504  17060  82732    0    0    91    87  1432  236 11  3 84  1
 0  0      0 277372  17068  82732    0    0     0    24  1361  399 23  8 59 10
test start
 0  1      0 275240  17068  82732    0    0     0   512  1342  305 24  4 69  4
 2  1      0 275232  17068  82780    0    0    24 10752  4176  216  7  8  0 85
 1  1      0 275240  17076  82732    0    0 12288  2590  5295  243 15  8  0 77
 0  1      0 275240  17076  82748    0    0     8 11264  4329  214  6 12  0 82
 0  1      0 275240  17076  82780    0    0    16 11264  4278  233 15 10  0 75
 0  1      0 275240  17084  82780    0    0 19456   542  6563  255 10  7  0 83
 0  1      0 275108  17084  82748    0    0  5128  3072  3501  265 16 37  0 47
 3  1      0 275108  17084  82748    0    0   924  5120  8369 3845 12 33  0 55
 0  1      0 275116  17092  82748    0    0  1576    85 11483 6645  5 50  0 45
 1  1      0 275116  17092  82748    0    0     0   136  2304  689  3  9  0 88
 2  1      0 275084  17100  82732    0    0     0   352  2374  800 14 26  0 61
 0  0      0 275076  17100  82732    0    0   546   118  2408 1014 35 17 47  1
 0  1      0 275076  17104  82732    0    0     0    62  1324   76  3  2 89  7
 1  1      0 275076  17108  82732    0    0     0   452  1879  442  8 13 66 12
 0  0      0 275116  17108  82732    0    0   800   352  2456 1195 19 17 56  8
 0  1      0 275116  17112  82732    0    0     0    54  1325   76  4  1 88  8
test end
 1  1      0 275116  17116  82732    0    0     0   510  1717  286  6 10 72 11
 1  0      0 275076  17116  82732    0    0  1600  1152  3087 1344 23 29 41  7