基准测试
所谓基准测试,就是通过一个统一的流程来测试性能,并将其结果和其它系统测到的结果或一个被广泛接受的标准相比较的行为。这种计算系统性能的统一流程可以帮助解答一些问题,比如:
- 系统是否发挥正常?
- 应该用哪个版本的驱动以达到最佳性能?
- 系统是否能够胜任某任务?
许多工具可以测试系统性能,下面列出可用的工具。
独立工具[编辑 | 编辑源代码]
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.