【压力测试】ubuntu使用stress-ng做CPU, 内存及硬盘使用率测试
1、安装
sudo apt-get install stress sudo apt-get install stress-ng
2、查看cpu,内存,硬盘方法
# 查看cpu个数 cat /proc/cpuinfo # 查看内存大小 cat /proc/meminfo # 查看磁盘大小 df -h
3、压测时 查看实时使用率(使用htop就可以了)
# 查看cpu命令 top htop # 查看内存使用情况 free
4、常用用法(和stress差不多)
# 压测cpu stress-ng --cpu 16 --timeout 180 # 压测内存 stress-ng --vm 4 --vm-bytes 10G --vm-hang 180 --timeout 180s # 压测磁盘 stress-ng --hdd 5 --hdd-bytes 10G --timeout 180s
5、指定cpu核心使用率
taskset -c 1 stress-ng --cpu 4 --cpu-load 80 --timeout 100
htop图示
6、stress-ng命令介绍
# stress-ng --help stress-ng, version 0.11.07 (gcc 9.4, x86_64 Linux 4.4.0-18362-Microsoft) Usage: stress-ng [OPTION [ARG]] General control options: --abort abort all stressors if any stressor fails --aggressive enable all aggressive options -a N, --all N start N workers of each stress test -b N, --backoff N wait of N microseconds before work starts --class name specify a class of stressors, use with --sequential -n, --dry-run do not run -h, --help show help --ignite-cpu alter kernel controls to make CPU run hot --ionice-class C specify ionice class (idle, besteffort, realtime) --ionice-level L specify ionice level (0 max, 7 min) -j, --job jobfile run the named jobfile -k, --keep-name keep stress worker names to be 'stress-ng' --log-brief less verbose log messages --log-file filename log messages to a log file --maximize enable maximum stress options -M, --metrics print pseudo metrics of activity --metrics-brief enable metrics and only show non-zero results --minimize enable minimal stress options --no-madvise don't use random madvise options for each mmap --no-rand-seed seed random numbers with the same constant --page-in touch allocated pages that are not in core --parallel N synonym for 'all N' --pathological enable stressors that are known to hang a machine --perf display perf statistics -q, --quiet quiet output -r, --random N start N random workers --sched type set scheduler type --sched-prio N set scheduler priority level N --sequential N run all stressors one by one, invoking N of them --stressors show available stress tests --syslog log messages to the syslog --taskset use specific CPUs (set CPU affinity) --temp-path path specify path for temporary directories and files --thrash force all pages in causing swap thrashing -t N, --timeout T timeout after T seconds --timer-slack enable timer slack mode --times show run time summary at end of the run --timestamp timestamp log output --tz collect temperatures from thermal zones (Linux only) -v, --verbose verbose output --verify verify results (not available on all tests) -V, --version show version -Y, --yaml file output results to YAML formatted filed -x, --list list of stressors to exclude (not run) Stressor specific options: --access N start N workers that stress file access permissions --access-ops N stop after N file access bogo operations --af-alg N start N workers that stress AF_ALG socket domain --af-alg-ops N stop after N af-alg bogo operations --af-alg-dump dump internal list from /proc/crypto to stdout --affinity N start N workers that rapidly change CPU affinity --affinity-ops N stop after N affinity bogo operations --affinity-rand change affinity randomly rather than sequentially --aio N start N workers that issue async I/O requests --aio-ops N stop after N bogo async I/O requests --aio-requests N number of async I/O requests per worker --aiol N start N workers that exercise Linux async I/O --aiol-ops N stop after N bogo Linux aio async I/O requests --aiol-requests N number of Linux aio async I/O requests per worker --apparmor start N workers exercising AppArmor interfaces --apparmor-ops N stop after N bogo AppArmor worker bogo operations --atomic start N workers exercising GCC atomic operations --atomic-ops stop after N bogo atomic bogo operations --bad-altstack N start N workers exercising bad signal stacks --bad-altstack-ops N stop after N bogo signal stack SIGSEGVs -B N, --bigheap N start N workers that grow the heap using calloc() --bigheap-ops N stop after N bogo bigheap operations --bigheap-growth N grow heap by N bytes per iteration --bind-mount N start N workers exercising bind mounts --bind-mount-ops N stop after N bogo bind mount operations --binderfs N start N workers exercising binderfs --binderfs-ops N stop after N bogo binderfs operations --branch N start N workers that force branch misprediction --branch-ops N stop after N branch misprediction branches --brk N start N workers performing rapid brk calls --brk-ops N stop after N brk bogo operations --brk-notouch don't touch (page in) new data segment page --bsearch N start N workers that exercise a binary search --bsearch-ops N stop after N binary search bogo operations --bsearch-size N number of 32 bit integers to bsearch -C N, --cache N start N CPU cache thrashing workers --cache-ops N stop after N cache bogo operations --cache-prefetch prefetch on memory reads/writes --cache-flush flush cache after every memory write (x86 only) --cache-fence serialize stores --cache-level N only exercise specified cache --cache-ways N only fill specified number of cache ways --cap N start N workers exercising capget --cap-ops N stop cap workers after N bogo capget operations --chattr N start N workers thrashing chattr file mode bits --chattr-ops N stop chattr workers after N bogo operations --chdir N start N workers thrashing chdir on many paths --chdir-ops N stop chdir workers after N bogo chdir operations --chdir-dirs N select number of directories to exercise chdir on --chmod N start N workers thrashing chmod file mode bits --chmod-ops N stop chmod workers after N bogo operations --chown N start N workers thrashing chown file ownership --chown-ops N stop chown workers after N bogo operations --chroot N start N workers thrashing chroot --chroot-ops N stop chhroot workers after N bogo operations --clock N start N workers thrashing clocks and POSIX timers --clock-ops N stop clock workers after N bogo operations --clone N start N workers that rapidly create and reap clones --clone-ops N stop after N bogo clone operations --clone-max N set upper limit of N clones per worker --close N start N workers that exercise races on close --close-ops N stop after N bogo close operations --context N start N workers exercising user context --context-ops N stop context workers after N bogo operations --copy-file N start N workers that copy file data --copy-file-ops N stop after N copy bogo operations --copy-file-bytes N specify size of file to be copied -c N, --cpu N start N workers spinning on sqrt(rand()) --cpu-ops N stop after N cpu bogo operations -l P, --cpu-load P load CPU by P %, 0=sleep, 100=full load (see -c) --cpu-load-slice S specify time slice during busy load --cpu-method M specify stress cpu method M, default is all --cpu-online N start N workers offlining/onlining the CPUs --cpu-online-ops N stop after N offline/online operations --crypt N start N workers performing password encryption --crypt-ops N stop after N bogo crypt operations --cyclic N start N cyclic real time benchmark stressors --cyclic-ops N stop after N cyclic timing cycles --cyclic-method M specify cyclic method M, default is clock_ns --cyclic-dist N calculate distribution of interval N nanosecs --cyclic-policy P used rr or fifo scheduling policy --cyclic-prio N real time scheduling priority 1..100 --cyclic-sleep N sleep time of real time timer in nanosecs --daemon N start N workers creating multiple daemons --daemon-ops N stop when N daemons have been created --dccp N start N workers exercising network DCCP I/O --dccp-domain D specify DCCP domain, default is ipv4 --dccp-ops N stop after N DCCP bogo operations --dccp-opts option DCCP data send options [send|sendmsg|sendmmsg] --dccp-port P use DCCP ports P to P + number of workers - 1 -D N, --dentry N start N dentry thrashing stressors --dentry-ops N stop after N dentry bogo operations --dentry-order O specify unlink order (reverse, forward, stride) --dentries N create N dentries per iteration --dev N start N device entry thrashing stressors --dev-ops N stop after N device thrashing bogo ops --dev-shm N start N /dev/shm file and mmap stressors --dev-shm-ops N stop after N /dev/shm bogo ops --dir N start N directory thrashing stressors --dir-ops N stop after N directory bogo operations --dir-dirs N select number of directories to exercise dir on --dirdeep N start N directory depth stressors --dirdeep-ops N stop after N directory depth bogo operations --dirdeep-dirs N create N directories per level --dirdeep-inodes N create a maximum N inodes (N can also be %) --dnotify N start N workers exercising dnotify events --dnotify-ops N stop dnotify workers after N bogo operations --dup N start N workers exercising dup/close --dup-ops N stop after N dup/close bogo operations --dynlib N start N workers exercising dlopen/dlclose --dynlib-ops N stop after N dlopen/dlclose bogo operations --efivar N start N workers that read EFI variables --efivar-ops N stop after N EFI variable bogo read operations --enosys N start N workers that call non-existent system calls --enosys-ops N stop after N enosys bogo operations --env N start N workers setting enironment vars --env-ops N stop after N env bogo operations --epoll N start N workers doing epoll handled socket activity --epoll-ops N stop after N epoll bogo operations --epoll-port P use socket ports P upwards --epoll-domain D specify socket domain, default is unix --eventfd N start N workers stressing eventfd read/writes --eventfd-ops N stop eventfd workers after N bogo operations --eventfs-nonblock poll with non-blocking I/O on eventfd fd --exec N start N workers spinning on fork() and exec() --exec-ops N stop after N exec bogo operations --exec-max P create P workers per iteration, default is 1 --fallocate N start N workers fallocating 16MB files --fallocate-ops N stop after N fallocate bogo operations --fallocate-bytes N specify size of file to allocate --fanotify N start N workers exercising fanotify events --fanotify-ops N stop fanotify workers after N bogo operations --fault N start N workers producing page faults --fault-ops N stop after N page fault bogo operations --fcntl N start N workers exercising fcntl commands --fcntl-ops N stop after N fcntl bogo operations --fiemap N start N workers exercising the FIEMAP ioctl --fiemap-ops N stop after N FIEMAP ioctl bogo operations --fiemap-bytes N specify size of file to fiemap --fifo N start N workers exercising fifo I/O --fifo-ops N stop after N fifo bogo operations --fifo-readers N number of fifo reader stessors to start --file-ioctl N start N workers exercising file specific ioctls --file-ioctl-ops N stop after N file ioctl bogo operations --filename N start N workers exercising filenames --filename-ops N stop after N filename bogo operations --filename-opts opt specify allowed filename options --flock N start N workers locking a single file --flock-ops N stop after N flock bogo operations -f N, --fork N start N workers spinning on fork() and exit() --fork-ops N stop after N fork bogo operations --fork-max P create P workers per iteration, default is 1 --fp-error N start N workers exercising floating point errors --fp-error-ops N stop after N fp-error bogo operations --fstat N start N workers exercising fstat on files --fstat-ops N stop after N fstat bogo operations --fstat-dir path fstat files in the specified directory --full N start N workers exercising /dev/full --full-ops N stop after N /dev/full bogo I/O operations --funccall N start N workers exercising 1 to 9 arg functions --funccall-ops N stop after N function call bogo operations --funccall-method M select function call method M --funcret N start N workers exercising function return copying --funcret-ops N stop after N function return bogo operations --funcret-method M select method of exercising a function return type --futex N start N workers exercising a fast mutex --futex-ops N stop after N fast mutex bogo operations --get N start N workers exercising the get*() system calls --get-ops N stop after N get bogo operations --getdent N start N workers reading directories using getdents --getdent-ops N stop after N getdents bogo operations --getrandom N start N workers fetching random data via getrandom() --getrandom-ops N stop after N getrandom bogo operations --handle N start N workers exercising name_to_handle_at --handle-ops N stop after N handle bogo operations -d N, --hdd N start N workers spinning on write()/unlink() --hdd-ops N stop after N hdd bogo operations --hdd-bytes N write N bytes per hdd worker (default is 1GB) --hdd-opts list specify list of various stressor options --hdd-write-size N set the default write size to N bytes --heapsort N start N workers heap sorting 32 bit random integers --heapsort-ops N stop after N heap sort bogo operations --heapsort-size N number of 32 bit integers to sort --hrtimers N start N workers that exercise high resolution timers --hrtimers-ops N stop after N bogo high-res timer bogo operations --hsearch N start N workers that exercise a hash table search --hsearch-ops N stop after N hash search bogo operations --hsearch-size N number of integers to insert into hash table --icache N start N CPU instruction cache thrashing workers --icache-ops N stop after N icache bogo operations --icmp-flood N start N ICMP packet flood workers --icmp-flood-ops N stop after N ICMP bogo operations (ICMP packets) --idle-page N start N idle page scanning workers --idle-page-ops N stop after N idle page scan bogo operations --inode-flags N start N workers exercising various inode flags --inode-flags-ops N stop inode-flags workers after N bogo operations --inotify N start N workers exercising inotify events --inotify-ops N stop inotify workers after N bogo operations -i N, --io N start N workers spinning on sync() --io-ops N stop sync I/O after N io bogo operations --iomix N start N workers that have a mix of I/O operations --iomix-bytes N write N bytes per iomix worker (default is 1GB) --iomix-ops N stop iomix workers after N iomix bogo operations --ioport N start N workers exercising port I/O --ioport-ops N stop ioport workers after N port bogo operations --ioprio N start N workers exercising set/get iopriority --ioprio-ops N stop after N io bogo iopriority operations --ipsec-mb N start N workers exercising the IPSec MB encoding --ipsec-mb-ops N stop after N ipsec bogo encoding operations --ipsec-mb-feature F specify CPU feature F --itimer N start N workers exercising interval timers --itimer-ops N stop after N interval timer bogo operations --itimer-rand enable random interval timer frequency --judy N start N workers that exercise a judy array search --judy-ops N stop after N judy array search bogo operations --judy-size N number of 32 bit integers to insert into judy array --kcmp N start N workers exercising kcmp --kcmp-ops N stop after N kcmp bogo operations --key N start N workers exercising key operations --key-ops N stop after N key bogo operations --kill N start N workers killing with SIGUSR1 --kill-ops N stop after N kill bogo operations --klog N start N workers exercising kernel syslog interface --klog-ops N stop after N klog bogo operations --lease N start N workers holding and breaking a lease --lease-ops N stop after N lease bogo operations --lease-breakers N number of lease breaking workers to start --link N start N workers creating hard links --link-ops N stop after N link bogo operations --locka N start N workers locking a file via advisory locks --locka-ops N stop after N locka bogo operations --lockbus N start N workers locking a memory increment --lockbus-ops N stop after N lockbus bogo operations --lockf N start N workers locking a single file via lockf --lockf-ops N stop after N lockf bogo operations --lockf-nonblock don't block if lock cannot be obtained, re-try --lockofd N start N workers using open file description locking --lockofd-ops N stop after N lockofd bogo operations --longjmp N start N workers exercising setjmp/longjmp --longjmp-ops N stop after N longjmp bogo operations --loop N start N workers exercising loopback devices --loop-ops N stop after N bogo loopback operations --lsearch N start N workers that exercise a linear search --lsearch-ops N stop after N linear search bogo operations --lsearch-size N number of 32 bit integers to lsearch --madvise N start N workers exercising madvise on memory --madvise-ops N stop after N bogo madvise operations --malloc N start N workers exercising malloc/realloc/free --malloc-bytes N allocate up to N bytes per allocation --malloc-max N keep up to N allocations at a time --malloc-ops N stop after N malloc bogo operations --malloc-thresh N threshold where malloc uses mmap instead of sbrk --matrix N start N workers exercising matrix operations --matrix-ops N stop after N maxtrix bogo operations --matrix-method M specify matrix stress method M, default is all --matrix-size N specify the size of the N x N matrix --matrix-yx matrix operation is y by x instread of x by y --matrix-3d N start N workers exercising 3D matrix operations --matrix-3d-ops N stop after N 3D maxtrix bogo operations --matrix-3d-method M specify 3D matrix stress method M, default is all --matrix-3d-size N specify the size of the N x N x N matrix --matrix-3d-zyx matrix operation is z by y by x instread of x by y by z --mcontend N start N workers that produce memory contention --mcontend-ops N stop memory contention workers after N bogo-ops --membarrier N start N workers performing membarrier system calls --membarrier-ops N stop after N membarrier bogo operations --memcpy N start N workers performing memory copies --memcpy-ops N stop after N memcpy bogo operations --memcpy-method M set memcpy method (M = all, libc, builtin, naive) --memfd N start N workers allocating memory with memfd_create --memfd-bytes N allocate N bytes for each stress iteration --memfd-fds N number of memory fds to open per stressors --memfd-ops N stop after N memfd bogo operations --memhotplug N start N workers that exercise memory hotplug --memhotplug-ops N stop after N memory hotplug operations --memrate N start N workers exercised memory read/writes --memrate-ops N stop after N memrate bogo operations --memrate-bytes N size of memory buffer being exercised --memrate-rd-mbs N read rate from buffer in megabytes per second --memrate-wr-mbs N write rate to buffer in megabytes per second --memthrash N start N workers thrashing a 16MB memory buffer --memthrash-ops N stop after N memthrash bogo operations --memthrash-method M specify memthrash method M, default is all --mergesort N start N workers merge sorting 32 bit random integers --mergesort-ops N stop after N merge sort bogo operations --mergesort-size N number of 32 bit integers to sort --mincore N start N workers exercising mincore --mincore-ops N stop after N mincore bogo operations --mincore-random randomly select pages rather than linear scan --mknod N start N workers that exercise mknod --mknod-ops N stop after N mknod bogo operations --mlock N start N workers exercising mlock/munlock --mlock-ops N stop after N mlock bogo operations --mlockmany N start N workers exercising many mlock/munlock processes --mlockmany-ops N stop after N mlockmany bogo operations --mmap N start N workers stressing mmap and munmap --mmap-ops N stop after N mmap bogo operations --mmap-async using asynchronous msyncs for file based mmap --mmap-bytes N mmap and munmap N bytes for each stress iteration --mmap-file mmap onto a file using synchronous msyncs --mmap-mprotect enable mmap mprotect stressing --mmap-osync enable O_SYNC on file --mmap-odirect enable O_DIRECT on file --mmapaddr N start N workers stressing mmap with random addresses --mmapaddr-ops N stop after N mmapaddr bogo operations --mmapfixed N start N workers stressing mmap with fixed mappings --mmapfixed-ops N stop after N mmapfixed bogo operations --mmapfork N start N workers stressing many forked mmaps/munmaps --mmapfork-ops N stop after N mmapfork bogo operations --mmapmany N start N workers stressing many mmaps and munmaps --mmapmany-ops N stop after N mmapmany bogo operations --mq N start N workers passing messages using POSIX messages --mq-ops N stop mq workers after N bogo messages --mq-size N specify the size of the POSIX message queue --mremap N start N workers stressing mremap --mremap-ops N stop after N mremap bogo operations --mremap-bytes N mremap N bytes maximum for each stress iteration --msg N start N workers stressing System V messages --msg-ops N stop msg workers after N bogo messages --msg-types N enable N different message types --msync N start N workers syncing mmap'd data with msync --msync-ops N stop msync workers after N bogo msyncs --msync-bytes N size of file and memory mapped region to msync --netdev N start N workers exercising netdevice ioctls --netdev-ops N stop netdev workers after N bogo operations --netlink-proc N start N workers exercising netlink process events --netlink-proc-ops N stop netlink-proc workers after N bogo events --netlink-task N start N workers exercising netlink tasks events --netlink-task-ops N stop netlink-task workers after N bogo events --nice N start N workers that randomly re-adjust nice levels --nice-ops N stop after N nice bogo operations --nop N start N workers that burn cycles with no-ops --nop-ops N stop after N nop bogo no-op operations --null N start N workers writing to /dev/null --null-ops N stop after N /dev/null bogo write operations --numa N start N workers stressing NUMA interfaces --numa-ops N stop after N NUMA bogo operations --oom-pipe N start N workers exercising large pipes --oom-pipe-ops N stop after N oom-pipe bogo operations --opcode N start N workers exercising random opcodes --opcode-ops N stop after N opcode bogo operations --opcode-method M set opcode stress method (M = random, inc, mixed, text) -o N, --open N start N workers exercising open/close --open-ops N stop after N open/close bogo operations --personality N start N workers that change their personality --personality-ops N stop after N bogo personality calls --physpage N start N workers performing physical page lookup --physpage-ops N stop after N physical page bogo operations --pidfd N start N workers exercising pidfd system call --pidfd-ops N stop after N pidfd bogo operations -p N, --pipe N start N workers exercising pipe I/O --pipe-ops N stop after N pipe I/O bogo operations --pipe-data-size N set pipe size of each pipe write to N bytes --pipe-size N set pipe size to N bytes -p N, --pipeherd N start N multi-process workers exercising pipes I/O --pipeherd-ops N stop after N pipeherd I/O bogo operations --pipeherd-yield force processes to yield after each write --pkey N start N workers exercising pkey_mprotect --pkey-ops N stop after N bogo pkey_mprotect bogo operations -P N, --poll N start N workers exercising zero timeout polling --poll-ops N stop after N poll bogo operations --procfs N start N workers reading portions of /proc --procfs-ops N stop procfs workers after N bogo read operations --procfs N start N workers reading portions of /proc --procfs-ops N stop procfs workers after N bogo read operations --pthread N start N workers that create multiple threads --pthread-ops N stop pthread workers after N bogo threads created --pthread-max P create P threads at a time by each worker --ptrace N start N workers that trace a child using ptrace --ptrace-ops N stop ptrace workers after N system calls are traced --pty N start N workers that exercise pseudoterminals --pty-ops N stop pty workers after N pty bogo operations --pty-max N attempt to open a maximum of N ptys -Q N, --qsort N start N workers qsorting 32 bit random integers --qsort-ops N stop after N qsort bogo operations --qsort-size N number of 32 bit integers to sort --quota N start N workers exercising quotactl commands --quota-ops N stop after N quotactl bogo operations --radixsort N start N workers radix sorting random strings --radixsort-ops N stop after N radixsort bogo operations --radixsort-size N number of strings to sort --ramfs N start N workers exercising ramfs mounts --ramfs-ops N stop after N bogo ramfs mount operations --ramfs-bytes N set the ramfs size in bytes, e.g. 2M is 2MB --rawdev N start N workers that read a raw device --rawdev-ops N stop after N rawdev read operations --rawdev-method M specify the rawdev reead method to use --rawsock N start N workers performing raw socket send/receives --rawsock-ops N stop after N raw socket bogo operations --rdrand N start N workers exercising rdrand (x86 only) --rdrand-ops N stop after N rdrand bogo operations --readahead N start N workers exercising file readahead --readahead-bytes N size of file to readahead on (default is 1GB) --readahead-ops N stop after N readahead bogo operations --reboot N start N workers that exercise bad reboot calls --reboot-ops N stop after N bogo reboot operations --remap N start N workers exercising page remappings --remap-ops N stop after N remapping bogo operations -R, --rename N start N workers exercising file renames --rename-ops N stop after N rename bogo operations --resources N start N workers consuming system resources --resources-ops N stop after N resource bogo operations --revio N start N workers performing reverse I/O --revio-ops N stop after N revio bogo operations --rmap N start N workers that stress reverse mappings --rmap-ops N stop after N rmap bogo operations --rmap N start N workers that stress reverse mappings --rmap-ops N stop after N rmap bogo operations --rtc N start N workers that exercise the RTC interfaces --rtc-ops N stop after N RTC bogo operations --schedpolicy N start N workers that exercise scheduling policy --schedpolicy-ops N stop after N scheduling policy bogo operations --sctp N start N workers performing SCTP send/receives --sctp-ops N stop after N SCTP bogo operations --sctp-domain D specify sctp domain, default is ipv4 --sctp-port P use SCTP ports P to P + number of workers - 1 --sctp-sched S specify sctp scheduler --seal N start N workers performing fcntl SEAL commands --seal-ops N stop after N SEAL bogo operations --seccomp N start N workers performing seccomp call filtering --seccomp-ops N stop after N seccomp bogo operations --seek N start N workers performing random seek r/w IO --seek-ops N stop after N seek bogo operations --seek-punch punch random holes in file to stress extents --seek-size N length of file to do random I/O upon --sem N start N workers doing semaphore operations --sem-ops N stop after N semaphore bogo operations --sem-procs N number of processes to start per worker --sem-sysv N start N workers doing System V semaphore operations --sem-sysv-ops N stop after N System V sem bogo operations --sem-sysv-procs N number of processes to start per worker --sendfile N start N workers exercising sendfile --sendfile-ops N stop after N bogo sendfile operations --sendfile-size N size of data to be sent with sendfile --set N start N workers exercising the set*() system calls --set-ops N stop after N set bogo operations --shellsort N start N workers shell sorting 32 bit random integers --shellsort-ops N stop after N shell sort bogo operations --shellsort-size N number of 32 bit integers to sort --shm N start N workers that exercise POSIX shared memory --shm-ops N stop after N POSIX shared memory bogo operations --shm-bytes N allocate/free N bytes of POSIX shared memory --shm-segs N allocate N POSIX shared memory segments per iteration --shm-sysv N start N workers that exercise System V shared memory --shm-sysv-ops N stop after N shared memory bogo operations --shm-sysv-bytes N allocate and free N bytes of shared memory per loop --shm-sysv-segs N allocate N shared memory segments per iteration --sigfd N start N workers reading signals via signalfd reads --sigfd-ops N stop after N bogo signalfd reads --sigfpe N start N workers generating floating point math faults --sigfpe-ops N stop after N bogo floating point math faults --sigio N start N workers that exercise SIGIO signals --sigio-ops N stop after N bogo sigio signals --sigpending N start N workers exercising sigpending --sigpending-ops N stop after N sigpending bogo operations --sigpipe N start N workers exercising SIGPIPE --sigpipe-ops N stop after N SIGPIPE bogo operations --sigq N start N workers sending sigqueue signals --sigq-ops N stop after N sigqueue bogo operations --sigrt N start N workers sending real time signals --sigrt-ops N stop after N real time signal bogo operations --sigsegv N start N workers generating segmentation faults --sigsegv-ops N stop after N bogo segmentation faults --sigsuspend N start N workers exercising sigsuspend --sigsuspend-ops N stop after N bogo sigsuspend wakes --skiplist N start N workers that exercise a skiplist search --skiplist-ops N stop after N skiplist search bogo operations --skiplist-size N number of 32 bit integers to add to skiplist --sleep N start N workers performing various duration sleeps --sleep-ops N stop after N bogo sleep operations --sleep-max P create P threads at a time by each worker -S N, --sock N start N workers exercising socket I/O --sock-domain D specify socket domain, default is ipv4 --sock-nodelay disable Nagle algorithm, send data immediately --sock-ops N stop after N socket bogo operations --sock-opts option socket options [send|sendmsg|sendmmsg] --sock-port P use socket ports P to P + number of workers - 1 --sock-type T socket type (stream, seqpacket) -S N, --sock N start N workers exercising socket I/O --sock-ops N stop after N socket bogo operations --sockdiag N start N workers exercising sockdiag netlink --sockdiag-ops N stop sockdiag workers after N bogo messages --sockfd N start N workers sending file descriptors over sockets --sockfd-ops N stop after N sockfd bogo operations --sockfd-port P use socket fd ports P to P + number of workers - 1 --sockpair N start N workers exercising socket pair I/O activity --sockpair-ops N stop after N socket pair bogo operations --sockmany N start N workers exercising many socket connections --sockmany-ops N stop after N sockmany bogo operations --softlockup N start N workers that cause softlockups --softlockup-ops N stop after N softlockup bogo operations --spawn N start N workers spawning stress-ng using posix_spawn --spawn-ops N stop after N spawn bogo operations --splice N start N workers reading/writing using splice --splice-ops N stop after N bogo splice operations --splice-bytes N number of bytes to transfer per splice call --stack N start N workers generating stack overflows --stack-ops N stop after N bogo stack overflows --stack-fill fill stack, touches all new pages --stackmmap N start N workers exercising a filebacked stack --stackmmap-ops N stop after N bogo stackmmap operations --str N start N workers exercising lib C string functions --str-method func specify the string function to stress --str-ops N stop after N bogo string operations --stream N start N workers exercising memory bandwidth --stream-ops N stop after N bogo stream operations --stream-index specify number of indices into the data (0..3) --stream-l3-size N specify the L3 cache size of the CPU --stream-madvise M specify mmap'd stream buffer madvise advice --swap N start N workers exercising swapon/swapoff --swap-ops N stop after N swapon/swapoff operations -s N, --switch N start N workers doing rapid context switches --switch-ops N stop after N context switch bogo operations --switch-freq N set frequency of context switches --symlink N start N workers creating symbolic links --symlink-ops N stop after N symbolic link bogo operations --sync-file N start N workers exercise sync_file_range --sync-file-ops N stop after N sync_file_range bogo operations --sync-file-bytes N size of file to be sync'd --sysbadaddr N start N workers that pass bad addresses to syscalls --sysbadaddr-ops N stop after N sysbadaddr bogo syscalls --sysinfo N start N workers reading system information --sysinfo-ops N stop after sysinfo bogo operations --sysfs N start N workers reading files from /sys --sysfs-ops N stop after sysfs bogo operations --tee N start N workers exercising the tee system call --tee-ops N stop after N tee bogo operations -T N, --timer N start N workers producing timer events --timer-ops N stop after N timer bogo events --timer-freq F run timer(s) at F Hz, range 1 to 1000000000 --timer-rand enable random timer frequency --timerfd N start N workers producing timerfd events --timerfd-ops N stop after N timerfd bogo events --timerfd-freq F run timer(s) at F Hz, range 1 to 1000000000 --timerfd-rand enable random timerfd frequency --tlb-shootdown N start N workers that force TLB shootdowns --tlb-shootdown-ops Nstop after N TLB shootdown bogo ops --tmpfs N start N workers mmap'ing a file on tmpfs --tmpfs-ops N stop after N tmpfs bogo ops --tmpfs-mmap-async using asynchronous msyncs for tmpfs file based mmap --tmpfs-mmap-file mmap onto a tmpfs file using synchronous msyncs --tree N start N workers that exercise tree structures --tree-ops N stop after N bogo tree operations --tree-method M select tree method, all,avl,binary,rb,splay --tree-size N N is the number of items in the tree --tsc N start N workers reading the TSC (x86 only) --tsc-ops N stop after N TSC bogo operations --tsearch N start N workers that exercise a tree search --tsearch-ops N stop after N tree search bogo operations --tsearch-size N number of 32 bit integers to tsearch --tun N start N workers exercising tun interface --tun-ops N stop after N tun bogo operations --tun-tap use TAP interface instead of TUN --udp N start N workers performing UDP send/receives --udp-ops N stop after N udp bogo operations --udp-domain D specify domain, default is ipv4 --udp-lite use the UDP-Lite (RFC 3828) protocol --udp-port P use ports P to P + number of workers - 1 --udp-flood N start N workers that performs a UDP flood attack --udp-flood-ops N stop after N udp flood bogo operations --udp-flood-domain D specify domain, default is ipv4 --unshare N start N workers exercising resource unsharing --unshare-ops N stop after N bogo unshare operations -u N, --urandom N start N workers reading /dev/urandom --urandom-ops N stop after N urandom bogo read operations --userfaultfd N start N page faulting workers with userspace handling --userfaultfd-ops N stop after N page faults have been handled --utime N start N workers updating file timestamps --utime-ops N stop after N utime bogo operations --utime-fsync force utime meta data sync to the file system --vdso N start N workers exercising functions in the VDSO --vdso-ops N stop after N vDSO function calls --vdso-func F use just vDSO function F --vecmath N start N workers performing vector math ops --vecmath-ops N stop after N vector math bogo operations --vfork N start N workers spinning on vfork() and exit() --vfork-ops N stop after N vfork bogo operations --vfork-max P create P processes per iteration, default is 1 --vforkmany N start N workers spawning many vfork children --vforkmany-ops N stop after spawning N vfork children -m N, --vm N start N workers spinning on anonymous mmap --vm-bytes N allocate N bytes per vm worker (default 256MB) --vm-hang N sleep N seconds before freeing memory --vm-keep redirty memory instead of reallocating --vm-ops N stop after N vm bogo operations --vm-locked lock the pages of the mapped region into memory --vm-madvise M specify mmap'd vm buffer madvise advice --vm-method M specify stress vm method M, default is all --vm-populate populate (prefault) page tables for a mapping --vm-addr N start N vm address exercising workers --vm-addr-ops N stop after N vm address bogo operations --vm-rw N start N vm read/write process_vm* copy workers --vm-rw-bytes N transfer N bytes of memory per bogo operation --vm-rw-ops N stop after N vm process_vm* copy bogo operations --vm-segv N start N workers that unmap their address space --vm-segv-ops N stop after N vm-segv unmap'd SEGV faults --vm-splice N start N workers reading/writing using vmsplice --vm-splice-ops N stop after N bogo splice operations --vm-splice-bytes N number of bytes to transfer per vmsplice call --wait N start N workers waiting on child being stop/resumed --wait-ops N stop after N bogo wait operations --watchdog N start N workers that exercise /dev/watchdog --watchdog-ops N stop after N bogo watchdog operations --wcs N start N workers on lib C wide char string functions --wcs-method func specify the wide character string function to stress --wcs-ops N stop after N bogo wide character string operations --x86syscall N start N workers exercising functions using syscall --x86syscall-ops N stop after N syscall function calls --x86syscall-func F use just syscall function F --xattr N start N workers stressing file extended attributes --xattr-ops N stop after N bogo xattr operations -y N, --yield N start N workers doing sched_yield() calls --yield-ops N stop after N bogo yield operations --zero N start N workers reading /dev/zero --zero-ops N stop after N /dev/zero bogo read operations --zlib N start N workers compressing data with zlib --zlib-ops N stop after N zlib bogo compression operations --zlib-level L specify zlib compression level 0=fast, 9=best --zlib-method M specify zlib random data generation method M --zombie N start N workers that rapidly create and reap zombies --zombie-ops N stop after N bogo zombie fork operations --zombie-max N set upper limit of N zombies per worker Example: stress-ng --cpu 8 --io 4 --vm 2 --vm-bytes 128M --fork 4 --timeout 10s Note: Sizes can be suffixed with B,K,M,G and times with s,m,h,d,y
参考链接:
https://www.cnblogs.com/fireblackman/p/16747268.html
https://blog.csdn.net/weixin_43991475/article/details/124980475