基准测试

来自 Arch Linux 中文维基
(重定向自Benchmarking

所谓基准测试,就是通过一个统一的流程来测试性能,并将其结果和其它系统测到的结果或一个被广泛接受的标准相比较的行为。这种计算系统性能的统一流程可以帮助解答一些问题,比如:

  • 系统是否发挥正常?
  • 应该用哪个版本的驱动以达到最佳性能?
  • 系统是否能够胜任某任务?

许多工具可以测试系统性能,下面列出可用的工具。

独立工具[编辑 | 编辑源代码]

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。

参阅[编辑 | 编辑源代码]