From: Sitsofe Wheeler Date: Sun, 1 Oct 2017 08:07:15 +0000 (+0100) Subject: fio_generate_plots: cope with per_job_logs filenames X-Git-Tag: fio-3.2~42^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=45be22df81f10ef9d45a30bd06343ae630dcfee0;hp=f7c9bfd57232c6e11623d741be340d32f796c726 fio_generate_plots: cope with per_job_logs filenames - Teach fio_generate_plots how to find log files that are generated when per_job_logs=1 (which has been the fio default for a while). - Make fio_generate_plots spit out an error message when no log files are found. Fixes: https://github.com/axboe/fio/issues/43 Fixes: https://github.com/axboe/fio/issues/323 Signed-off-by: Sitsofe Wheeler --- diff --git a/tools/fio_generate_plots b/tools/fio_generate_plots index a47bfa5c..8872206e 100755 --- a/tools/fio_generate_plots +++ b/tools/fio_generate_plots @@ -93,20 +93,26 @@ plot () { i=0 - for x in *_"$FILETYPE".log + for x in *_"$FILETYPE".log *_"$FILETYPE".*.log do - i=$((i+1)) - PT=$(echo $x | sed s/_"$FILETYPE".log//g) - if [ ! -z "$PLOT_LINE" ] - then - PLOT_LINE=$PLOT_LINE", " + if [ -e "$x" ]; then + i=$((i+1)) + PT=$(echo $x | sed 's/\(.*\)_'$FILETYPE'\(.*\).log$/\1\2/') + if [ ! -z "$PLOT_LINE" ] + then + PLOT_LINE=$PLOT_LINE", " + fi + + DEPTH=$(echo $PT | cut -d "-" -f 4) + PLOT_LINE=$PLOT_LINE"'$x' using (\$1/1000):(\$2/$SCALE) title \"Queue depth $DEPTH\" with lines ls $i" fi - - DEPTH=$(echo $PT | cut -d "-" -f 4) - PLOT_LINE=$PLOT_LINE"'$x' using (\$1/1000):(\$2/$SCALE) title \"Queue depth $DEPTH\" with lines ls $i" - done + if [ $i -eq 0 ]; then + echo "No log files found" + exit 1 + fi + OUTPUT="set output \"$TITLE-$FILETYPE.svg\" " echo " $PLOT_TITLE ; $YAXIS ; $DEFAULT_OPTS ; show style lines ; $OUTPUT ; plot " $PLOT_LINE | $GNUPLOT -