天天看點

[喵咪開源軟體推薦(4)]Liunx跑分神器-unixbench

哈喽大家好呀! 這次給大家帶來一個Liunx跑分神奇,在筆者在老早之前有聽到一則傳聞,阿裡雲相同的配置性能有差異 有的是X5的有的是E5的檔次各有不同,然後有人開了100台阿裡Liunx的機器,在裡面選出了4台性能最好的時候,那個時候我就在納悶Windows可以通過魯大師CPU-Z的跑分,Liunx怎麼跑分呢?這次就為大家帶來Liunx跑分神奇unixbench.

附上:

喵了個咪的部落格:

w-blog.cn

#    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
   #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
   #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
   #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
   #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
    ####   #    #  #  #    #          #####   ######  #    #   ####   #    #
           

1.了解unixbench

UnixBench是一款開源的測試 unix 系統基本性能的工具,是比較通用的測試VPS性能的工具。

UnixBench會測試系統各個方面一系列的性能,然後将每個測試結果和一個基準值進行比較,得到一個索引值,所有測試項目的索引值結合在一起形成一個測試分數值.

UnixBench也支援多CPU系統的測試,預設的行為是測試兩次,第一次是一個程序的測試,第二次是N份測試,N等于CPU個數。

基本測試項如下:

  • 簡單的2D和3D圖形測試
  • 測試系統的單任務性能
  • 測試系統的多任務性能
  • 測試系統并行處理的能力
  • CPU,記憶體,或者磁盤

UnixBench一個基于系統的基準測試工具,不單純是CPU 記憶體 或者磁盤測試工具。測試結果不僅僅取決于硬體,也取決于系統、開發庫、甚至是編譯器。

UnixBench測試執行完大約需要10-30分鐘.

2.安裝使用

wget http://soft.laozuo.org/scripts/UnixBench5.1.3.tgz
tar xf UnixBench5.1.3.tgz
cd UnixBench
make
./Run           

這是使用UnixBench5.1.3預設不進行圖像測試測試,如果是更早的版本需要注意注釋掉圖像測試不然會不允許運作:

# 無需圖像測試
vim Makefile 
# 注釋掉 GRAPHIC_TESTS = defined
./Run #開始跑分

# 異常問題彙總
1.缺少gcc或c++
yum install gcc gcc_c++
2.報錯如/src/ubgears.c:48:22: error: X11/Xlib.h: No such file or directory
./src/ubgears.c:49:23: error: X11/Xutil.h: No such file or directory
./src/ubgears.c:50:24: error: X11/keysym.h: No such file or directory
./src/ubgears.c:51:19: error: GL/gl.h: No such file or directory
./src/ubgears.c:52:20: error: GL/glx.h: No such file or directory
yum install xorg-x11* 
3.報錯如/usr/bin/ld: cannot find -lXext
ln -s /usr/lib64/libXext.so.6.4.0 /usr/lib/libXext.so
4.Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./Run line 6. BEGIN failed--compilation aborted at ./Run line 6.
yum install perl-Time-HiRes           

也可以通過一鍵腳本執行測試

wget http://www.vpsmark.com/sh/unixbench.sh
sh ./unixbench.sh           

UnixBench會更具機器核心數進行單核到多核的測試,如果隻有一個核心隻會進行單核測試,下面是阿裡雲單核1G雲主機的測試

#    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
   #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
   #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
   #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
   #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
    ####   #    #  #  #    #          #####   ######  #    #   ####   #    #

   Version 5.1.3                      Based on the Byte Magazine Unix Benchmark
   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   January 13, 2011                   johantheghost at yahoo period com
..........過程省略
Benchmark Run: Fri Apr 07 2017 19:45:29 - 20:13:31
1 CPU in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       29585257.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     4482.2 MWIPS (9.8 s, 7 samples)
Execl Throughput                               4348.9 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        924016.8 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          242952.9 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2585826.2 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1486598.7 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 322716.3 lps   (10.0 s, 7 samples)
Process Creation                              16792.4 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   5959.1 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    804.3 lpm   (60.1 s, 2 samples)
System Call Overhead                        2482379.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   29585257.5   2535.2
Double-Precision Whetstone                       55.0       4482.2    815.0
Execl Throughput                                 43.0       4348.9   1011.4
File Copy 1024 bufsize 2000 maxblocks          3960.0     924016.8   2333.4
File Copy 256 bufsize 500 maxblocks            1655.0     242952.9   1468.0
File Copy 4096 bufsize 8000 maxblocks          5800.0    2585826.2   4458.3
Pipe Throughput                               12440.0    1486598.7   1195.0
Pipe-based Context Switching                   4000.0     322716.3    806.8
Process Creation                                126.0      16792.4   1332.7
Shell Scripts (1 concurrent)                     42.4       5959.1   1405.5
Shell Scripts (8 concurrent)                      6.0        804.3   1340.4
System Call Overhead                          15000.0    2482379.7   1654.9
                                                                   ========
System Benchmarks Index Score                                        1498.1           

下面是macbookpro虛拟2核心2G跑分可以看到差距還是挺大的

Benchmark Run: Fri Apr 07 2017 20:16:35 - 20:46:22
2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables       80339506.0 lps   (10.5 s, 7 samples)
Double-Precision Whetstone                     7093.4 MWIPS (13.9 s, 7 samples)
Execl Throughput                               4520.2 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1539490.5 KBps  (31.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          406417.1 KBps  (31.5 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       4557946.6 KBps  (30.9 s, 2 samples)
Pipe Throughput                             4100218.8 lps   (11.0 s, 7 samples)
Pipe-based Context Switching                 775848.8 lps   (10.5 s, 7 samples)
Process Creation                              26732.6 lps   (31.0 s, 2 samples)
Shell Scripts (1 concurrent)                   7841.0 lpm   (62.9 s, 2 samples)
Shell Scripts (8 concurrent)                   1208.6 lpm   (60.9 s, 2 samples)
System Call Overhead                        5413108.9 lps   (10.5 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   80339506.0   6884.3
Double-Precision Whetstone                       55.0       7093.4   1289.7
Execl Throughput                                 43.0       4520.2   1051.2
File Copy 1024 bufsize 2000 maxblocks          3960.0    1539490.5   3887.6
File Copy 256 bufsize 500 maxblocks            1655.0     406417.1   2455.7
File Copy 4096 bufsize 8000 maxblocks          5800.0    4557946.6   7858.5
Pipe Throughput                               12440.0    4100218.8   3296.0
Pipe-based Context Switching                   4000.0     775848.8   1939.6
Process Creation                                126.0      26732.6   2121.6
Shell Scripts (1 concurrent)                     42.4       7841.0   1849.3
Shell Scripts (8 concurrent)                      6.0       1208.6   2014.3
System Call Overhead                          15000.0    5413108.9   3608.7
                                                                   ========
System Benchmarks Index Score                                        2663.8           

3 總結

通過unixbench可以很好的對Liunx服務綜合性能進行評估,可以幫助大家在購買雲主機也好還是對實體主機進行完整的測試,今天就到這裡了下次再見!

注:筆者能力有限有說的不對的地方希望大家能夠指出,也希望多多交流!

繼續閱讀