Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

stress-ng

> 测试质量
Open source

This is the stress-ng upstream project git repository. stress-ng will stress test a computer system in various selectable ways. It was designed to exercise var

2.7K stars0 likes3 views
WebsiteGitHub

About

This is the stress-ng upstream project git repository. stress-ng will stress test a computer system in various selectable ways. It was designed to exercise var

stress-ng (stress next generation)

stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces. Stress-ng features:

  • 380+ stress tests
  • 100+ CPU specific stress tests that exercise floating point, integer, bit manipulation and control flow
  • 60+ virtual memory stress tests
  • 80+ file system stress tests
  • 50+ memory/CPU cache stress tests
  • portable: builds on Linux (Debian, Devuan, RHEL, Fedora, Centos, Slackware OpenSUSE, Ubuntu, etc..), Solaris, FreeBSD, NetBSD, OpenBSD, DragonFlyBSD, Minix, Android, MacOS X, Serenity OS, GNU/Hurd, Haiku, Windows Subsystem for Linux, Cygwin and SunOs/Dilos/Solaris. with gcc, musl-gcc, clang, icc, icx, tcc and pcc.
  • tested on Alpha, ARMEL, ARMHF, ARM64, HPPA, i386, loong64, M68k, MIPS32, MIPS64, OpenRisc (OR1K), Power32, PPC64el, RISC-V, sh4, s390x, SPARC64, VAX (on NetBSD) x86-64

stress-ng was originally intended to make a machine work hard and trip hardware issues such as thermal overruns as well as operating system bugs that only occur when a system is being thrashed hard. Use stress-ng with caution as some of the tests can make a system run hot on poorly designed hardware and also can cause excessive system thrashing which may be difficult to stop.

stress-ng can also measure test throughput rates; this can be useful to observe performance changes across different operating system releases or types of hardware. However, it has never been intended to be used as a precise benchmark test suite, so do NOT use it in this manner.

Running stress-ng with root privileges will adjust out of memory settings on Linux systems to make the stressors unkillable in low memory situations, so use this judiciously. With the appropriate privilege, stress-ng can allow the ionice class and ionice levels to be adjusted, again, this should be used with care.

Sponsoring the project

stress-ng is free and will always be free. Sponsoring the project is a great way to help pay for the running costs (hardware, power, etc) to support the development process.

Sponsor link: https://github.com/sponsors/ColinIanKing

Running latest stress-ng snapshot in a container

bash
docker run --rm ghcr.io/colinianking/stress-ng --help

or

bash
docker run --rm colinianking/stress-ng --help

Debian packages for Ubuntu

Recent versions of stress-ng are available in the Ubuntu stress-ng ppa for various Ubuntu releases:

https://launchpad.net/~colin-king/+archive/ubuntu/stress-ng

bash
sudo add-apt-repository ppa:colin-king/stress-ng
sudo apt update
sudo apt install stress-ng

Building stress-ng

To build, the following libraries will ensure a fully functional stress-ng build: (note libattr is not required for more recent disto releases).

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 libnl-3-dev libsctp-dev libxxhash-dev liblzma-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 libnl3-devel mpfr-devel libX11-devel libXau-devel libxcb-devel lksctp-tools-devel xorg-x11-proto-devel xxhash-devel zlib-devel

RHEL, Fedora, Centos (static builds):

  • 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 libnl3-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 libnl3-devel libseccomp-devel lksctp-tools-devel mpfr-devel xxhash-devel zlib-devel

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

NOTE: the build will try to detect build dependencies and will build an image with functionality disabled if the support libraries are not installed.

A library check can also be turned off explicitly by emptying the matching LIB_* variable, even when the library is installed. This is useful for embedded or distro builds that do not want stressors pulling in extra dependencies, for example:

make LIB_ACL= LIB_EGL= LIB_GBM= LIB_GLES2= LIB_JPEG=

At build-time stress-ng will detect kernel features that are available on the target build system and enable stress tests appropriately. Stress-ng has been build-tested on Ubuntu, Debian, Debian GNU/Hurd, Slackware, RHEL, SLES, Centos, kFreeBSD, OpenBSD, NetBSD, FreeBSD, Debian kFreeBSD, DragonFly BSD, OS X, Minix, Solaris 11.3, OpenIndiana and Hiaku. Ports to other POSIX/UNIX like operating systems should be relatively easy.

NOTE: ALWAYS run make clean after fetching changes from the git repository to force the build to regenerate the build configuration file. Parallel builds using make -j are supported.

To build on BSD systems, one requires gcc and GNU make:

    CC=gcc gmake clean
    CC=gcc gmake

To build on OS X systems, just use:

    make clean
    make

To cross build for OpenRisc (OR1K), install the cross compiler and use static builds:

bash
    export PATH=$PATH:$HOME/or1k/or1k-none-linux-musl/bin
    export CC=or1k-none-linux-musl-gcc
    STATIC=1 make

To build on MINIX, gmake, binutils and clang are required:

    CC=clang LD=clang gmake clean
    CC=clang LD=clang gmake

To build on SunOS, one requires GCC and GNU make, build using:

    CC=gcc gmake clean
    CC=gcc gmake

To build on Dilos, one requires GCC and GNU make, build using:

    CC=gcc gmake clean
    CC=gcc gmake

