#!/system/bin/sh
# 需要占用的IO大小,这里设置为1G
IO_SIZE=1024
# 清除写入的数据
function clean_data() {
echo "Cleaning data..."
rm /sdcard/iofile
}
# 判断参数个数
if [ $# -ne 1 ]
then
echo "Usage: $0 [start|stop]"
exit 1
fi
if [ $1 == "start" ]
then
echo "IO stress test started."
# 开始占用IO
while true
do
echo "Writing data..."
dd if=/dev/zero of=/sdcard/iofile bs=1M count=$IO_SIZE conv=notrunc
clean_data
done
elif [ $1 == "stop" ]
then
# 停止IO占用并清理文件
rm /sdcard/iofile
echo "IO stress test stopped."
else
echo "Usage: $0 [start|stop]"
fi