基準測試
所謂基準測試,就是通過一個統一的流程來測試性能,並將其結果和其它系統測到的結果或一個被廣泛接受的標準相比較的行為。這種計算系統性能的統一流程可以幫助解答一些問題,比如:
- 系統是否發揮正常?
- 應該用哪個版本的驅動以達到最佳性能?
- 系統是否能夠勝任某任務?
許多工具可以測試系統性能,下面列出可用的工具。
獨立工具[編輯 | 編輯原始碼]
UnixBench[編輯 | 編輯原始碼]
安裝 unixbenchAUR,在終端中運行 ubench 來開始測評。
另請閱讀:
- https://github.com/kdlucas/byte-unixbench
- https://github.com/kdlucas/byte-unixbench/blob/master/UnixBench/USAGE
interbench[編輯 | 編輯原始碼]
interbench 被設計用於測試 Linux 的交互性。它被用於測試修改 Linux 內核設計或系統配置後的效果,包括如 CPU,I/O 調度器和文件系統及參數的變更等。
可通過 AUR 獲取 interbench:interbenchAUR。
另請閱讀:
fio[編輯 | 編輯原始碼]
fio包 (Flexible I/O Tester) 是一個實用工具,可以幫助模擬多種不同的工作負載(比如多個線程使用異步 I/O 來發起讀請求)。Fio 會 spawn 一些線程或者進程來做用戶指定的一些特定種類的 I/O。Docs
示例用法:
# fio --filename=/mnt/test.fio --size=8GB --direct=1 --rw=randrw --bs=4k --ioengine=libaio --iodepth=256 --runtime=120 --numjobs=4 --time_based --group_reporting --name=iops-test-job --eta-newline=1
ttcp[編輯 | 編輯原始碼]
ttcp(Test TCP)測試任意網絡連接的 P2P 帶寬。需要在(被測試帶寬的)設備兩端都安裝該程序。
可以在 AUR 找到不同版本的 ttcp:
iperf[編輯 | 編輯原始碼]
iperf 是簡單的 P2P 帶寬測試工具,可以用於 TCP 或 UDP。它的輸出格式非常好,且帶有並發測試模式。
time[編輯 | 編輯原始碼]
time(1) 命令通過顯示某條命令從調用到終止之間的時間,提供命令運行的耗時統計信息。time包 包含了 time
命令,某些命令行解釋器也提供了 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
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
KDiskMark[編輯 | 編輯原始碼]
kdiskmark包 is an HDD and SSD benchmark tool with a very friendly graphical user interface. KDiskMark with its presets and powerful GUI calls Flexible I/O Tester and handles the output to provide an easy to view and interpret comprehensive benchmark result.
systemd-analyze[編輯 | 編輯原始碼]
$ systemd-analyze plot > boot.svg
上述命令會把啟動順序畫一個詳細的圖,包括:內核用的時間,用戶態時間,每個服務佔用的時間。參考示例
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.
First, enter a directory on the SSD with at least 1.1 GB of free space (and one that gives your user wrx permissions) and write a test file to measure write speeds and to give the device something to read:
$ dd if=/dev/zero of=/path/to/SSD/tempfile bs=1M count=1024 conv=fdatasync,notrunc status=progress
1024+0 records in 1024+0 records out v bytes (w MB, x MiB) copied, y s, z MB/s
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 v bytes (w MB, x MiB) 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 v bytes (w MB, x MiB) copied, y s, z MB/s
Finally, delete the temp file
$ rm tempfile
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.
7z[編輯 | 編輯原始碼]
7z benchmark command can be used to measure the CPU speed in MIPS and also to check RAM for errors. Just install p7zip and run the command below. More detailed information can be found at [1].
$ 7z b
peakperf[編輯 | 編輯原始碼]
peakperf-gitAUR is a microbenchmark that achieves peak performance on x86_64 CPUs. Some issues may reduce the performance provided by your CPU, like CPU cooling. With peakperf you can check if your CPU provides the full power it is capable of doing.
You can calculate the performance (measured in GFLOP/s) you should get using your CPU (see [2]) and compare it with the performance that peakperf gives you. If both values are the same (or very similar), your CPU behaves as it should.
cryptsetup[編輯 | 編輯原始碼]
cryptsetup benchmark can be used to measure the speed of various cryptographic algorithms (ciphers).
$ cryptsetup benchmark
軟件集[編輯 | 編輯原始碼]
Bonnie++[編輯 | 編輯原始碼]
bonnie++包 是用 C++ 重寫的原 Bonnie 測試集,主要測試硬盤和文件系統性能。
另請閱讀:
IOzone[編輯 | 編輯原始碼]
IOzone 用於測量計算機的文件系統大致性能。
另請查看論壇帖子:iozone 評估 I/O 調度... 結果並不是您期望的!。
HardInfo[編輯 | 編輯原始碼]
hardinfo2AUR 可以收集系統硬件和作業系統信息,測試系統性能,生成 HTML 或純文本格式的可打印報表。HardInfo 會測試 CPU 和 FPU,並有簡潔的 GTK 界面。
Phoronix 測試套件[編輯 | 編輯原始碼]
https://www.phoronix-test-suite.com/ Phoronix 測試套件]是目前最全面的測試和基準測試平台,它提供了一個可擴展的框架,可輕鬆添加新的測試。該軟件旨在以簡潔、可重現和易用的方式有效執行定性和定量基準測試。
Phoronix 測試套件基於 Phoronix.com 自 2004 年以來進行的大量測試和內部工具,並得到了主流計算機硬件和軟件供應商的支持。該軟件是開源軟件,採用 GNU GPLv3 許可。
Phoronix 測試套件最初是為 Linux 自動測試而開發的,後來增加了對 OpenSolaris、Apple macOS、Microsoft 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).
s-tui[編輯 | 編輯原始碼]
s-tui is an aesthetically pleasing and useful curses-style interface that shows graphs of CPU frequency, utilization, temperature, power consumption and has a built in stress tester.
sysbench[編輯 | 編輯原始碼]
sysbench包 is an all-round multi-threaded benchmark tool. Written in C and Perl, it can be used in CLI directly to benchmark filesystem, DRAM, CPU, thread-based scheduler and POSIX mutex performance. Or it can be used as Lua script interpreter to benchmark any arbitrarily complex workload. It provides a collection of scripts for database benchmarks.
閃存介質[編輯 | 編輯原始碼]
可通過 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
Graphics[編輯 | 編輯原始碼]
Basemark GPU[編輯 | 編輯原始碼]
Basemark GPU is an evaluation tool to analyze and measure graphics API (OpenGL 4.5, OpenGL ES 3.1, Vulkan and Microsoft DirectX 12) performance across mobile and desktop platforms. Basemark GPU targets both Desktop and Mobile platforms by providing both High Quality and Medium Quality modes. The High-Quality mode addresses cutting-edge Desktop workloads while the Medium Quality mode addresses equivalent Mobile workloads.
If you are using AMD GPU and have several vulkan implementations installed simultaneously, in the Test page you will see them as separate GPUs in Graphics Device dropdown list.
Basemark GPU is available in basemarkAUR package.
Blender-benchmark[編輯 | 編輯原始碼]
Blender-benchmark will gather information about the system, such as operating system, RAM, graphics cards, CPU model, as well as information about the performance of the system during the execution of the benchmark. After that, the user will be able to share the result online on the Blender Open Data platform, or to save the data locally.
Blender-benchmark is available in the blender-benchmarkAUR package.
GFXBench[編輯 | 編輯原始碼]
GFXBench is a high-end graphics benchmark that measures mobile and desktop performance with next-gen graphics features across all platforms. As a true cross-API benchmark, GFXBench supports all the industry-standard and vendor-specific APIs including OpenGL, OpenGL ES, Vulkan, Metal, DirectX/Direct3D and DX12.
Vulkan API tests are currently under development and are only available for their corporate partners.
GFXBench is available in gfxbenchAUR package.
glmark2[編輯 | 編輯原始碼]
glmark2 is an OpenGL 2.0 and ES 2.0 benchmark.
glmark2 is available in glmark2包 package.
glxgears[編輯 | 編輯原始碼]
glxgears 是一款流行的 OpenGL 測試工具,它可以渲染非常簡單的 OpenGL 測試並輸出幀數。雖然 glxgears 可以測試圖形驅動程序的直接渲染能力,但它是一個過時的工具,不能代表 GNU/Linux 圖形顯示的現狀和 OpenGL 的整體能力。glxgears 僅測試了遊戲中可能用到的一小部分 OpenGL 功能,因此在 glxgears 中記錄到的性能提升可能無法在遊戲中被體現出來。更多信息請參見這裏。
可通過 mesa-utils包 或 lib32-mesa-utils包(適用於 multilib)獲取 glxgears。
GpuTest[編輯 | 編輯原始碼]
GpuTest is a cross-platform (Windows, Linux and Max OS X) GPU stress test and OpenGL benchmark. GpuTest comes with several GPU tests including some popular ones from Windows'world (FurMark or TessMark).
GpuTest is available in gputestAUR package.
intel-gpu-tools[編輯 | 編輯原始碼]
intel-gpu-tools gives you some top-like info for the integrated GPU. This can be quite useful in diagnosing GPU acceleration issues.
To use it, install the intel-gpu-tools包 package.
MangoHud[編輯 | 編輯原始碼]
See MangoHud.
Unigine 引擎[編輯 | 編輯原始碼]
Unigine 公司基於他們的圖形引擎製造了多個現代化 OpenGL 基準測試,特性如下:
- 像素動態光照
- 普通和視差映射
- 64 位 HDR 渲染
- 體積霧和光
- 強大的粒子系統:火焰、煙、爆炸
- 可擴展着色(GLSL/HLSL)
- 後處理:景深、折射、輝光、模糊、色彩校正等。
最近,Unigine 開始基準被對系統進行超頻的用戶所使用。尤其是 Heaven 被用於超頻的初始穩定性測試。
可以在 AUR 找到這些基準測試:
- unigine-sanctuaryAUR (2007)
- unigine-tropicsAUR (2008)
- unigine-heavenAUR (2009)
- unigine-valleyAUR (2013)
- unigine-superpositionAUR (2017)
vkmark[編輯 | 編輯原始碼]
vkmark is an extensible Vulkan benchmarking suite with targeted, configurable scenes.
vkmark is available in vkmark包 package.