To build on Haiku R1/beta5:

    # GCC
    make clean
    make
    # Clang
    CC=clang make clean
    CC=clang make

To build a static image (example, for Android), use:

# 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

To build with the Tiny C compiler:

    make clean
    CC=tcc make

To build with the PCC portable C compiler use:

    make clean
    CC=pcc make

To build with the musl C library:

    make clean
    CC=musl-gcc

To build with the Intel C compiler icc use:

    make clean
    CC=icc make

To build with the Intel C compiler icx use:

    make clean
    CC=icx make

To perform a cross-compilation using gcc, use a static build, specify the toolchain (both CC and CXX). For example, a mips64 cross build:

    make clean
    STATIC=1 CC=mips64-linux-gnuabi64-gcc CXX=mips64-linux-gnuabi64-g++ make -j $(nproc)

To perform a cross-compilation for QNX 7.1, for example, an aarch64 QNX cross build:

    make clean
    CC=aarch64-unknown-nto-qnx7.1.0-gcc CXX=aarch64-unknown-nto-qnx7.1.0-g++ STATIC=1 make

To perform a cross-compilation for QNX 8, for example, an aarch64 QNX cross build:

    make clean
    CC=aarch64-unknown-nto-qnx8.0.0-gcc CXX=aarch64-unknown-nto-qnx8.0.0-g++ make

To use clang-scan for static analysis (e.g. using clang-21):

    make clean
    CC=clang-21 make -f Makefile.config -j $(nproc)
    CC=scan-build-21 make

To generate a PDF version of the manual (requires ps2pdf to be installed)

    make pdf

Build option: DEBUG, build with debug (-g) enabled:

    make clean
    DEBUG=1 make

Build option: BUILD_SMALL, build small (unoptimized) executable

    make clean
    BUILD_SMALL=1 make

Build option: LTO, Link Time Optimization (~1-2% performance improvement on compute stressors):

    make clean
    LTO=1 make

Build option: PEDANTIC, enable pedantic build flags:

    make clean
    PEDANTIC=1 make

Build option: GARBAGE_COLLECT, warn of unused code:

    make clean
    GARBAGE_COLLECT=1 make

Build option: UNEXPECTED=1, warn of unexpected #ifdef'd out code:

    make clean
    UNEXPECTED=1 make

Build option: SOURCE_DATE_EPOCH=seconds since epoch, add build date

    make clean
    SOURCE_DATE_EPOCH=1750685870 make

Build option: EXTRA_BUILDINFO=1, add CFLAGS, CXXFLAGS and LDFLAGS to --buildinfo option NOTE: This can lead to build information being leaked and is not recommended for any distro releases.

    make clean
    EXTRA_BUILDINFO=1 make

Contributing to stress-ng:

Send patches to [email protected] or merge requests at https://github.com/ColinIanKing/stress-ng

Quick Start Reference Guide

The Ubuntu stress-ng reference guide contains a brief overview and worked examples.

Examples

Run 8 CPU stressors for 60 seconds:

stress-ng --cpu 8 --timeout 60
stress-ng: info:  [184401] setting to a 1 min run per stressor
stress-ng: info:  [184401] dispatching hogs: 8 cpu
stress-ng: info:  [184401] skipped: 0
stress-ng: info:  [184401] passed: 8: cpu (8)
stress-ng: info:  [184401] failed: 0
stress-ng: info:  [184401] metrics untrustworthy: 0
stress-ng: info:  [184401] successful run completed in 1 min

Run 8 CPU stressors for 2 minutes, just using the square root CPU stressor method and show compute metrics:

…

Run 8 CPU stressors for 60 seconds and report thermal zone temperatures

…

Run 4 CPU, 2 virtual memory, 1 disk and 8 fork stressors for 2 minutes and print measurements:

…

Run a mix of 4 I/O stressors and check for changes in disk S.M.A.R.T. metadata:

…

Benchmark system calls using the VDSO:

…

Generate and measure branch misses using perf metrics:

bash
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%)

Run permutations of I/O stressors on a ZFS file system, excluding the rawdev stressor with kernel log error checking:

stress-ng --class io --permute 0 -x rawdev -t 1m --vmstat 1 --klog-check  --temp-path /zfs-pool/test

x86 only: measure power using the RAPL interfaces on 8 concurrent 3D matrix stressors with verification enabled. Note that reading RAPL requires root permission.

…

Measure C-state residency:

…

Run all scheduler stressors with 64 instances per stressor for 5 minutes per stressor, show progress and enable test verification:

stress-ng --seq 64 --class scheduler -t 5m --progress --verify

Run permutations of all the vector stressors, 8 instances of each, 5 seconds per permutation, show progress and enable test verification and enable verbose mode for output:

stress-ng --class vector --permute 8 -t 5 --progress --verify -v

Run as root two instances of the virtual memory stressor, use 95% of available memory, log results to example.log, check kernel log for errors, run for 1 hour, show virtual memory statistics every 10 seconds and verify memort tests:

bash
sudo stress-ng --log-file example.log --vm 2 --vm-bytes 95% --klog-check -v -t 1h  --vmstat 10 --v

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Cccpudiskfreebsd

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category测试质量
PricingOpen source

> Related tools

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.