stressapptest
google开源工具stressapptest
在Android源码中可以找到 /externel/stressapptest
stressapptest 其是:Stressful Application Test (stressapptest) 的简称
Stressful Application Test试图让来自处理器和I/O到内存的数据尽量随机化,以创造出模拟现实的环境来测试现在的硬件设备是否稳定,Google就在使用它.其大概如下:
stressapptest may be used for various purposes:
Stress test: as described here.
Hardware qualification and debugging.
Memory interface test: see theTheory behind this.
Disk testing.
据谷歌的介绍,这个软件会生产线程来拷贝和直接对磁盘进行读取和写入。目标则是尽可能地载入系统内存,以便更加有效地进行测试。该软件更多的时候测试的是内存控制器和总线接口,而不是存储单元的功能。谷歌称,与其他内存诊断程序的比较,五分之一的内存模块相关的系统误差只能通过stressapptest发现。
参数介绍:
e.g. MemFree indicates that there are 1140234 kB memory left. You can use the following command to start the stress test:
./stressapptest -s 86400 -m 4 -i 4 -c 4 -C 4 -M xxx
It is to stress test memory copy, invert, crc check for 1hour with 900Mb memory.
-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)
c00390379@u138-103:~/aosp$ source build/envsetup.sh
c00390379@u138-103:~/aosp$ lunch aosp_arm64-userdebug
c00390379@u138-103:~/aosp$ make -j48 stressapptest
即可编译出 stressapptest
将该文件push到手机/system/bin/目录下
kirin970:/ # cat /proc/meminfo
MemTotal: 5663188 kB
MemFree: 2001254 kB
MemAvailable: 1920436 kB
Buffers: 4488 kB
Cached: 1271728 kB
SwapCached: 0 kB
.......................
MemFree的值大概可以作为-M的参数
kirin970:/ # stressapptest -s 1000 -m 7 -i 5 -c 4 -C 4 -M 2002 //测试命令
参考网址: http://blog.sina.com.cn/s/blog_96a11ddf0101sqwq.html

浙公网安备 33010602011771号