一个测试tf卡性能的脚本

来源:互联网 发布:个体户注册域名 编辑:程序博客网 时间:2024/06/05 17:23
#exec 2>tf.log#set -x#dd.sh 测试次数 每次写多少块total_sum=0average=0total_times=0min=888888max=0LIMIT=$1target=1tf_card_path="/home/tf"`mount -t vfat /dev/mmcblk0p1 ``mount -t vfat /dev/mmcblk0 $tf_card_path``mount -t exfat /dev/mmcblk0p1 $tf_card_path``mount -t exfat /dev/mmcblk0 $tf_card_path`while [ "$target" -le $LIMIT ]dodd if=/dev/zero of=$tf_card_path/$target.bin bs=1024K count=$2 2>tf.logtype=`cat tf.log | grep seconds | cut -d , -f 3 | cut -d K -f 2`if [ -z $type ] then`cat tf.log``umount  $tf_card_path`exit 1fiif [ "$type" == "B/s" ]then #KBresult=`cat tf.log | grep seconds | cut -d , -f 3 | cut -d K -f 1`else #MBresult=`cat tf.log | grep seconds | cut -d , -f 3 | cut -d M -f 1`result=`echo $result | awk '{ printf "%0.2f\n" ,$1*1024}'`fitotal_sum=`echo $total_sum $result | awk '{ printf "%0.2f\n" ,$1+$2}'`echo result:$result total_sum:$total_sumtotal_times=`expr $total_times + 1`int_result=`echo $result | cut -d . -f 1`int_min=`echo $min | cut -d . -f 1`int_max=`echo $max | cut -d . -f 1`if [ $int_result -lt $int_min ]thenmin=$resultfiif [ $int_result -gt $int_max ]thenmax=$resultfilet "target+=1"done`umount  $tf_card_path`average=`echo $total_sum $total_times | awk '{ printf "%0.2f\n" ,$1/$2}'`echo -e "\033[32m total_times:$total_times \n total_sum:$total_sum\n average:$average KB/s\n max:$max KB/s\n min:$min KB/s \033[0m"