Created
February 23, 2015 11:40
-
-
Save youyo/0bca9672ad665b33c262 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -u | |
| #BS=('4k' '16k' '1m') | |
| #TYPE=('read' 'write' 'randread' 'randwrite') | |
| #IODEPTH=(1 2 4 8 16 32 64) | |
| BS=('4k') | |
| TYPE=('read' 'write' 'randread' 'randwrite') | |
| IODEPTH=(1 2 4 8 16 32 64) | |
| OUTPUT='/tmp/fio.json' | |
| BASE_CMD='fio -ioengine=libaio -direct=1 -invalidate=1 -filename=/tmp/fio.bin -size=10G -numjobs=1 -runtime=60 -group_reporting -name=fio --output-format=json' | |
| rm -f $OUTPUT{} | |
| for blocksize in ${BS[@]}; do | |
| for rwtype in ${TYPE[@]}; do | |
| TMPIOPS=() | |
| TMPBW=() | |
| for iodepth in ${IODEPTH[@]}; do | |
| TMPFILE=`mktemp` | |
| ${BASE_CMD} -rw=${rwtype} -bs=${blocksize} -iodepth=${iodepth} --output ${TMPFILE} | |
| case ${rwtype} in | |
| 'read' ) | |
| IOPS=`cat ${TMPFILE} | jq ."jobs[0].read.iops"` | |
| BW=`cat ${TMPFILE} | jq ."jobs[0].read.bw"` | |
| ;; | |
| 'randread' ) | |
| IOPS=`cat ${TMPFILE} | jq ."jobs[0].read.iops"` | |
| BW=`cat ${TMPFILE} | jq ."jobs[0].read.bw"` | |
| ;; | |
| 'write' ) | |
| IOPS=`cat ${TMPFILE} | jq ."jobs[0].write.iops"` | |
| BW=`cat ${TMPFILE} | jq ."jobs[0].write.bw"` | |
| ;; | |
| 'randwrite' ) | |
| IOPS=`cat ${TMPFILE} | jq ."jobs[0].write.iops"` | |
| BW=`cat ${TMPFILE} | jq ."jobs[0].write.bw"` | |
| ;; | |
| esac | |
| TMPIOPS+=( ${IOPS} ) | |
| TMPBW+=( ${BW} ) | |
| rm -f ${TMPFILE} | |
| sleep 60 | |
| done | |
| echo "{\"blocksize\": \"${blocksize}\", \"rwtype\": \"${rwtype}\", \"iops\": [`echo ${TMPIOPS[@]} | tr -s ' ' ','`], \"bw\": [`echo ${TMPBW[@]} | tr -s ' ' ','`]}" >> ${OUTPUT} | |
| done | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment