lmbench的使用方法

來源:互聯網
上載者:User
一、引言
要評價一個系統的效能,通常有不同的指標,相應的會有不同的測試 方法和測試載入器,一般來說為了確保測試結果的公平和權威性,會選用比較成熟的商業測試軟體。但在特定情形下,只是想要簡單比較不同系統或比較一些函數庫效能時,也能夠從開源世界裡選用一些優秀的工具來完成這個任務,本文就通過 lmbench 簡要介紹系統綜合效能測試。

二、測試軟體Lmbench是一套簡易,可移植的,符合ANSI/C標準為UNIX/POSIX而制定的微型測評工具。一般來說,它衡量兩個關鍵特徵:反應時間和頻寬。Lmbench旨在使系統開發人員深入瞭解關鍵操作的基礎成本。軟體說明:lmbench是個用於評價系統綜合效能的多平台開源benchmark,能夠測試包括文檔讀寫、記憶體操作、進程建立銷毀開銷、網路等效能,測試方法簡單。
Lmbench是個多平台軟體,因此能夠對同層級的系統進行比較測試,反映不同系統的優劣勢,通過選擇不同的庫函數我們就能夠比較庫函數的效能;更為重要的是,作為一個開源軟體,lmbench提供一個測試架構,假如測試者對測試專案有更高的測試需要,能夠通過少量的修改原始碼達到目的(比如現在只能評測進程建立、終止的效能和進程轉換的開銷,通過修改部分代碼即可實現線程層級的效能測試)。
下載:
www.bitmover.com/lmbench,最新版本3.0-a9LMbench的主要功能:*頻寬測評工具         —讀取快取檔案          —拷貝記憶體          —讀記憶體          —寫記憶體          —管道          —TCP    * 反應時間測評工具          —環境切換          —網路: 串連的建立,管道,TCP,UDP和RPC
hot potato          —檔案系統的建立和刪除          —進程建立          —訊號處理          —上層的系統調用          —記憶體讀入反應時間    * 其他          —處理器時鐘比率計算 LMbench的主要特性:—對於作業系統的可移植性測試評測工具是由C語言編寫的,具有較好的可移植性(儘管它們更易於被GCC編譯)。這對於產生系統間逐一明細的對比結果是有用的。 —自適應調整Lmbench對於應激性行為是非常有用的。當遇到BloatOS比所有競爭者慢4倍的情況時,這個工具會將資源進行分配來修正這個問題。 — 資料庫計算結果  資料庫的計算結果包括了從大多數主流的電腦工作站製造商上的運行結果。 —儲存空間延遲計算結果   儲存空間延遲測試展示了所有系統(資料)的緩衝延遲,例如一級,二級和三級緩衝,還有記憶體和TLB表的未命中延遲。另外,緩衝的大小可以被正確劃分成一些結果集並被讀出。硬體族與上面的描述相象。這種測評工具已經找到了作業系統分頁策略的中的一些錯誤。 —上下文轉換計算結果   很多人好象喜歡上下文轉換的數量。這種測評工具並不是特別注重僅僅引用“在緩衝中”的數量。它時常在進程數量和大小間進行變化,並且在當前內容不在緩衝中的時候,將結果以一種對使用者可見的方式進行劃分。您也可以得到冷緩衝環境切換的實際開銷。  — 迴歸測試   Sun公司和SGI公司已經使用這種測評工具以尋找和補救存在於效能上的問題。   Intel公司在開發P6的過程中,使用了它們。   Linux在Linux的效能調整中使用了它們。  — 新的測評工具   原始碼是比較小的,可讀並且容易擴充。它可以按常規組合成不同的形式以測試其他內容。舉例來說,如包括處理串連建立的庫函數的網路測量,伺服器關閉等。三、測試在此次測試中我分兩種測試,一個是在我的pc機上測試的,一個是在SEP4020的arm720t平台上測試的:(1)     在pc機上的測試
測試平台:HP compoq,fedora 7 Linux 2.6.21
1、  確認安裝了C編譯器,假如沒有需要先安裝
2、  拷貝lmbench源碼文檔lmbench-3.0-a9.tgz到fedora的/root/test目錄下,解壓到目前的目錄即可
3、  cd lmbench-3.0-a9,在命令列鍵入make results即可開始編譯測試
4、  假如編譯沒有錯誤,會出現一些選擇提示以對測試進行一個配置並組建組態指令碼,後續的測試將使用該配置指令碼,在以後測試中也能夠直接使用同樣的配置多次測試。配置提示除了測試的記憶體範圍(如“MB [default 371]”時,對記憶體較大的應該避免選擇太大值,否則測試時間會很長)和是否Mail results外,基本上都能夠選擇預設值。
5、  Lmbench根據配置文檔執行任何測試項,在results目錄下根據系統類別型、系統名和作業系統類型等產生一個子目錄,測試結果文檔(system name+序號)存放於該目錄下。
6、  測試完畢執行make see可查看到測試結果報告,則可以將測試資料/results/i686-pc-linux-gnu/目錄下的檔案匯出為測試報告/results/summary.out檔案,我們查看summary.out檔案就可以看測試結果了。(2)    在SEP4020上的測試
測試平台:SEP4020 evb1.5, Linux 2.6.16
1、  確認宿主機上安裝了交叉編譯編譯器arm-linux-gcc,假如沒有需要先安裝
2、  拷貝lmbench源碼文檔lmbench-3.0-a9.tgz到fedora的/root/test目錄下,解壓到目前的目錄即可
3、  cd lmbench-3.0-a9,在命令列鍵入make CC=arm-linu-gcc OS=arm-linux 即可開始編譯測試案例,編譯完成後,會在/root/test/lmbench-3.0-a9/bin下出現一個arm-linux目錄,在這個目錄下就是測試案例的目標檔案。由於我們的目標平台不支援make命令,所以我們必須另外寫一個運行指令碼,腳步名為run_all.sh,放在scripts下面,內容是:#!/bin/shecho run the lmbench on sep4020 arm-linuxenv OS=arm-linux ./config-runenv OS=arm-linux ./results
4、  然後將整個lmbench-3.0-a9目錄拷貝到目標機的nfs根目錄下面,然後進入目標機的串口終端,在/lmbench-3.0-a9/scripts下面輸入./run_all.sh假如交叉編譯沒有錯誤,會出現一些選擇提示以對測試進行一個配置並組建組態指令碼,後續的測試將使用該配置指令碼,在以後測試中也能夠直接使用同樣的配置多次測試。配置提示除了測試的記憶體範圍(如“MB [default 19]”時,對記憶體較大的應該避免選擇太大值,否則測試時間會很長)和是否Mail results外,基本上都能夠選擇預設值。
5、  Lmbench根據配置文檔執行任何測試項,在results目錄下根據系統類別型、系統名和作業系統類型等產生一個子目錄,測試結果文檔(system name+序號)存放於該目錄下。
6、  測試完畢執行,在虛擬機器fedora7中進入/nfs/lmbench-3.0-a9 鍵入make see命令可產生測試結果報告,它可以將測試資料/results/i686-pc-linux-gnu/目錄下的檔案匯出為測試報告/results/summary.out檔案,我們查看summary.out檔案就可以看測試結果了。 四、關於測試結果及說明

