
12
Listing 1 – Iozone startup script
#!/bin/ksh
#===============================================================#
# run_iozone - A wrapper script for automating IOZone runs. #
#---------------------------------------------------------------#
# - Andy Loftus - Original script #
# 20050502 - Chad Kerner - Changed to create files of different #
# - names when testing parallel file systems, changed #
# - to generate and Excel file automatically and added #
# - some comments on what the fileds mean. #
#===============================================================#
# Fully qualified path to IOZone
PRG=/usr/local/bin/iozone
# Filesystem to test
FILESYSTEM=/mnt/iscsi-sw
# Variable Settings
FILENAME=`uname -n | sed -e 's/\./ /g' | awk '{print($1)}'`
# Filesize
MIN_FILE=512m
MAX_FILE=8g
# Record size
MIN_RECORD=2k
MAX_RECORD=1m
# Use SYNC to clear buffer cache
FORCE_SYNC=1
# How many times to run the test
REPEAT=1
# Which tests to run
# 0 - write/re-write
# 1 - read/re-read
# 2 - random read/write
# 3 - read backwards
# 4 - rewrite record
# 5 - stride read
# 6 - fwrite/re-fwrite
# 7 - fread/re-fread
# 8 - random mix
# 9 - pwrite/re-pwrite
# 10 - pread/re-pread
# 11 - pwritev/re-pwritev
# 12 - preadv/re-preadv
FILE_OPTIONS=""
#FILE_TESTS="0 1 2 3 4 5 6 7 8"
FILE_TESTS="0 1"
for i in `echo ${FILE_TESTS}`
do FILE_OPTIONS="${FILE_OPTIONS} -i $i"
done
# Multi-thread options
#MIN_THREADS=1
#MAX_THREADS=4
#USE_POSIX_THREADS=1
#if [[ ${MAX_THREADS} -gt 1 ]] ; then
# MULTI_THREAD_OPTS="${USE_POSIX_THREADS:+-T} -l ${MIN_THREADS} -u ${MAX_THREADS}"
#fi
# Excel output
EXCEL_OUT=1
echo ${EXCEL_FILE}
set -x
for i in $(seq 1 ${REPEAT})
do
DATE=`date +%Y%m%d_%H%M%S`
EXCEL_FILE="${FILENAME}_${DATE}.wks"
/usr/bin/time \
${PRG} \
-az \
${EXCEL_OUT:+-R} \
${EXCEL_FILE:+-b ${EXCEL_FILE}} \
${FORCE_SYNC:+-e} \
-f ${FILESYSTEM}/${FILENAME} \
-n ${MIN_FILE} \
-g ${MAX_FILE} \
-y ${MIN_RECORD} \
-q ${MAX_RECORD} \
${FILE_OPTIONS} \
1> ${FILENAME}_${DATE}.out 2>&1
done