git clone tone-cli
cd tone-cli
make install
前置操作:
yum install gcc g++ eigen3-devel Judy-devel keyutils-libs-devel kmod-devel libacl-devel libaio-devel libatomic libattr-devel libcap-devel libgbm-devel libglvnd-core-devel libglvnd-devel libjpeg-devel mpfr-devel libX11-devel libXau-devel libxcb-devel lksctp-tools-devel xorg-x11-proto-devel xxhash-devel zlib-devel -y
由于tone install stress-ng执行install脚本需要会联网下载tar包到/home/tone-cli-master/cache/stress-ng路径后安装,因此离线安装可先下载tar包到指定路径再执行tone install stress-ng
下载tar文件后拷贝到/home/tone-cli-master/cache/stress-ng
tone install stress-ng
或着解压后
cd /home/stress-ng-0.15.00
make
make DESTDIR=/home/tone-cli-master/run/stress-ng install
make install
tone run stress-ng(测试全部场景)
tone fetch stress-ng
tone install stress-ng
tone list stress-ng
表示每个class下的stressor依次执行600s;总计350+个stressor,每个600s*350+约等于2.5天左右
tone run stress-ng
运行后可在以下路径查看stress-ng的输出
cd tone-cli/result/stress-ng/cpu-100%-600/${n}/output tail -f stress-ng.run
tone run stress-ng:cpu-100%-600s # 使用名称索引 tone run stress-ng::0 # 使用数字索引
位置:../tone-cli/result/测试套件/测试集/运行次数/
以stress-ng为例:
cd tone-cli/result/stress-ng/cpu-100%-600/${n}/ tree -L 2 |-- env.sh # 运行时的环境变量 |-- result.json # 结果文件 |-- stderr.log # 标准错误输出日志 |-- stdout.log # 标准输出日志 |-- sysinfo | |-- post # 运行后系统信息 | `-- pre # 运行前系统信息
查看执行结果:
(1)stress_run:是否执行成功
(2)Z_process_check:是否有僵尸进程
(3)D_process_check:
(4)message_check:是否有error日志
tone执行默认为100%压满,每个stressor时间为600秒,可通过修改配置自定义
其中nr_task计算方法如下:
class nr_task(PARAM): def get(self, value): if value[-1] == '%': self.value = int(float(value[0:-1]) / 100 * cpu_count()) else: self.value = int(value) return self.value
如删除测试类,修改百分比,修改每个stressor的测试时间
# cat /home/tone-cli-master/conf/functional/stress-ng.conf class nr_task timeout cpu 100% 600 memory 100% 600 vm 100% 600 io 100% 600 filesystem 100% 600 scheduler 100% 600 pipe 100% 600 os 100% 600 network 100% 600
修改黑名单(-x)
修改/home/tone-cli/tests/ stress-ng/stress-ng.blacklist,即增加stress-ng运行时-x参数的值(即需要过滤的stressor)
dev-shm mmap mmapaddr mmapfixed mmapfork mmaphuge mmapmany mprotect rawpkt rawsock rawudp sync-file sysbadaddr syscall
stress-ng --class cpu?查看cpu的stressors
stress-ng --class memory?查看memory的stressors
stress-ng --stressors 查看所以stressors
轮流执行 8 个 io 类型的 stressors,每个类型持续 5 分钟,并产生执行时间报表:
# 轮流执行 8 个 io 类型的 stressors,每个类型持续 5 分钟
# 并产生执行时间报表
#注意:使用了--class就必须使用--sequential参数
stress-ng --sequential 8 --class io -t 5m --metrics --times --verify