make[1]: Entering directory `/nfs/lmbench-3.0-a9/results'
                 L M B E N C H  3 . 0   S U M M A R Y                 ------------------------------------   (Alpha software, do not distribute)
Basic system parameters------------------------------------------------------------------------------Host                 OS Description              Mhz  tlb  cache  mem   scal                                                     pages line   par   load                                                           bytes  --------- ------------- ----------------------- ---- ----- ----- ------ ----192.168.0  Linux 2.6.16               arm-linux   85    60     8 1.0000    1192.168.0  Linux 2.6.27               arm-linux   86    63    16 1.0000    1192.168.0  Linux 2.6.16               arm-linux   86    63    16 1.0000    1192.168.0  Linux 2.6.16               arm-linux   86    63    16 1.0000    1192.168.0  Linux 2.6.16               arm-linux   86    63    16 1.0000    1localhost Linux 2.6.21-       i686-pc-linux-gnu 1817     8   128 1.3300    1localhost Linux 2.6.21-       i686-pc-linux-gnu 1864     8   128 1.2900    1
Processor, Processes - times in microseconds - smaller is better------------------------------------------------------------------------------Host                 OS  Mhz null null      open slct sig  sig  fork exec sh                               call  I/O stat clos TCP  inst hndl proc proc proc--------- ------------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----192.168.0  Linux 2.6.16   85 2.04 8.44 187. 2064      21.0 81.2 9655 42.K 63.K192.168.0  Linux 2.6.27   86 2.69 8.44 266. 5338      20.7 94.7 10.K 44.K 73.K192.168.0  Linux 2.6.16   86 2.03 8.34 185. 5100      20.7 85.9 9468 63.K 121K192.168.0  Linux 2.6.16   86 2.03 8.72 185. 19.K      20.7 84.9 9556 53.K 72.K192.168.0  Linux 2.6.16   86 2.04 8.33 185. 5321      20.7 80.5 9395 42.K 101Klocalhost Linux 2.6.21- 1817 1.11 1.26 3.08 5.17 10.2 1.70 2.85 674. 1922 5177localhost Linux 2.6.21- 1864 1.09 1.26 2.98 5.05 8.94 1.48 3.27 1083 2086 6119
Basic integer operations - times in nanoseconds - smaller is better-------------------------------------------------------------------Host                 OS  intgr intgr  intgr  intgr  intgr                            bit   add    mul    div    mod   --------- ------------- ------ ------ ------ ------ ------ 192.168.0  Linux 2.6.16   11.6 8.6900   52.1 1489.3  255.9192.168.0  Linux 2.6.27   11.5 8.5800   52.2 1469.2  252.6192.168.0  Linux 2.6.16   11.5 8.5400   52.2 1472.0  252.9192.168.0  Linux 2.6.16   11.5 8.6200   52.0 1472.8  251.9192.168.0  Linux 2.6.16   11.5 8.6400   52.2 1472.5  254.5localhost Linux 2.6.21- 0.5600 0.2800 0.2000   20.6   10.9localhost Linux 2.6.21- 0.6100 0.2700 0.1700   20.0 9.8600
Basic uint64 operations - times in nanoseconds - smaller is better------------------------------------------------------------------Host                 OS int64  int64  int64  int64  int64                           bit    add    mul    div    mod   --------- ------------- ------ ------ ------ ------ ------ 192.168.0  Linux 2.6.16    23.         691.6 4295.6 3895.0192.168.0  Linux 2.6.27    23.         685.4 4192.8 4074.3192.168.0  Linux 2.6.16    23.         683.0 4199.0 4082.1192.168.0  Linux 2.6.16    23.         680.7 4202.6 4082.9192.168.0  Linux 2.6.16    23.         686.9 4235.7 4080.3localhost Linux 2.6.21-  0.690        0.6200   34.5   41.4localhost Linux 2.6.21-  0.660        0.6100   36.8   40.2
Basic float operations - times in nanoseconds - smaller is better-----------------------------------------------------------------Host                 OS  float  float  float  float                         add    mul    div    bogo--------- ------------- ------ ------ ------ ------ 192.168.0  Linux 2.6.16 6902.1 7781.9  12.1K  42.2K192.168.0  Linux 2.6.27 6911.0 6568.4  11.6K  43.0K192.168.0  Linux 2.6.16 6757.4 7578.5  11.9K  43.5K192.168.0  Linux 2.6.16 6763.1 7611.3  11.7K  43.5K192.168.0  Linux 2.6.16 6759.3 7640.4  11.9K  43.5Klocalhost Linux 2.6.21- 1.6600 2.7900   21.7   20.6localhost Linux 2.6.21- 1.6300 2.7200   20.9   20.1
Basic double operations - times in nanoseconds - smaller is better------------------------------------------------------------------Host                 OS  double double double double                         add    mul    div    bogo--------- ------------- ------  ------ ------ ------ 192.168.0  Linux 2.6.16 9955.5  10.6K  22.8K  79.8K192.168.0  Linux 2.6.27 9157.0 9909.4  20.6K  79.4K192.168.0  Linux 2.6.16 9793.3  10.3K  22.4K  79.8K192.168.0  Linux 2.6.16 9703.9  10.4K  22.2K  79.9K192.168.0  Linux 2.6.16 9746.9  10.3K  22.3K  79.7Klocalhost Linux 2.6.21- 1.6900 2.7900   21.2   20.6localhost Linux 2.6.21- 1.6300 2.8800   21.0   20.2
Context switching - times in microseconds - smaller is better-------------------------------------------------------------------------Host                 OS  2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K                         ctxsw  ctxsw  ctxsw ctxsw  ctxsw   ctxsw   ctxsw--------- ------------- ------ ------ ------ ------ ------ ------- -------192.168.0  Linux 2.6.16  164.8  120.0  311.9  165.3  162.5   165.9   151.1192.168.0  Linux 2.6.27  247.5  196.1  198.4  238.0  254.9   262.9   291.2192.168.0  Linux 2.6.16  164.4  118.5  115.2  161.1  156.4   164.4   164.3192.168.0  Linux 2.6.16  167.2  116.6  119.6  166.9  161.9   171.3   158.1192.168.0  Linux 2.6.16  172.5  117.4  114.3  161.3  147.6   163.8   127.5localhost Linux 2.6.21-   11.0   11.6   11.7   15.3   19.2    16.8    25.1localhost Linux 2.6.21-   10.2   11.4   11.3   14.3   20.9    17.4    26.0
*Local* Communication latencies in microseconds - smaller is better---------------------------------------------------------------------Host                 OS 2p/0K  Pipe AF     UDP  RPC/   TCP  RPC/ TCP                        ctxsw       UNIX         UDP         TCP conn--------- ------------- ----- ----- ---- ----- ----- ----- ----- ----192.168.0  Linux 2.6.16 164.8 482.3 925.                             192.168.0  Linux 2.6.27 247.5 770.7 1069                             192.168.0  Linux 2.6.16 164.4 477.4 917.                             192.168.0  Linux 2.6.16 167.2 472.9 926.                             192.168.0  Linux 2.6.16 172.5 474.9 913.                             localhost Linux 2.6.21-  11.0  28.3 50.8  45.9  55.2  48.2  59.8 126.localhost Linux 2.6.21-  10.2  32.1 55.7  36.7  49.2  40.2  53.1 113.
*Remote* Communication latencies in microseconds - smaller is better---------------------------------------------------------------------Host                 OS   UDP  RPC/  TCP   RPC/ TCP                               UDP         TCP  conn--------- ------------- ----- ----- ----- ----- ----192.168.0  Linux 2.6.16                             192.168.0  Linux 2.6.27                             192.168.0  Linux 2.6.16                             192.168.0  Linux 2.6.16                             192.168.0  Linux 2.6.16                             localhost Linux 2.6.21-                             localhost Linux 2.6.21-                             
File & VM system latencies in microseconds - smaller is better-------------------------------------------------------------------------------Host                 OS   0K File      10K File     Mmap    Prot   Page   100fd                        Create Delete Create Delete Latency Fault  Fault  selct--------- ------------- ------ ------ ------ ------ ------- ----- ------- -----192.168.0  Linux 2.6.16 6410.3 6135.0  37.0K 6896.6  5112.0 3.124    36.8 280.8192.168.0  Linux 2.6.27  18.9K  71.4K  55.6K  28.6K   16.2K  15.9    54.2 194.3192.168.0  Linux 2.6.16  22.7K  15.4K 1000.K  47.6K  4926.0 5.213    37.1 284.2192.168.0  Linux 2.6.16  31.2K  29.4K  41.7K  50.0K  4907.0 1.087    36.0 277.1192.168.0  Linux 2.6.16  33.3K  25.0K  58.8K 9434.0  5108.0 9.428    37.1 285.6localhost Linux 2.6.21-  112.0   12.4   88.5  130.8  7413.0 2.360 5.98870 4.635localhost Linux 2.6.21-   36.1   19.0  181.2  138.4  9006.0 2.134   482.1 4.148
*Local* Communication bandwidths in MB/s - bigger is better-----------------------------------------------------------------------------Host                OS  Pipe AF    TCP  File   Mmap  Bcopy  Bcopy  Mem   Mem                             UNIX      reread reread (libc) (hand) read write--------- ------------- ---- ---- ---- ------ ------ ------ ------ ---- -----192.168.0  Linux 2.6.16 10.2 11.2        13.1   32.8   19.1   17.8 32.8  72.9192.168.0  Linux 2.6.27 8.96 11.4        12.9   32.6   19.1   17.7 32.7  71.2192.168.0  Linux 2.6.16 10.2 11.2        13.0   32.8   19.0   17.8 32.7  71.2192.168.0  Linux 2.6.16 10.2 11.2        12.9   32.9   19.0   17.8 32.9  71.6192.168.0  Linux 2.6.16 10.2 11.2        12.9   32.9   19.0   17.8 32.7  71.6localhost Linux 2.6.21- 1153 436. 640. 1742.8 3463.7 1239.0 1116.5 3502 1589.localhost Linux 2.6.21- 1194 451. 744. 1742.3 3443.5 1217.8 1159.0 3357 1555.
Memory latencies in nanoseconds - smaller is better    (WARNING - may not be correct, check graphs)------------------------------------------------------------------------------Host                 OS   Mhz   L1 $   L2 $    Main mem    Rand mem    Guesses--------- -------------   ---   ----   ----    --------    --------    -------192.168.0  Linux 2.6.16    85   33.6  293.4       296.6       856.8    No L2 cache?192.168.0  Linux 2.6.27    86   35.2  293.8       309.8       863.1    No L2 cache?192.168.0  Linux 2.6.16    86   35.4  293.7       310.3       861.4    No L2 cache?192.168.0  Linux 2.6.16    86   35.4  293.7       309.9       863.6    No L2 cache?192.168.0  Linux 2.6.16    86   35.4  293.6       308.2       860.2    No L2 cache?localhost Linux 2.6.21-  1817 1.6620 7.9160        98.6       191.7localhost Linux 2.6.21-  1864 1.7240 7.7130       104.3       205.4make[1]: Leaving directory `/nfs/lmbench-3.0-a9/results'

