4 filesize=100 # megabytes
11 if uname -a | grep --silent arwin ; then
17 while [ $# -gt 1 ] ; do
19 -d) dir=$2; shift; shift ;;
20 -f) filesize=$2; shift; shift ;;
21 -n) numfiles=$2; shift; shift ;;
22 -N) nocache="-s"; shift; shift ;;
23 -b) blocksize=$2; shift; shift ;;
27 if [ -d $dir -a -f $dir/testfile_1 ] ; then
28 # dir exists and has a testfile within it - reuse to avoid
30 echo "Re-using files in $dir"
37 echo "Cannot create testfile directory $dir"
42 if [ x$needfiles != x ] ; then
43 if [ x$interleave = x ] ; then
46 # Create all files sequentially
49 for i in `seq 1 $numfiles` ; do
50 dd of=$dir/testfile_$i if=/dev/zero bs=1$ddmega count=$filesize
56 # Create files interleaved, adding $blocksize to each
61 limit=`expr $filesize * 1048576`
62 while [ $size -lt $limit ] ; do
63 for i in `seq 1 $numfiles` ; do
64 dd if=/dev/zero bs=$blocksize count=1 >> $dir/testfile_$i
66 size=`expr $size + $blocksize`
67 echo "Files now @ $size bytes"
72 if uname -a | grep --silent arwin ; then
73 # clears cache on OS X
75 elif [ -f /proc/sys/vm/drop_cache ] ; then
76 # Linux cache clearing
77 echo 3 | sudo tee /proc/sys/vm/drop/cache >/dev/null
79 # need an alternative for other operating systems
83 echo "Ready to run ..."
85 ./readtest $nocache -b $blocksize -q $dir/testfile_%d