linux下常用的硬件測試軟件

Super π(Pi)是Windows底下很受歡迎的測試CPU的工具,因其只用到基礎的浮點運算,而不涉及其他的系統庫環境,所以,很適合用於排查CPU物理問題。而基於Linux環境,同樣也有Super PI for linux套件。

一、下載
 

ftp://pi.super-computing.org/Linux/super_pi.tar.gz
或者

http://www.dbasky.net/tool/superpi_linux.tar.gz

 


二、安裝/運行
解壓後,運行即可:

 

[root@localhost superpi]#tar xvf superpi_linux.tar.gz
[root@localhost superpi]# cd superpi
[root@localhost superpi]# ./super_pi 20
Version 2.0 of the super_pi for Linux OS
Fortran source program was translated into C program with version 19981204 of
f2c, then generated C source program was optimized manually.
pgcc 3.2-3 with compile option of “-fast -tp px -Mbuiltin -Minline=size:1000 -Mnoframe -Mnobounds -Mcache_align -Mdalign -Mnoreentrant” was used for the
compilation.
—— Started super_pi run : Sun Nov 29 14:57:04 EST 2009
Start of PI calculation up to 1048576 decimal digits
End of initialization. Time=       0.378 Sec.
I= 1 L=       0        Time=       1.136 Sec.
I= 2 L=       0        Time=       1.292 Sec.
I= 3 L=       1        Time=       1.290 Sec.
I= 4 L=       2        Time=       1.293 Sec.
I= 5 L=       5        Time=       1.291 Sec.
I= 6 L=      10        Time=       1.289 Sec.
I= 7 L=      21        Time=       1.293 Sec.
I= 8 L=      43        Time=       1.295 Sec.
I= 9 L=      87        Time=       1.290 Sec.
I=10 L=     174        Time=       1.292 Sec.
I=11 L=     349        Time=       1.291 Sec.
I=12 L=     698        Time=       1.291 Sec.
I=13 L=    1396        Time=       1.291 Sec.
I=14 L=    2794        Time=       1.286 Sec.
I=15 L=    5588        Time=       1.286 Sec.
I=16 L=   11176        Time=       1.279 Sec.
I=17 L=   22353        Time=       1.256 Sec.
I=18 L=   44707        Time=       1.221 Sec.
I=19 L=   89415        Time=       1.143 Sec.
End of main loop
End of calculation.    Time=      25.478 Sec.
End of data output.    Time=       0.134 Sec.
Total calculation(I/O) time=      25.612(       1.024) Sec.
—— Ended super_pi run : Sun Nov 29 14:57:30 EST 2009


※說明
1、命令運行中使用的參數m,是指位數,表示要算2的多少次方位,如通常要算小數點後1M位(2^20次方);
2、m最大到25次方,若設置再大的值,會自動縮小到該值
Specified M(=30) is too large.  M is set to 25.
Start of PI calculation up to 33554432 decimal digits

3、因算法不同,該程序不能用於和Windows平臺上的Super PI進行性能對比(實際上,快很多);
4、該程序在SMP環境中,只能讓CPU滿載運行,所以,對於多CPU的環境,可同時用多個程序併發運行。

查看CPU信息
cat /proc/cpuinfo

二、 內存測試工具
下載最新版 http://pyropus.ca/software/memtester/
tar zxf …. && cd xxxx
make all
#memtester [run-times]
例:
 

[root@localhost ]#tar zxvf memtester-4.1.2.tar.gz
[root@localhost ]#cd memtester-4.1.2
[root@localhost memtester-4.1.2]# ./memtester 512M 2


512表示測試的內存大小,單位是M,2表示次數。
如果1024不接受的,把它縮小就可以了。先運行一次,如果沒有問題就把次數增加即可。
監控:vmstat、top都可以看到。

查看內存信息
# cat /proc/meminfo
# dmidecode -t memory

三、Iozone linux下I/O性能測試

一.    安裝
1.安裝gnuplot
找到安裝盤中gnuplot-4.0.0-20.2.i586.rpm ,並安裝
或直接到主頁http://www.gnuplot.info/
(如果不安裝,執行Generate_Graphs時會出現./Generate_Graphs: line 30: gnuplot: command not found報錯)

