基準測試

出自 Arch Linux 中文维基

所謂基準測試,就是通過一個統一的流程來測試性能,並將其結果和其它系統測到的結果或一個被廣泛接受的標準相比較的行為。這種計算系統性能的統一流程可以幫助解答一些問題,比如:

  • 系統是否發揮正常?
  • 應該用哪個版本的驅動以達到最佳性能?
  • 系統是否能夠勝任某任務?

許多工具可以測試系統性能,下面列出可用的工具。

獨立工具[編輯 | 編輯原始碼]

glxgears[編輯 | 編輯原始碼]

glxgears是流行的OpenGL測試,渲染非常簡單的齒輪,輸出幀率。儘管glxgears可以測試顯卡驅動直接渲染能力,但是它已經過時,不能代表GNU/Linux圖形顯示的現狀以及OpenGL的全部能力。glxgears僅測試了一小部分OpenGL功能。在glxgears中體現的性能提升在遊戲中並不能感受到。更多信息請看這裏

可以通過mesa-utils 安裝 64 位版本,通過 Multilib 中的 lib32-mesa-utils安裝 32 位版本。

UnixBench[編輯 | 編輯原始碼]

unixbench unixbenchAUR中。 在終端中運行ubench跑評測。

請看:

interbench[編輯 | 編輯原始碼]

interbenchAUR 可以評測 Linux 的交互性。測試 Linux 內核設計或系統配置改變後的效果,例如 CPU、I/O調度、文件系統,以及參數的改變。使用仔細的評測,可以比較不同的硬件。

請看:

ttcp[編輯 | 編輯原始碼]

ttcp (Test TCP)測試任意網絡連接的P2P帶寬。需要在(被測試帶寬的)網絡兩端都安裝該程序。

可以在AUR找到不同版本的ttcp。

iperf[編輯 | 編輯原始碼]

iperf是簡單的P2P帶寬測試工具,可以用於TCP或UDP。它的輸出格式非常好,並發測試模式。

可以安裝iperf,或不同版本的iperf3

time[編輯 | 編輯原始碼]

time統計調用某個命令到結束所花的時間。在大多數Linux系統上都有time。

$ time tar -zxvf archive.tar.gz

hdparm[編輯 | 編輯原始碼]

可以用hdparm(hdparm)測試存儲介質。Using hdparm with the -Tt switch, one can time sequential reads. This method is independent of partition alignment!

# hdparm -Tt /dev/sdX
/dev/sdX:
Timing cached reads:   x MB in  y seconds = z MB/sec
Timing buffered disk reads:  x MB in  y seconds = z MB/sec
注意: 一次測試需要執行上述命令2-3次並手動計算平均值以便評估read speed per the hdparm man page.

Unigine 引擎[編輯 | 編輯原始碼]

Unigine公司基於他們的圖形引擎製造了多個現代的OpenGL評測,特性如下:

  • 像素動態照明
  • 普通和視差映射
  • 64位HDR渲染
  • 容積霧和光
  • 強大的粒子系統:火焰、煙、爆炸
  • 可擴展着色(GLSL/HLSL)
  • 後期處理:景深、折射、輝光、模糊、色彩校正等。

那些想超頻系統的目前在使用Unigine評測。Unigine天堂被用來測試超頻的初始穩定性。

可以在AUR找到這些評測(看下面的連結)。

請看:

gnome-disks[編輯 | 編輯原始碼]

There is a graphical benchmark called gnome-disks contained in the gnome-disk-utility package that will give min/max/ave reads along with average access time and a nice graphical display. This method is independent of partition alignment!

# gnome-disks

Users will need to navigate through the GUI to the benchmark button ("More actions..." => "Benchmark Volume..."). Example

systemd-analyze[編輯 | 編輯原始碼]

systemd-analyze plot > boot.svg

上述命令會把啟動順序畫一個詳細的圖,包括:kernel用的時間,用戶態時間,每個服務的時間。 Example

dd[編輯 | 編輯原始碼]

The dd utility can be used to measure both reads and writes. This method is dependent on partition alignment! In other words, if you failed to properly align your partitions, this fact will be seen here since you are writing and reading to a mounted filesystem.

注意: This method requires the command to be executed from a mounted partition on the device of interest!

First, enter a directory on the SSD with at least 1.1 GB of free space (and one that obviously gives your user wrx permissions) and write a test file to measure write speeds and to give the device something to read:

$ cd /path/to/SSD
$ dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc status=progress
1024+0 records in
1024+0 records out
w bytes (x GB) copied, y s, z MB/s
提示:See dd-benchmark for an explanation on the requirement to sync and further related dd options.

