可用于对计算机系统进行多方面压力测试,以检测硬件问题和操作系统漏洞,还能测量测试吞吐量。具备360多种压力测试,涵盖CPU、虚拟内存、文件系统等,支持多操作系统和硬件架构,功能全面且可移植。【此简介由AI生成】
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 |
stress-ng(下一代压力测试工具)
stress-ng 能以多种可选方式对计算机系统进行压力测试。它专为检验计算机各物理子系统及操作系统内核接口而设计,具备以下特性:
- 360+ 种压力测试场景
- 100+ 种 CPU 专项测试:覆盖浮点运算、整数运算、位操作及控制流
- 60+ 种虚拟内存压力测试
- 80+ 种文件系统压力测试
- 50+ 种内存/CPU缓存压力测试
- 跨平台支持:兼容 Linux(Debian、Devuan、RHEL、Fedora、CentOS、Slackware、OpenSUSE、Ubuntu 等)、Solaris、FreeBSD、NetBSD、OpenBSD、DragonFlyBSD、Minix、Android、macOS X、Serenity OS、GNU/Hurd、Haiku、Windows Subsystem for Linux、Cygwin 及 SunOS/Dilos/Solaris 支持 gcc、musl-gcc、clang、icc、icx、tcc 和 pcc 编译器
- 通过 alpha、armel、armhf、arm64、hppa、i386、loong64、m68k、mips32、mips64、power32、ppc64el、risc-v、sh4、s390x、sparc64、x86-64 架构验证
stress-ng 最初旨在通过高强度负载暴露硬件问题(如过热保护失效)及仅在系统满负荷运行时出现的操作系统缺陷。使用时需谨慎:部分测试可能导致设计不良的硬件过热运行,并引发难以终止的系统资源耗尽。
该工具还可测量测试吞吐率,有助于观察不同操作系统版本或硬件类型的性能变化。但请注意,它并非为精准基准测试而设计,请勿将其用于此类用途。
在 Linux 系统以 root 权限运行时,stress-ng 会调整内存不足设置使压力测试进程在低内存环境下不可终止,请审慎使用。具备相应权限时,还可调节 ionice 类别与优先级级别,此功能同样需谨慎操作。
在容器中运行最新 stress-ng 快照
docker run --rm ghcr.io/colinianking/stress-ng --help
或
docker run --rm colinianking/stress-ng --help
适用于 Ubuntu 的 Debian 软件包
最新版本的 stress-ng 已通过 Ubuntu stress-ng PPA 为各版本 Ubuntu 提供支持:
https://launchpad.net/~colin-king/+archive/ubuntu/stress-ng
sudo add-apt-repository ppa:colin-king/stress-ng
sudo apt update
sudo apt install stress-ng
构建 stress-ng
为确保构建功能完整的 stress-ng,需要以下依赖库(注意:较新的发行版不再需要 libattr)。
Debian/Ubuntu:
- gcc g++ libacl1-dev libaio-dev libapparmor-dev libatomic1 libattr1-dev libbsd-dev libcap-dev libeigen3-dev libgbm-dev libcrypt-dev libglvnd-dev libipsec-mb-dev libjpeg-dev libjudy-dev libkeyutils-dev libkmod-dev libmd-dev libmpfr-dev libsctp-dev libxxhash-dev zlib1g-dev
RHEL/Fedora/Centos:
- gcc g++ eigen3-devel Judy-devel keyutils-libs-devel kmod-devel libacl-devel libaio-devel libatomic libattr-devel libbsd-devel libcap-devel libgbm-devel libcrypt-devel libglvnd-core-devel libglvnd-devel libjpeg-devel libmd-devel mpfr-devel libX11-devel libXau-devel libxcb-devel lksctp-tools-devel xorg-x11-proto-devel xxhash-devel zlib-devel
RHEL/Fedora/Centos(静态构建):
- gcc g++ eigen3-devel glibc-static Judy-devel keyutils-libs-devel libacl-devel libaio-devel libatomic-static libattr-devel libbsd-devel libcap-devel libgbm-devel libcrypt-devel libglvnd-core-devel libglvnd-devel libjpeg-devel libmd-devel libX11-devel libXau-devel libxcb-devel lksctp-tools-devel mpfr-devel xorg-x11-proto-devel xxhash-devel zlib-devel
SUSE:
- gcc gcc-c++ eigen3-devel keyutils-devel libaio-devel libapparmor-devel libatomic1 libattr-devel libbsd-devel libcap-devel libgbm-devel libglvnd-devel libjpeg-turbo libkmod-devel libmd-devel libseccomp-devel lksctp-tools-devel mpfr-devel xxhash-devel zlib-devel
ClearLinux:
- devpkg-acl devpkg-eigen devpkg-Judy devpkg-kmod devpkg-attr devpkg-libbsd devpkg-libjpeg-turbo devpkg-libsctp devpkg-mesa
Alpine Linux:
- build-base eigen-dev jpeg-dev judy-dev keyutils-dev kmod-dev libacl-dev libaio-dev libatomic libattr libbsd-dev libcap-dev libmd-dev libseccomp-dev lksctp-tools-dev mesa-dev mpfr-dev xxhash-dev zlib-dev
注意:
构建时会自动检测依赖项。若缺少支持库,相关功能将被禁用。stress-ng 会根据目标系统的内核特性动态启用对应的压力测试模块。
该工具已在以下系统通过构建测试:
Ubuntu、Debian、Debian GNU/Hurd、Slackware、RHEL、SLES、Centos、kFreeBSD、OpenBSD、NetBSD、FreeBSD、Debian kFreeBSD、DragonFly BSD、macOS、Minix、Solaris 11.3、OpenIndiana 和 Haiku。移植到其他类 UNIX/POSIX 系统应较为容易。
重要提示:
从 git 仓库拉取更新后,务必执行 make clean 以强制重新生成构建配置文件。支持使用 make -j 进行并行编译。
BSD 系统构建要求:
需安装 gcc 和 GNU make。
CC=gcc gmake clean
CC=gcc gmake
要在 OS X 系统上进行构建,只需使用:
make clean
make -j
要在 MINIX 上进行开发,需要安装 gmake 和 clang:
CC=clang gmake clean
CC=clang gmake
要在 SunOS 上构建,需要 GCC 和 GNU make,使用以下命令进行构建:
CC=gcc gmake clean
CC=gcc gmake
要在 Dilos 上进行构建,您需要 GCC 和 GNU make,并通过以下命令进行构建:
CC=gcc gmake clean
CC=gcc gmake
基于 Haiku R1/beta5 构建:
# GCC
make clean
make
# Clang
CC=clang make clean
CC=clang make
要构建静态镜像(例如用于 Android),请使用:
# path to Android NDK
# get NDK from https://developer.android.com/ndk/downloads
export NDK=$HOME/android-ndk-r27c
export PATH=$PATH:$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
export TARGET=aarch64-linux-android
# Define Android API level
export API=27
export CC=$TARGET$API-clang
make clean
STATIC=1 make
使用 Tiny C 编译器进行构建:
make clean
CC=tcc make
要使用 PCC 便携式 C 编译器构建,请执行以下操作:
make clean
CC=pcc make
使用 musl C 库进行构建:
make clean
CC=musl-gcc
要使用英特尔 C 编译器 icc 进行构建,请执行以下操作:
make clean
CC=icc make
要使用 Intel C 编译器 icx 进行构建,请执行以下操作:
make clean
CC=icx make
要使用 gcc 进行交叉编译,需采用静态构建方式,并指定工具链(包括 CC 和 CXX)。例如,一个 mips64 交叉编译的示例如下:
make clean
STATIC=1 CC=mips64-linux-gnuabi64-gcc CXX=mips64-linux-gnuabi64-g++ make -j $(nproc)
要为 QNX 进行交叉编译,例如构建一个 aarch64 平台的 QNX 交叉编译环境:
make clean
CC=aarch64-unknown-nto-qnx7.1.0-gcc CXX=aarch64-unknown-nto-qnx7.1.0-g++ STATIC=1 make
生成手册的 PDF 版本(需安装 ps2pdf)
make pdf
构建选项:DEBUG,启用调试模式(-g)进行编译:
make clean
DEBUG=1 make
构建选项:LTO(链接时优化,对计算密集型负载可带来约1-2%的性能提升):
make clean
LTO=1 make
构建选项:PEDANTIC,启用严格构建标志:
make clean
PEDANTIC=1 make
构建选项:GARBAGE_COLLECT,提示未使用的代码:
make clean
GARBAGE_COLLECT=1 make
构建选项:UNEXPECTED=1,用于警告意外的#ifdef排除代码:
make clean
UNEXPECTED=1 make
构建选项:SOURCE_DATE_EPOCH=自纪元以来的秒数,用于添加构建日期
make clean
SOURCE_DATE_EPOCH=1750685870 make
构建选项:EXTRA_BUILDINFO=1,将 CFLAGS、CXXFLAGS 和 LDFLAGS 添加到 --buildinfo 选项中
注意:这可能导致构建信息泄露,不建议在任何发行版发布中使用。
make clean
EXTRA_BUILDINFO=1 make -j 10
为 stress-ng 贡献代码:
请将补丁发送至 colin.i.king@gmail.com 或在 https://github.com/ColinIanKing/stress-ng 提交合并请求
快速入门参考指南
Ubuntu stress-ng 参考指南 提供了简要概述和实用示例。
示例
运行 4 个 CPU、2 个虚拟内存、1 个磁盘和 8 个 fork 压力测试 2 分钟并打印测量结果:
stress-ng --cpu 4 --vm 2 --hdd 1 --fork 8 --timeout 2m --metrics
stress-ng: info: [573366] setting to a 120 second (2 mins, 0.00 secs) run per stressor
stress-ng: info: [573366] dispatching hogs: 4 cpu, 2 vm, 1 hdd, 8 fork
stress-ng: info: [573366] successful run completed in 123.78s (2 mins, 3.78 secs)
stress-ng: info: [573366] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s CPU used per
stress-ng: info: [573366] (secs) (secs) (secs) (real time) (usr+sys time) instance (%)
stress-ng: info: [573366] cpu 515396 120.00 453.02 0.18 4294.89 1137.24 94.42
stress-ng: info: [573366] vm 2261023 120.01 223.80 1.80 18840.15 10022.27 93.99
stress-ng: info: [573366] hdd 367558 123.78 10.63 11.67 2969.49 16482.42 18.02
stress-ng: info: [573366] fork 598058 120.00 68.24 65.88 4983.80 4459.13 13.97
在所有在线 CPU 上运行矩阵压力测试 60 秒并测量温度:
stress-ng --matrix -1 --tz -t 60
stress-ng: info: [1171459] setting to a 60 second run per stressor
stress-ng: info: [1171459] dispatching hogs: 8 matrix
stress-ng: info: [1171459] successful run completed in 60.01s (1 min, 0.01 secs)
stress-ng: info: [1171459] matrix:
stress-ng: info: [1171459] acpitz0 75.00 C (348.15 K)
stress-ng: info: [1171459] acpitz1 75.00 C (348.15 K)
stress-ng: info: [1171459] pch_skylake 60.17 C (333.32 K)
stress-ng: info: [1171459] x86_pkg_temp 62.72 C (335.87 K)
运行4种I/O压力测试的组合,并检查磁盘S.M.A.R.T.元数据的变化:
sudo stress-ng --iomix 4 --smart -t 30s
stress-ng: info: [1171471] setting to a 30 second run per stressor
stress-ng: info: [1171471] dispatching hogs: 4 iomix
stress-ng: info: [1171471] successful run completed in 30.37s
stress-ng: info: [1171471] Device ID S.M.A.R.T. Attribute Value Change
stress-ng: info: [1171471] sdc 01 Read Error Rate 88015771 71001
stress-ng: info: [1171471] sdc 07 Seek Error Rate 59658169 92
stress-ng: info: [1171471] sdc c3 Hardware ECC Recovered 88015771 71001
stress-ng: info: [1171471] sdc f1 Total LBAs Written 481904395 877
stress-ng: info: [1171471] sdc f2 Total LBAs Read 3768039248 5139
stress-ng: info: [1171471] sdd be Temperature Difference 3670049 1
利用 VDSO 进行系统调用基准测试:
stress-ng --vdso 1 -t 5 --metrics
stress-ng: info: [1171584] setting to a 5 second run per stressor
stress-ng: info: [1171584] dispatching hogs: 1 vdso
stress-ng: info: [1171585] stress-ng-vdso: exercising vDSO functions: clock_gettime time gettimeofday getcpu
stress-ng: info: [1171585] stress-ng-vdso: 9.88 nanoseconds per call (excluding 1.73 nanoseconds test overhead)
stress-ng: info: [1171584] successful run completed in 5.10s
stress-ng: info: [1171584] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s CPU used per
stress-ng: info: [1171584] (secs) (secs) (secs) (real time) (usr+sys time) instance (%)
stress-ng: info: [1171584] vdso 430633496 5.10 5.10 0.00 84375055.96 84437940.39 99.93
stress-ng: info: [1171584] vdso 9.88 nanoseconds per call (average per stressor)
生成并利用 perf 性能指标测量分支预测失误:
sudo stress-ng --branch 1 --perf -t 10 | grep Branch
stress-ng: info: [1171714] 604,703,327 Branch Instructions 53.30 M/sec
stress-ng: info: [1171714] 598,760,234 Branch Misses 52.77 M/sec (99.02%)
在 ZFS 文件系统上运行 I/O 压力源的排列组合,排除带有内核日志错误检查的 rawdev 压力源:
stress-ng --class io --permute 0 -x rawdev -t 1m --vmstat 1 --klog-check --temp-path /zfs-pool/test
仅限 x86 架构:通过 RAPL 接口测量 8 个并行 3D 矩阵压力测试器的功耗,并启用验证功能。 请注意,读取 RAPL 数据需要 root 权限。
sudo stress-ng --matrix-3d 8 --matrix-3d-size 512 --rapl -t 10 --verify
stress-ng: info: [4563] setting to a 10 secs run per stressor
stress-ng: info: [4563] dispatching hogs: 8 matrix-3d
stress-ng: info: [4563] matrix-3d:
stress-ng: info: [4563] core 6.11 W
stress-ng: info: [4563] dram 2.71 W
stress-ng: info: [4563] pkg-0 8.20 W
stress-ng: info: [4563] psys 16.90 W
stress-ng: info: [4563] uncore 0.06 W
stress-ng: info: [4563] skipped: 0
stress-ng: info: [4563] passed: 8: matrix-3d (8)
stress-ng: info: [4563] failed: 0
stress-ng: info: [4563] metrics untrustworthy: 0
stress-ng: info: [4563] successful run completed in 11.38 secs
测量 C-state 驻留时间:
stress-ng --intmath 0 -t 1m --c-states
stress-ng: info: [6998] setting to a 1 min run per stressor
stress-ng: info: [6998] dispatching hogs: 8 intmath
stress-ng: info: [6998] intmath:
stress-ng: info: [6998] C0 99.98%
stress-ng: info: [6998] C1 0.00%
stress-ng: info: [6998] C1E 0.01%
stress-ng: info: [6998] C3 0.00%
stress-ng: info: [6998] C6 0.01%
stress-ng: info: [6998] C7s 0.00%
stress-ng: info: [6998] C8 0.00%
stress-ng: info: [6998] POLL 0.00%
stress-ng: info: [6998] skipped: 0
stress-ng: info: [6998] passed: 8: intmath (8)
stress-ng: info: [6998] failed: 0
stress-ng: info: [6998] metrics untrustworthy: 0
stress-ng: info: [6998] successful run completed in 1 min
通过 stress-ng 发现的漏洞与回归问题
stress-ng 已帮助识别出多项内核、QEMU 的漏洞/回归问题以及 libc 缺陷,相关修复方案均已落地:
2015年:
2016年:
- fs/locks.c: POSIX 锁压力测试期间的内核异常
- sched/core: 修复 try_to_wake_up() 与被唤醒任务间的竞争
- devpts: 修复内存分配失败时的空指针解引用
- arm64: 不再强制要求栈指针严格 16 字节对齐
2017年:
- ARM: dts: meson8b: 添加保留内存区域以修复静默冻结
- ARM64: dts: meson-gx: 添加固件保留内存区域
- ext4: 在校验 xattr 块前锁定它
- rcu_preempt 检测到 CPU/任务停滞
- BUG: 无法处理内核空指针解引用
- 警告: 检测到可能的循环锁依赖
2018年:
- Illumos: ofdlock(): 断言失败: lckdat->l_start == 0
- debugobjects: 在 __debug_check_no_obj_freed() 中使用全局空闲列表
- ext4_validate_inode_bitmap:99: comm stress-ng: 损坏的 inode 位图
- virtio/s390: 修复 ccw_io_helper() 中的竞争
2019年:
- mm/page_idle.c: 修复因 end_pfn 大于 max_pfn 导致的异常
- mm: compaction: 避免任务被终止时压缩过程占用 100% CPU
- mm/vmalloc.c: 为拆分操作预加载单个对象的 CPU
- perf evlist: 在 sb 线程中使用 unshare(CLONE_FS) 以支持 setns(CLONE_NEWNS)
- riscv: 拒绝低于 -1 的无效系统调用
2020年:
- RISC-V: 禁止在 mmap 中请求仅写+执行的页面映射
- riscv: 将 max_pfn 设置为最后一页的 PFN
- crypto: hisilicon - 更新 SEC 驱动模块参数
- net: atm: 修复 lec_seq_next 中位置索引的更新
- sched/debug: 修复多次小规模读取标志导致的内存损坏
- ocfs2: 限制“达到最大查找次数”通知的频率
- 使用 perf 可能导致内核因栈溢出崩溃
- 在启用 gcov 的 focal 内核上运行 stress-ng 触发 OOPS
- s390x 上 stress-ng mknod 和 stress-ng symlink 导致的内核 list_del 损坏错误
2021年:
- sparc64: 修复无故障加载操作码过滤
- 在不支持 O_DIRECT 的文件系统上以 O_DIRECT 打开文件会留下空文件
- locking/atomic: sparc: 修复 arch_cmpxchg64_local()
- btrfs: 修复因并发分配导致的系统块数组耗尽
- btrfs: 重构块分配以避免系统块数组耗尽
- btrfs: 修复涉及系统块的并发块分配导致的死锁
- locking/atomic: sparc: 修复 arch_cmpxchg64_local()
- pipe: 为每次管道 IO 执行 FASYNC 通知,而非仅状态变更
- io-wq: 从调度路径移除 GFP_ATOMIC 分配
- mm/swap: 在 iomap_swapfile_add_extent 中考虑最大页数
- block: loop: 修复打开与移除间的死锁
- tmpfs: O_DIRECT | O_CREATE 打开报告失败但实际创建了文件
2022年:
- copy_process(): 将 fd_install() 移出 sighand->siglock 临界区
- minix: 修复以 O_DIRECT 打开文件时的错误
- arch/arm64: 修复核心调度的拓扑初始化
- 在 amd64 的 Minux 3.4.0-RC6 上运行 stress-ng 触发 vm/region.c:313 断言
- unshare 测试触发未处理的页错误
- request_module 拒绝服务攻击
- Linux 5.18 中的 NUMA 基准测试回归
- mas_spanning_rebalance() 及其测试中的下溢
- mm/huge_memory: THP 拆分时不破坏 swp_entry_t
- AppArmor: 因提交导致 stress-ng.kill.ops_per_sec 下降 42.5%
- clocksource: 检测到高读取延迟时临时挂起看门狗
2023年:
- qemu-system-m68k 在操作码 0x4848 时出现段错误
- rtmutex:确保始终唤醒最高优先级等待者
- mm/swap:修复 swapoff 与 get_swap_pages() 之间的 swap_info_struct 竞争条件
- block, bfq:修复零 wsum 时的除零错误
- riscv: mm:确保 VM_WRITE 和 VM_EXEC 的权限必须可读
- 撤销 "mm: vmscan: 使全局 slab 收缩无锁化"
- 在运行 stress-ng 时,mm/swapfile.c:718 add_to_avail_list 出现崩溃/挂起
- mm:修复 zswap 回写竞争条件
- x86/fpu:在 CR4 中启用 OSXSAVE 后设置 X86_FEATURE_OSXSAVE 特性
- kernel/fork:注意 __put_task_struct() 的调用上下文
- arm64: dts: ls1028a:添加 L1 和 L2 缓存信息
- filemap:添加 filemap_map_order0_folio() 以处理 order0 folio
- mm: shrinker:为动态分配 shrinker 添加基础设施
- mm: shrinker:使全局 slab 收缩无锁化
- bcachefs:在节点重用或驱逐时清除 btree_node_just_written()
- tracing:修复禁用缓冲事件时的不完整锁定
- mm: migrate:修复页面迁移期间获取错误页面映射的问题
- mm: mmap:将 MAP_STACK 映射到 VM_NOHUGEPAGE
2024:
- fs:增强 dump_mapping() 的鲁棒性
- tracing:确保在 tracing_map 中插入元素时的可见性
- connector/cn_proc:撤销 "connector: 修复 proc_event_num_listeners 计数未清除"
- powerpc/pseries:修复被盗时间的准确性
- OpenBSD: libm: sincosl 中的段错误
- 在 QEMU KVM 实例中打开和关闭 /dev/dri/card0 会导致系统关闭,6.10.0-rc6+
- uprobes:防止在 rcu_read_lock() 下调用 mutex_lock()
- RT 内核在 amd64 上导致系统锁死
- 警告:CPU: 17 PID: 118273 at kernel/sched/deadline.c:794 setup_new_dl_entity+0x12c/0x1e8
- 6.8.1-1002-realtime 内核中 pick_next_task_fair 的内核 oops
- 6.8.1-1002-realtime 内核中 aafs_create 的内核 oops
- mm:优化冗余循环
- MultiVM - 运行 stress-ng 的 L2 客户机在触发崩溃后启动时卡住
- powerpc/qspinlock:修复 MCS 队列中的死锁
- ext4 和 ea_inode 挂载标志以及测试 xattrs 时的内核回归
- sched_ext:TASK_DEAD 任务必须在 ops_enable 时切换到 SCX
- sched/deadline:修复 task_struct 引用泄漏
- sched_ext:按 NUMA 节点拆分全局 DSQ
- 使用未对齐地址调用 getcpu 导致内核恐慌
- cygwin: pread/pwrite:防止 fork() 后出现 EBADF 错误
- cygwin 3.5.4-1:信号处理破坏 'long double' 值
- cygwin: timer_delete:修复返回值
- cygwin:修改 pthread_sigqueue() 以接受线程 ID
- security/keys:修复 key_task_permission 中的 slab 越界
- sched_ext:不要长时间持有 scx_tasks_lock
- sched/numa:修复 task_numa_work() 中的潜在空指针解引用
- reiserfs 使用 fsize stressor 时出现恐慌
- soft-lockups: mm/page_alloc:在 __drain_all_pages() 中添加 cond_resched]
- can: m_can:修复 m_can_pci 中的中断丢失
- sched/deadline:修复 migrate_enable 中对增强任务的警告
- iomap:从部分 eof 零范围中省略刷新
- 两次打开 /dev/snapshot 导致 oops
- Cygwin: cygwin 3.5.4-1:lockf() 在重叠时中止且溢出时不失败
- Cygwin: cygwin 3.5.4-1:信号处理破坏 'long double' 值
- Cygwin: pthread_sigqueue() 或 sigtimewait() 中的段错误
- Cygwin: stress-ng --lockmix 1 崩溃并显示 *** 致命错误 - NtCreateEvent(lock): 0xC0000035
- Cygwin: 在多次 SIGCONT/SIGSTOP 信号后,SIGKILL 可能不再有效
2025:
- Tegra 安全引擎驱动改进
- sched_ext: 修复 dispatch_to_local_dsq() 中的锁不平衡问题
- mm/zswap: 修复 zswap_store_page() 失败时的不一致问题
- LoongArch: 将 max_pfn 设置为最后一页的 PFN
- net: ipv4: 修复 flowi4_init_output 中的目标地址确定问题
- Cygwin: 线程中使用 mq_send()/mq_receive() 可能永不返回
- Cygwin: mq_send(-1, ...) 段错误而非返回 EBADF
- Cygwin: 当 x86 方向标志设置时信号到达导致 STATUS_HEAP_CORRUPTION
- Cygwin: 打开过多 "/dev/ptmx" 后未设置 errno
- Cygwin: strace: 段错误时无限异常 c0000005 循环
- Cygwin: 多次 SIGILL 或 SIGSEGV 后挂起或崩溃及 siglongjmp
- binder: 修复 binderfs_evict_inode() 中的释放后使用问题
使用 stress-ng 改进的内核
2020年:
- selinux: 完成 hashtab 函数的内联
- selinux: 在哈希表中存储角色转换
- sched/rt: 优化检查组 RT 调度器约束
- sched/fair: 处理 task_h_load() 返回 0 的情况
- sched/deadline: 在入队时解除 PI 提升线程的节流
- mm: 修复 madvise WILLNEED 性能问题
- powerpc/dma: 修复 dma_map_ops::get_required_mask
- stress-ng close 导致内核 oops(es) v5.6-rt 和 v5.4-rt
2021年:
- 撤销 "mm, slub: 如果 acquire_slab() 失败则考虑剩余部分列表"
- mm: memory: 在 struct vm_fault 中添加 orig_pmd
- selftests/powerpc: 添加缓解补丁测试
- dm crypt: 避免 crypt_page_alloc() 中的 percpu_counter 自旋锁争用
- mm/migrate: 优化热插拔时的降级顺序更新
- powerpc/rtas: rtas_busy_delay() 改进
2022年:
2023年:
- mm/swapfile: 在 get_swap_pages() 中添加 cond_resched()
- module: 添加调试统计以帮助识别内存压力
- module: 如果模块已存在且就绪则避免分配
- sched: 交错 cfs 带宽定时器以改善低利用率下的单线程性能
- mm/khugepaged: 移除冗余的 try_to_freeze()
2024年:
- mm/vmalloc: 将锁争用从两次减少到一次
- mm: 将 mm->get_unmapped_area() 切换为标志
- mm: 当 CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=y 时始终内联 _compound_head()
- mm: 优化 mm_update_owner_next() 的冗余循环
2025年:
- sched: 为多个系统调用添加 unlikely 分支提示
- mm/mincore: 通过添加 unlikely 提示提高性能
- select: do_pollfd: 为返回路径添加 unlikely 分支提示
- select: core_sys_select 为返回路径添加 unlikely 分支提示
感谢提供关于使用 stress-ng 发现的内核错误或性能退化的信息。
演讲资料
文献引用
贡献者
衷心感谢以下为stress-ng作出贡献的开发者(按字母顺序排列):
阿卜杜勒·哈利姆、阿布瓦·德瓦拉詹、阿德里安·马丁、阿德里安·拉提乌、 亚历山大·N·科斯塔迪诺夫、亚历山大·卡纳文、亚历山德鲁·阿尔德莱安、 阿方索·桑切斯-贝亚托、艾伦·H、阿米特·辛格·托马尔、安德烈·格尔曼、 安德烈·维尔德、阿尼斯·阿斯蒂尔、安东·埃利亚松、阿尔扬·范德文、 巴鲁克·西亚赫、布莱恩·W·刘易斯、卡米耶·康斯坦斯、卡洛斯·桑托斯、 克里斯蒂安·埃哈特、克里斯蒂安·弗兰克、克里斯托弗·布朗、 胡春雨、丹尼尔·安德里埃斯、丹尼尔·霍奇斯、达尼洛·克鲁姆里奇、 戴维森·弗朗西斯、大卫·特纳、丹尼斯·奥夫西延科、德米特里·安季波夫、 德米特里·格兰德、多米尼克·B·恰尔诺塔、多林达·巴西、埃德尔·祖利安、 埃里克·林、埃里克·斯塔尔曼、埃尔万·维卢、法比安·马尔福、 法布里斯·方丹、费尔南·西贝尔、费扎·因德里特、弗洛里安·魏默、 弗朗西斯·拉尼尔、吉列尔梅·扬扎克、王辉、谢增申、 伊扬·门德斯·维加、伊万·沙波瓦洛夫、詹姆斯·亨特、扬·吕贝、 杰西·黄、刘建深、吉米·何、约翰·卡库尔、朱莉、朱尔斯·马塞尔巴斯、 朱利安·奥利文、龚肯尼、哈立德·埃尔穆苏利、赫姆·拉吉、卢卡·皮扎米利奥、 路易斯·张伯伦、路易斯·亨里克斯、卢卡斯·杜尔菲纳、马泰奥·意大利、 马修·蒂佩特、毛里西奥·法里亚·德奥利韦拉、马克西姆·舍瓦利耶、 马克斯·凯勒曼、玛雅·拉希什、马尤雷什·奇塔莱、梅萨姆·阿扎德、 迈克·科伦内夫、宗村方久、米德·夏、尼克·汉利、尼古拉斯·布顿、 尼科拉斯·基克斯、保罗·门策尔、皮尤什·戈亚尔、拉尔夫·拉姆绍尔、罗森·佩涅夫、 黄汝林、萨沙·豪尔、谢尔盖·费多罗夫、谢尔盖·马秋克维奇、 西德什·波亚雷卡、肖伊利·拉赫曼、多米尼克·斯坦伯格、 斯蒂安·奥纳海姆、塔德乌·利马·德索萨·卡斯卡多、蒂亚·怀罗德、特兰·廷、 蒂姆·加德纳、蒂姆·盖茨、蒂姆·奥林、托米·兰塔拉、维托尔德·巴里卢克、 林毅伟、王永轩、孙志毅、李宗。