4 filesize=100 # megabytes
12 if uname -a | grep --silent arwin ; then
18 while [ $# -gt 1 ] ; do
20 -d) dir=$2; shift; shift ;;
21 -f) filesize=$2; shift; shift ;;
22 -n) numfiles=$2; shift; shift ;;
23 -M) args="$args -M"; shift ;;
24 -D) args="$args -D"; shift ;;
25 -R) args="$args -R"; shift ;;
30 if [ -d $dir -a -f $dir/testfile_1 ] ; then
31 # dir exists and has a testfile within it - reuse to avoid
33 echo "# Re-using files in $dir"
40 echo "Cannot create testfile directory $dir"
45 if [ x$needfiles != x ] ; then
46 echo "# Building files for test..."
47 if [ x$interleave = x ] ; then
50 # Create all files sequentially
53 for i in `seq 1 $numfiles` ; do
54 dd of=$dir/testfile_$i if=/dev/zero bs=1$ddmega count=$filesize >/dev/null 2>&1
59 # Create files interleaved, adding $write_blocksize to each
64 limit=`expr $filesize * 1048576`
65 while [ $size -lt $limit ] ; do
66 for i in `seq 1 $numfiles` ; do
67 dd if=/dev/zero bs=$write_blocksize count=1 >> $dir/testfile_$i 2>/dev/null
69 size=`expr $size + $write_blocksize`
76 if uname -a | grep --silent arwin ; then
77 # clears cache on OS X
79 elif [ -f /proc/sys/vm/drop_caches ] ; then
80 # Linux cache clearing
81 echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
83 # need an alternative for other operating systems
87 echo "# Blocksize $bs"
88 ./readtest $args -b $bs -q $dir/testfile_%d