Skip to content

Instantly share code, notes, and snippets.

@hydra35
Created June 27, 2012 10:00
Show Gist options
  • Save hydra35/3003065 to your computer and use it in GitHub Desktop.
Save hydra35/3003065 to your computer and use it in GitHub Desktop.
fio testing script
#!/bin/bash
[[ $# -lt 2 ]] && exit 1
DEV="$1"
OUTDIR="$2"
[[ -d $OUTDIR ]] || mkdir -p $OUTDIR
BLOCK_SIZES="512 4K 8K 256K"
JOBS="write randwrite read randread"
gen_job_file() {
job=$1
block_size=$2
echo "[global]" > $job
echo "bs=$block_size" >> $job
echo "direct=1" >> $job
echo "rw=$job" >> $job
echo "ioengine=libaio" >> $job
echo "iodepth=8" >> $job
echo "runtime=20" >> $job
echo "[$DEV]" >> $job
}
cleanup() {
for job in $JOBS
do
rm -f $job
done
}
run_test() {
job=$1
block_size=$2
for i in {1..1}
do
fio --output="$OUTDIR/fio.$job.$block_size.$i.log" $job
done
}
# run all the jobs
for job in $JOBS
do
# generate job file for current job
for block_size in $BLOCK_SIZES
do
echo
echo "run $job in $block_size"
gen_job_file $job $block_size
run_test $job $block_size
done
done
cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment