linux下移植参考:
android下移植参考:
编译生成memtester可执行bin文件:
# ./memtester 10M 1 memtester version 4.2.2 (64-bit) Copyright (C) 2010 Charles Cazabon. Licensed under the GNU General Public License version 2 (only). pagesize is 4096 pagesizemask is 0xfffffffffffff000 want 10MB (10485760 bytes) got 10MB (10485760 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.
#/bin/sh ok_num=$(/data/local/tmp/memtester 10M 1 | grep "ok" | wc -l) if [ $ok_num = 16 ];then echo "test mem success" else echo "test mem failed" fi执行sh脚本,获取memtester测试内存的结果。