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 ;;
26 if [ -d $dir -a -f $dir/testfile_1 ] ; then
27 # dir exists and has a testfile within it - reuse to avoid
29 echo "# Re-using files in $dir"
36 echo "Cannot create testfile directory $dir"
41 if [ x$needfiles != x ] ; then
42 echo "# Building files for test..."
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 >/dev/null 2>&1
55 # Create files interleaved, adding $write_blocksize to each
60 limit=`expr $filesize * 1048576`
61 while [ $size -lt $limit ] ; do
62 for i in `seq 1 $numfiles` ; do
63 dd if=/dev/zero bs=$write_blocksize count=1 >> $dir/testfile_$i 2>/dev/null
65 size=`expr $size + $write_blocksize`
72 if uname -a | grep --silent arwin ; then
73 # clears cache on OS X
75 elif [ -f /proc/sys/vm/drop_caches ] ; then
76 # Linux cache clearing
77 echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
79 # need an alternative for other operating systems
83 echo "# Blocksize $bs"
84 ./readtest -b $bs -q $dir/testfile_%d