Linux下磁盘IO读写性能测试脚本
#!/bin/sh #author:reed #blog:luweikai.blog.51cto.com #说明:使用自带的dd命令 file=dd.file BS_COUNT_8K=(8K 12K) BS_COUNT_64K=(64K 6K) BS_COUNT_1M=(1M 1K) list="8K 64K 1M" wlog=/tmp/ddwrite.log rlog=/tmp/ddread.log #write Write() { echo "[INFO]WRITE" for i in $list;do bs=$(eval echo \$\{BS_COUNT_$i\[0\]\}) count=$(eval echo \$\{BS_COUNT_$i\[1\]\}) echo "dd if=/dev/zero of=$file conv=fsync oflag=direct bs=$bs count=$count" dd if=/dev/zero of=$file conv=fsync oflag=direct bs=$bs count=$count 2>>$wlog echo " " #echo "sleep 3" sleep 3 done } #read Read() { echo "[INFO]READ" for i in $list;do bs=$(eval echo \$\{BS_COUNT_$i\[0\]\}) count=$(eval echo \$\{BS_COUNT_$i\[1\]\}) echo "dd if=$file of=/dev/null iflag=direct bs=$bs count=$count" dd if=$file of=/dev/null iflag=direct bs=$bs count=$count 2>> $rlog echo " " #echo "sleep 3" sleep 3 done } Write|tee -a $wlog echo "please wait 5 seconds......" sleep 5 Read|tee -a $rlog
本文出自 “[reed@卢伟开~]#rm -rf /” 博客,请务必保留此出处http://luweikai.blog.51cto.com/1705672/1547114
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。