因项目需求,写了一个读写eMMC 的脚本来测试eMMC 读写速度
写速度测试脚本:
#!/bin/bash
TEST_FILE_SIZE=134217728
Block sizes of 512b 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M 2M 4M 8M 16M 32M 64M
for BLOCK_SIZE in 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864
do
Calculate number of segments required to copy
COUNT=( ( ((((TEST_FILE_SIZE/$BLOCK_SIZE))
if [ $COUNT -le 0 ];
then
echo"Block size of $BLOCK_SIZE estimated to require C O U N T b l o c k s , a b o r t i n g f u r t h e r t e s t s . " b r e a k f i e c h o 3 > / p r o c / s y s / v m / d r o p c a c h e s d d i f = / d e v / z e r o o f = / v a r / t e s t . d b f b s = COUNT blocks, aborting further tests." break fi echo 3>/proc/sys/vm/drop_caches dd if=/dev/zero of=/var/test.dbf bs=COUNTblocks,abortingfurthertests."breakfiecho3>/proc/sys/vm/dropcachesddif=/dev/zeroof=/var/test.dbfbs=BLOCK_SIZE count=$COUNT;sync
rm /var/test.dbf
sync
done
测试结果:
262144+0 records in
262144+0 records out
134217728 bytes transferred in 7.305 secs (18373405 bytes/sec)
131072+0 records in
131072+0 records out
134217728 bytes transferred in 4.859 secs (27622500 bytes/sec)