Next, clear the buffer-cache to accurately measure read speeds directly from the device:

# echo 3 > /proc/sys/vm/drop_caches
$ dd if=tempfile of=/dev/null bs=1M count=1024 status=progress
1024+0 records in
1024+0 records out
w bytes (x GB) copied, y s, z MB/s

Now that the last file is in the buffer, repeat the command to see the speed of the buffer-cache:

$ dd if=tempfile of=/dev/null bs=1M count=1024 status=progress
1024+0 records in
1024+0 records out
w bytes (x GB) copied, y s, z GB/s
注意: One should run the above command 4-5 times and manually average the results for an accurate evaluation of the buffer read speed.

Finally, delete the temp file

$ rm tempfile
注意: Some SSD controllers have compression hardware, which may skew benchmark results. See https://www.pugetsystems.com/labs/articles/SSDs-Advertised-vs-Actual-Performance-179/

See also dd.

dcfldd[編輯 | 編輯原始碼]

Dcfldd does not print the average speed in MB/s like good old dd does but with time you can work around that.

Time the run clearing the disk:

# time dcfldd if=/dev/zero of=/dev/sdX bs=4M
18944 blocks (75776Mb) written.dcfldd:: No space left of device
real     16m17.033s
user     0m0.377s
sys      0m51.160s

Calculate MB/s by dividing the output of the dcfldd command by the time in seconds. For this example: 75776Mb / (16.4 min * 60) = 77.0 MB/s.

軟件集[編輯 | 編輯原始碼]

Bonnie++[編輯 | 編輯原始碼]

bonnie++用C++重寫了原Bonnie評測集,主要測試硬盤和文件系統性能。

警告: By default, bonnie++ write at least twice the RAM size on disk. If you want to preserve your SSD, use non default option.
注意: 原Bonnie集不是以GPL或其他兼容許可證發佈。

請看:

IOzone[編輯 | 編輯原始碼]

IOzone用來測試文件系統性能。

AUR: iozoneAUR可以安裝該程序。

看看論壇帖子:iozone評估I/O調度... 結果並不是您期望的!

HardInfo[編輯 | 編輯原始碼]

hardinfoAUR可以收集系統硬件和作業系統信息,性能評測,生成HTML或純文本格式的可打印的報表。hardinfo評測CPU和FPU,有清爽的Gtk界面。

請看作者網站

Phoronix測試集[編輯 | 編輯原始碼]

Phoronix測試集是最全面測試和評測平台,提供可擴展的框架,添加新的測試很方便。該軟件可以有效地完成定性和定量評測,用起來很清爽、可復用、很簡單。

Phoronix測試集基於廣泛的測試,內部工具從2004年起由Phoronix.com開發,獲得一線硬件和軟件公司的支持。該軟件開源採用GPLv3。

原先開發用於Linux自動化測試,後來加入了OpenSolaris、蘋果 macOS、微軟 Windows 和 BSD 作業系統。Phoronix 測試集由輕量的處理核心(pts-core)組成,每個評測由基於XML的總述、相關的資源腳本組成。從安裝評測,到實際評測、到解析重要硬件和軟件組件,都是全自動化的,完全可復用的,僅詢問用戶是否執行操作。

Phoronix測試集使用OpenBenchmarking.org接口用於存儲測試結果,分享測試總述和結果,高級的分析特性,以及其他功能。Phoromatic是在多系統編排測試執行的企業組件,具有遠程管理的功能。

可以安裝phoronix-test-suiteAUR包。還有開發版phoronix-test-suite-gitAUR

S[編輯 | 編輯原始碼]

S, an I/O Benchmark Suite, is a small collection of scripts to measure storage I/O performance.

It has been developed by algodev, the team behind the BFQ scheduler.

Download or clone the project, install its dependencies and run it as root (privileges needed to change disk scheduler).

閃存介質[編輯 | 編輯原始碼]

iozoneAUR可以定量測試性能特點。連續的讀和寫,常被用來做I/O壓力測試,例如解壓縮,以及系統更新寫大量文件。相關指標是小文件隨機寫的速度。

該示例調用測試使用4K記錄大小操作10M文件:

$ iozone -e -I -a -s 10M -r 4k -i 0 -i 1 -i 2
...

                                                                random   random
              kB  reclen    write  rewrite    read    reread    read     write
           10240       4      661      649     5802     5822     3892      624
注意: 單位是KB/s。

參閱[編輯 | 編輯原始碼]