fio_shell.sh

 

@echo off
echo -----------------------------------------------------------
echo If you want modify the test time, plese view fio_shell.sh!
echo -----------------------------------------------------------
adb wait-for-device
adb root
adb remount
adb push fio /system/bin/
adb push fio_shell.sh /data/
adb shell chmod 777 /data/fio_shell.sh
adb shell chmod 777 /system/bin/fio
adb shell dos2unix /data/fio_shell.sh
echo "adb shell /data/fio_shell.sh> fio_result.log"
adb shell "/data/fio_shell.sh"> fio_result.log
echo Please view fio_result.log
pause

 

#fio_shell.sh
#-runtime: test time (default time:10seconds)
cmd="fio -filename=/data/temp -thread -direct=1 -bs=4k -ioengine=psync -numjobs=16 -percentage_random=80 -iodepth=5 -rw=randrw -rwmixread=80 -size=30G -runtime=10 -time_based -group_reporting -name=test"

#echo "-thread"
random=$(($RANDOM % 2))
if [ $random -eq 1 ]; then
cmd=${cmd/-thread/}
fi

#echo "-direct"
random=$(($RANDOM % 4))
#echo $random
if [ $random -eq 0 ]; then
cmd=${cmd/direct=1/direct=0}
fi

#echo "-bs"
random=$(($RANDOM % 9 + 2))
#bs=$[2**$random]
if [[ $random -eq 2 ]]; then
bs=4
elif [[ $random -eq 3 ]]; then
bs=8
elif [[ $random -eq 4 ]]; then
bs=16
elif [[ $random -eq 5 ]]; then
bs=32
elif [[ $random -eq 6 ]]; then
bs=64
elif [[ $random -eq 7 ]]; then
bs=128
elif [[ $random -eq 8 ]]; then
bs=256
elif [[ $random -eq 9 ]]; then
bs=512
else
bs=1024
fi

#echo bs:$bs
cmd=${cmd/bs=4/bs=$bs}

#echo "-ioengine"
random=$RANDOM
if [ $(($random % 13)) -eq 0 ]; then
cmd=${cmd/psync/splice}
elif [ $(($random % 11)) -eq 0 ]; then
cmd=${cmd/psync/mmap}
elif [ $(($random % 7)) -eq 0 ]; then
cmd=${cmd/psync/vsync}
elif [ $(($random % 4)) -eq 0 ]; then
cmd=${cmd/psync/psync}
else
cmd=${cmd/psync/sync}
fi

#echo "-rwmixread"
if [[ $cmd == *-rwmixread* ]]; then
cmd=${cmd/-rwmixread=80/-rwmixread=$(($RANDOM % 100))}
fi

#echo "-numjobs"
random=$(($RANDOM % 13 + 6))
cmd=${cmd/numjobs=16/numjobs=$random}
echo $cmd
$cmd

 

posted @ 2017-10-10 20:28  牧 天  阅读(410)  评论(0)    收藏  举报