X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fscenarios%2Fstorage%2Ffio_benchmark.bash;h=2ef7f4949b8edabd78cbf8a4bd3196840eb59b48;hb=51b902b9d9d7a641357dd615dcd5a5529bffc8bb;hp=0fa319dd47fcc508711d0abdb8441965d83ef0ed;hpb=6b667910909b332e78105ccdf17e39e4b286ed39;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/storage/fio_benchmark.bash b/yardstick/benchmark/scenarios/storage/fio_benchmark.bash index 0fa319dd4..2ef7f4949 100644 --- a/yardstick/benchmark/scenarios/storage/fio_benchmark.bash +++ b/yardstick/benchmark/scenarios/storage/fio_benchmark.bash @@ -15,7 +15,6 @@ set -e FIO_FILENAME=$1 shift OPTIONS="$@" -OUTPUT_FILE="yardstick-fio.log" # setup data file for fio setup() @@ -25,43 +24,10 @@ setup() fi } -# run fio test +# run fio test and write json format result to stdout run_test() { - fio $OPTIONS --output=$OUTPUT_FILE -} - -# write the result to stdout in json format -output_json() -{ - read_bw=$(grep "READ.*aggrb" $OUTPUT_FILE | awk -F [=\ ,] '{printf $9}') - write_bw=$(grep "WRITE.*aggrb" $OUTPUT_FILE | awk -F [=\ ,] '{printf $8}') - eval $(grep -e '\ lat.*stdev' -e "read.*iops" -e "write.*iops" -e "trim.*iops" $OUTPUT_FILE | sed 'N;s/\n/ /g' | grep read | awk -F [=\ ,\(\)] '{printf("read_iops=%s; read_lat_unit=%s; read_lat=%s", $12, $24, $33)}') - eval $(grep -e '\ lat.*stdev' -e "read.*iops" -e "write.*iops" -e "trim.*iops" $OUTPUT_FILE | sed 'N;s/\n/ /g' | grep write | awk -F [=\ ,\(\)] '{printf("write_iops=%s; write_lat_unit=%s; write_lat=%s", $11, $23, $32)}') - - read_bw=${read_bw:-N/A} - write_bw=${write_bw:-N/A} - read_iops=${read_iops:-N/A} - write_iops=${write_iops:-N/A} - if [ "x$read_lat" = "x" ]; then - read_lat="N/A" - else - read_lat=$read_lat$read_lat_unit - fi - if [ "x$write_lat" = "x" ]; then - write_lat="N/A" - else - write_lat=$write_lat$write_lat_unit - fi - - echo -e "{ \ - \"read_bw\":\"$read_bw\", \ - \"write_bw\":\"$write_bw\", \ - \"read_iops\":\"$read_iops\", \ - \"write_iops\":\"$write_iops\", \ - \"read_lat\":\"$read_lat\", \ - \"write_lat\":\"$write_lat\" \ - }" + fio $OPTIONS } # main entry @@ -71,10 +37,7 @@ main() setup # run the test - run_test >/dev/null - - # output result - output_json + run_test } main