Android使用内存压力测试工具 StressAppTest
StressAppTest:一款用于测试系统内存、CPU 和显存稳定性的开源压力测试工具。
下载源码github:stressapptest/stressapptest: Stressful Application Test - userspace memory and IO test
添加external/stressapptest/到external/stressapptest/下,其实不添加也可以。sdk有自带
在project device/mediatek/system/common/下做如下修改:将stressapptest 工具放入 system/bin
project device/mediatek/system/common/
diff --git a/device.mk b/device.mk
index d30410d..7f5cec1 100755
--- a/device.mk
+++ b/device.mk
@@ -38,8 +38,8 @@ PRODUCT_PACKAGES += SoundRecorderPRODUCT_COPY_FILES += $(LOCAL_PATH)/bootanimation.zip:system/media/bootanimation.zipPRODUCT_PACKAGES += rkp_factory_extraction_tool
-
-
+PRODUCT_PACKAGES += stressapptest# Support 3 additional VNDK version(P, Q and R) before S for VF(GRF)ifeq (true, $(MSSI_MTK_VSDK))OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS := 31 33 34 35 #VSDK is deprecated
测试:
用 8 个线程占用 1000 MB 内存,进行写入验证测试,持续 10 秒
:/ $ stressapptest -s 10 -M 1000 -W -m 8
2025/09/03-03:07:22(GMT) Log: Commandline - stressapptest -s 10 -M 1000 -W -m 8
2025/09/03-03:07:22(GMT) Stats: SAT revision 1.0.9_autoconf, 64 bit binary
2025/09/03-03:07:22(GMT) Log: Android version from open source release
2025/09/03-03:07:22(GMT) Log: 1 nodes, 8 cpus.
2025/09/03-03:07:22(GMT) Log: Prefer plain malloc memory allocation.
2025/09/03-03:07:22(GMT) Log: Using mmap() allocation at 0x6d77d2e000.
2025/09/03-03:07:22(GMT) Stats: Starting SAT, 1000M, 10 seconds
2025/09/03-03:07:23(GMT) Log: Region mask: 0x1
2025/09/03-03:07:33(GMT) Stats: Found 0 hardware incidents
2025/09/03-03:07:33(GMT) Stats: Completed: 83970.00M in 10.00s 8394.37MB/s, with 0 hardware incidents, 0 errors
2025/09/03-03:07:33(GMT) Stats: Memory Copy: 83970.00M at 8396.68MB/s
2025/09/03-03:07:33(GMT) Stats: File Copy: 0.00M at 0.00MB/s
2025/09/03-03:07:33(GMT) Stats: Net Copy: 0.00M at 0.00MB/s
2025/09/03-03:07:33(GMT) Stats: Data Check: 0.00M at 0.00MB/s
2025/09/03-03:07:33(GMT) Stats: Invert Data: 0.00M at 0.00MB/s
2025/09/03-03:07:33(GMT) Stats: Disk: 0.00M at 0.00MB/s
2025/09/03-03:07:33(GMT)
2025/09/03-03:07:33(GMT) Status: PASS - please verify no corrected errors
2025/09/03-03:07:33(GMT)