All pastes #895797 Raw Edit

Something

public shellscript v1 · immutable
·published 2008-02-08 02:24 UTC
rendered paste body
#SIZE=10240#SIZE=2048SIZE="$1"COUNT=3WRITES="0"for i in $(seq 1 $COUNT)do	echo -ne "write $i:\t"	sync	echo 3 > /proc/sys/vm/drop_caches	CMD="time -p sh -c \"dd if=/dev/zero of=disk.img bs=1M count=$SIZE ; sync\" 2> /dev/null"	OUTPUT=$(sh -c "$CMD" 2>&1 | grep real | awk '{print $2}')	echo "$OUTPUT"	WRITES="$WRITES+$OUTPUT"doneecho echo -e "average: \t$(echo "scale=2;($WRITES)/$COUNT" | bc)"echo -e "MB/s:\t\t$(echo "scale=1;$SIZE/(($WRITES)/$COUNT)" | bc)"echoechoREADS="0"for i in $(seq 1 $COUNT)do	echo -ne "read $i: \t"	sync	echo 3 > /proc/sys/vm/drop_caches	CMD="time -p sh -c \"dd if=disk.img of=/dev/null bs=1M count=$SIZE ; sync\" 2> /dev/null"	OUTPUT=$(sh -c "$CMD" 2>&1 | grep real | awk '{print $2}')	echo "$OUTPUT"	READS="$READS+$OUTPUT"doneecho echo -e "average: \t$(echo "scale=2;($READS)/$COUNT" | bc)"echo -e "MB/s:\t\t$(echo "scale=1;$SIZE/(($READS)/$COUNT)" | bc)"