Linux压力测试之stressapptest

本文介绍了如何使用stressapptest工具进行Linux系统的压力测试。包括交叉编译步骤、工具的基本用法及示例,帮助读者了解如何配置并运行该工具以评估系统的性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

上一篇谈到使用stress工具进行Linux的压力测试,这篇则使用stressapptest工具进行Linux压测。stressapptest是谷歌开源项目用于DDR压力测试,github链接

0.交叉编译

将源码下载到本地编译主机后,需要根据自己的平台交叉编译stressapptest,以下编译build.sh脚本参考:

#!/bin/sh
PWD=$(pwd)
if [ ! -d $PWD/output ];then
        mkdir $PWD/output
fi

TOOLCHAIN=/home/xxx/toolchain/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
export PATH=$TOOLCHAIN:${PATH}
./configure CC="arm-linux-gnueabihf-gcc"  --host=arm-linux-gnueabihf --build=x86_64-pc-linux-gnu --prefix=$PWD/output
make
make install

将build.sh脚本拷贝到源码根目录下,执行./build.sh将在output/bin下生成目标执行文件stressapptest。注意根据自己实际情况更改
CC、host和build的值。

1.stressapptest用法

-s: number of second to run the application       测试时间      
-m: number of memory copy threads to run          复制线程数  (Memory Copy)    
-i: number of memory invert threads to run        反转线程数 (Invert Copy)   
-c: CRC check                                     CRC 校验 (Data Check)
-C: number of memory CPU stress threads to run    CPU压力线程数      
-M: Megabytes of ram to run                       尽可能测试最大的可用存储空间,(设置超过了memfree,就会被kill) 

2.使用举例

下面测试100M内存,测试时间100s

stressapptest -M 100 -s 100

测试成功的log

[root@Sweep:/oem]# stressapptest -M 100 -s 3
1970/01/01-00:03:36(UTC) Log: Commandline - stressapptest -M 100 -s 3
1970/01/01-00:03:36(UTC) Stats: SAT revision 1.0.7_autoconf, 64 bit binary
1970/01/01-00:03:36(UTC) Log: hfh @ RobotServer on Sat May  9 12:17:25 CST 2020 from open source release
1970/01/01-00:03:36(UTC) Log: 1 nodes, 4 cpus.
1970/01/01-00:03:36(UTC) Log: Defaulting to 4 copy threads
1970/01/01-00:03:36(UTC) Log: Prefer plain malloc memory allocation.
1970/01/01-00:03:36(UTC) Log: Using mmap() allocation at 0x7fae511000.
1970/01/01-00:03:36(UTC) Stats: Starting SAT, 100M, 3 seconds
1970/01/01-00:03:37(UTC) Log: Region mask: 0x1
1970/01/01-00:03:42(UTC) Stats: Found 0 hardware incidents
1970/01/01-00:03:42(UTC) Stats: Completed: 6556.00M in 5.01s 1309.88MB/s, with 0 hardware incidents, 0 errors
1970/01/01-00:03:42(UTC) Stats: Memory Copy: 6556.00M at 1309.96MB/s
1970/01/01-00:03:42(UTC) Stats: File Copy: 0.00M at 0.00MB/s
1970/01/01-00:03:42(UTC) Stats: Net Copy: 0.00M at 0.00MB/s
1970/01/01-00:03:42(UTC) Stats: Data Check: 0.00M at 0.00MB/s
1970/01/01-00:03:42(UTC) Stats: Invert Data: 0.00M at 0.00MB/s
1970/01/01-00:03:42(UTC) Stats: Disk: 0.00M at 0.00MB/s
1970/01/01-00:03:42(UTC) 
1970/01/01-00:03:42(UTC) Status: PASS - please verify no corrected errors
1970/01/01-00:03:42(UTC) 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值