1. 代码下载:
https://pyropus.ca/software/memtester/
2. 将代码解压到android external目录下
tar xzvf memtester-4.3.0.tar.gz -C external/
3. 添加Android.mk,内容如下
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libutils
LOCAL_MODULE:=memtester
LOCAL_MODULE_TAGS:=optional
LOCAL_SRC_FILES:= \
memtester.c \
tests.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/
include $(BUILD_EXECUTABLE)
include $(call all-makefiles-under,$(LOCAL_PATH))
4. 编译
mmm external/memtester-4.3.0/
adb mount -o remount rw /
adb remount
adb push out/target/product/hikey/system/bin/memtester /system/bin/
5. 测试(附上测试结果如下)
root@hikey:/ # memtester 1m 1
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).
pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 1MB (1048576 bytes)
got 1MB (1048576 bytes), trying mlock ...locked.
Loop 1/1:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
Done.