主要技術參數說明:

分類

其中host為localhost 說明是我用的虛擬機器,而192.168.0則說明是用4020進行的測試
技術參數
參數說明
(1)Basic system parameters(系統基本參數)
Tlb pages:TLB(Translation Lookaside Buffer)的頁面數
Cache line bytes :(cache的行位元組數)
Mem par
memory hierarchy parallelism
Scal load:並行的lmbench
(2)Processor, Processes(處理器、進程操作時間)
Null call:簡單系統調用(取進程號)
Null I/O:簡單IO操作(空讀寫的平均)
Stat:取文檔狀態的操作
Open clos:開啟然後立即關閉關閉文檔操作
Slct tcp
Select:配置
Sig inst:配置訊號
Sig hndl:捕獲處理訊號
Fork proc :Fork進程後直接退出
Exec proc:Fork後執行execve調用再退出
Sh proc:Fork後執行shell再退出
(3)Basic integer/float/double operations

(4)Context switching 環境切換時間
2p/16K: 表示2個平行處理16K大小的資料

(5)*Local* Communication latencies(本地通訊延時,通過不同通訊方式發送後自己立即讀)
Pipe:管道通訊
AF UNIX
Unix協議
UDP
UDP
RPC/UDP
TCP
RPC/TCP
TCP conn
TCP建立connect並關閉描述字
(6)File & VM system latencies(文檔、記憶體延時)
File Create & Delete:建立並刪除文檔
MMap Latency:記憶體映射
Prot Fault
Protect fault
Page Fault:缺頁
100fd selct:對100個文檔描述符配置select的時間
(7)*Local* Communication bandwidths(本地通訊頻寬)
Pipe:管道操作
AF UNIX
Unix協議
TCP
TCP通訊
File reread:文檔重複讀
MMap reread:記憶體映射重複讀
Bcopy(libc):記憶體拷貝
Bcopy(hand):記憶體拷貝
Mem read:記憶體讀
Mem write:記憶體寫
(8)Memory latencies(記憶體操作延時)
L1:緩衝1
L2:緩衝2
Main Mem:連續記憶體
Rand Mem:記憶體隨機訪問延時
Guesses
假如L1和L2近似,會顯示“No L1 cache?”
假如L2和Main Mem近似,會顯示“No L2 cache?”

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.