c语言测试emmc读写速度,dd 根据不同block size 测试eMMC 读写速度

因项目需求,写了一个读写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/dropc​achesddif=/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)

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值