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;;
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 echo "Building files for test..."
44 if [ x$interleave = x ] ; then
47 # Create all files sequentially
50 for i in `seq 1 $numfiles` ; do
51 dd of=$dir/testfile_$i if=/dev/zero bs=1$ddmega count=$filesize >/dev/null 2>&1
56 # Create files interleaved, adding $write_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=$write_blocksize count=1 >> $dir/testfile_$i 2>/dev/null
66 size=`expr $size + $write_blocksize`
73 if uname -a | grep --silent arwin ; then
74 # clears cache on OS X
76 elif [ -f /proc/sys/vm/drop_caches ] ; then
77 # Linux cache clearing
78 echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
80 # need an alternative for other operating systems
85 ./readtest $nocache -b $bs -q $dir/testfile_%d