首页  

linux stress 工具简介     所属分类 linux 浏览量 935
模拟各种负载 cpu 内存 磁盘io 
imposes certain types of compute stress on your system
对系统施加某些类型的计算压力


stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s

./stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M -d 3 --timeout 100s

--timeout 运行时间 

Note: Numbers may be suffixed with s,m,h,d,y (time) or B,K,M,G (size).

运行起来后 ,用 linux 命令观察
top 
vmstat 2
vmstat -d 2
iostat -x 2
iotop 
ps -ef|grep stress
pstree -p 2690727

sudo iotop -oP
sudo iotop -o


iostat -x 2
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00    0.00  840.50     0.00 205886.00   489.91   142.48  163.91    0.00  163.91   1.19 100.00

%util


iotop

Total DISK READ :	0.00 B/s | Total DISK WRITE :       2.49 G/s
Actual DISK READ:	0.00 B/s | Actual DISK WRITE:     233.22 M/s

线程各种状态统计
 ps -e -L h o state |sort |uniq -c
      6 D
     17 R
   5733 S





-?, --help show this help statement --version show version statement -v, --verbose be verbose -q, --quiet be quiet -n, --dry-run show what would have been done -t, --timeout N timeout after N seconds --backoff N wait factor of N microseconds before work starts -c, --cpu N spawn N workers spinning on sqrt() -i, --io N spawn N workers spinning on sync() -m, --vm N spawn N workers spinning on malloc()/free() --vm-bytes B malloc B bytes per vm worker (default is 256MB) --vm-stride B touch a byte every B bytes (default is 4096) --vm-hang N sleep N secs before free (default is none, 0 is inf) --vm-keep redirty memory instead of freeing and reallocating -d, --hdd N spawn N workers spinning on write()/unlink() --hdd-bytes B write B bytes per hdd worker (default is 1GB) --hdd-noclean do not unlink files created by hdd workers Example: stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s Note: Numbers may be suffixed with s,m,h,d,y (time) or B,K,M,G (size).
源码下载编译 https://gitee.com/dyyx/hellocode/blob/master/tools/stress.c https://github.com/jreybert/power/blob/master/tests/stress.c https://linux.die.net/man/1/stress gcc stress.c 对‘sqrt’未定义的引用 gcc stress.c -o stress -lm ./stress `stress' imposes certain types of compute stress on your system ./stress -? ./stress --help
linux实用命令合集 linux运维常用命令

上一篇     下一篇
linux watch 命令

linux sar 使用简介

Linux系统监控工具大全

busybox编译

linux netstat

linux 帮助命令使用