From 4492c5cfbe0e99666afed6780b674beaa670d1a1 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 23 Nov 2018 09:27:06 -0800 Subject: [bash] Let's try to use emacs tty --- playgrounds/fio/runner.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 playgrounds/fio/runner.sh (limited to 'playgrounds/fio/runner.sh') diff --git a/playgrounds/fio/runner.sh b/playgrounds/fio/runner.sh new file mode 100755 index 0000000..8df8895 --- /dev/null +++ b/playgrounds/fio/runner.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +## Helper script to run fio tests and generate reports + +DATA_DIR=./data +LOG_DIR=./logs +REPORT_DIR=./reports + +FIO_BIN=./usr/bin/fio +if [ "${2}x" != "x" ]; then + FIO_BIN=${2} +fi + +FIOS_LIST=$(ls *.fio) +NOW_EPOCH=$(date +"%s") +LOG_DIR_READS=${LOG_DIR}/reads +LOG_DIR_WRITES=${LOG_DIR}/writes + +# create required directories +mkdir -p ${DATA_DIR} + +if [ -d "${REPORT_DIR}" ]; then + echo "Report directory exists, archiving using current timestamp: ${NOW_EPOCH}" + mv ${REPORT_DIR} ${REPORT_DIR}_${NOW_EPOCH} +fi +mkdir -p ${REPORT_DIR} + +if [ -d "${LOG_DIR}" ]; then + echo "Log directory exists, archiving using current timestamp: ${NOW_EPOCH}" + mv ${LOG_DIR} ${LOG_DIR}_${NOW_EPOCH} +fi +mkdir -p ${LOG_DIR_WRITES} +mkdir -p ${LOG_DIR_READS} + +# run all fios in sequential order +for i in $(echo ${FIOS_LIST} | tr " " "\n") +do + echo -e "\nStarting fio test ${i}..." + ${FIO_BIN} ./${i} --output ${REPORT_DIR}/${i}.out + + mv *read*.log ${LOG_DIR_READS}/ + mv *write*.log ${LOG_DIR_WRITES}/ + + rm -f data/* # delete created fio files after each run + + echo "Completed fio test ${i}." +done + +# plot reports to svg +FIO_PLOT_BIN=./usr/bin/fio_generate_plots +if type "${FIO_PLOT_BIN}" > /dev/null && type "gnuplot" > /dev/null; then + + echo "fio_generate_plots is installed generating svg reports based on fio logs" + + ( cd ${LOG_DIR_READS} && for f in *.log; do mv $f ${f/.[1-3]/}; done && ${FIO_PLOT_BIN} "All-Reads" ) + ( cd ${LOG_DIR_WRITES} && for f in *.log; do mv $f ${f/.[1-3]/}; done && ${FIO_PLOT_BIN} "All-Writes" ) + + mv ${LOG_DIR_READS}/*.svg ${REPORT_DIR}/ + mv ${LOG_DIR_WRITES}/*.svg ${REPORT_DIR}/ +fi -- cgit 1.4.1