2.安裝iozone
到http://www.iozone.org/下載最新版
cd /zhangjianfeng/tools/ && wget http://www.iozone.org/src/current/iozone3_308.tar
tar xf iozone3_308.tar && cd iozone3_308/src/current/
make linux (32位) 或 make linux-ia64 (64位),更詳細參數請直接在當前目錄運行make
或直接rpm包並安裝即可,安裝後路徑/opt/iozone/

二. 使用

測試格式爲-i #,比如測試寫:-i 0,測試讀和寫:-i 0 -i 1。

-R 產生excel格式的輸出(僅顯示在屏幕上,不會產生excel文件)
-b 產生excel格式的文件
-g 最大測試文件大小 for auto mode
-t 併發數
-s 測試文件的大小,支持-k -m -g
-q 塊大小 for auto mode
-r 文件塊大小。
-a 在希望的文件系統上測試,不過只有-a的話會進行全面測試,要花費很長時間,最好用-i指定測試範圍。
-n 指定最小測試文件大小。
-f 指定測試文件。
-C 顯示每個節點的吞吐量。
-c 測試包括文件的關閉時間
用tee命令生成log信息。

./iozone -Raz -b lab-2G.xls -g 2G |tee 2G.log
./iozone -i 0 -i 1 -Rab ~/test-iozone.xls -g 4M -n 1M -C

#以下測試都可以加-Rb產生xls文件
iozone的確是一款不錯的文件系統性能測試工具,可以就文件系統的很多方面作自動測試。地址:www.iozone.org
用法:
在希望進行測試的文件系統上運行:
/opt/iozone/bin/iozone -a
即可進行全面的自動測試,不過通常需要很長的時間,要耐心等待。
/opt/iozone/bin/iozone -a -i 1
只對write, rewrite進行性能測試
/opt/iozone/bin/iozone -a -i 1 -i 0
對讀寫進行性能測試
/opt/iozone/bin/iozone -a -g 1G -i 0 -i 1
對讀寫進行性能測試,並且最大測試文件爲1G
/opt/iozone/bin/iozone -Ra
測試所有方面,並且生成excel文件
上面的命令在執行時,最好通過重定向保存到另外一個文件中.
/opt/iozone/bin/iozone –Rab output.wks
測試小文件
/opt/iozone/bin/iozone -a -s 512m -y 1k -q 8k -b minfile_result.xls
測試普通文件
如果2G內存測試,時間太長,先在grub.conf裏把內存變成256m,這時使用512m的文件測試,就不會使用緩存了。
可以保證測試的準確性
/opt/iozone/bin/iozone -a -s 512m -y 8k -q 512k -b comfile_result.xls
測試大文件
/opt/iozone/bin/iozone -a -s 512m -y 1024k -q 10240k -i 0 -i 1 -i 2 -b largefile_result.xls
測試-i命令的使用
/opt/iozone/bin/iozone -Rab output.wks -g 1G -i 0 -i 1 -i 2 -i 8

-R 創建 Excel 報告
-g 設置自動模式下最大文件大小
Set maximum file size (in Kbytes) for auto mode.
-s 指定文件大小
-s 512k or -s 512M or -s 1G
-f filename
指定臨時文件
-F filename filename filename
指定臨時文件組
-t #
線程數
-q 指定最大記錄大小
-q 512K or -q 512M or -q 1g
-y 指定最小記錄大小
-y 512K or -q 512M or -q 1g
-U mountpoint
Mount point to unmount and remount between tests. Iozone will unmount and remount
this mount point before beginning each test. This guarantees that the buffer cache does not
contain any of the file under test.

通常情況下,測試的文件大小要求至少是系統cache的兩倍以上,這樣,測試的結果纔是真是可信的。如果小於cache的兩倍,文件的讀寫測試讀寫的將是cache的速度,測試的結果大打折扣

附:
-i 參數
0=write/rewrite
1=read/re-read
2=random-read/write
3=Read-backwards
4=Re-write-record
5=stride-read
6=fwrite/re-fwrite
7=fread/Re-fread,
8=random mix
9=pwrite/Re-pwrite
10=pread/Re-pread
11=pwritev/Re-pwritev,
12=preadv/Re-preadv

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章