3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
14 # Commandline arguments
18 OUTPUT_FILE="yardstick-fio.log"
20 # setup data file for fio
23 if [ ! -f $FIO_FILENAME ]; then
24 dd if=/dev/zero of=$FIO_FILENAME bs=1M count=1024 oflag=direct > /dev/null 2>&1
31 fio $OPTIONS --output=$OUTPUT_FILE
34 # write the result to stdout in json format
37 read_bw=$(grep "READ.*aggrb" $OUTPUT_FILE | awk -F [=\ ,] '{printf $9}')
38 write_bw=$(grep "WRITE.*aggrb" $OUTPUT_FILE | awk -F [=\ ,] '{printf $8}')
39 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)}')
40 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)}')
42 read_bw=${read_bw:-N/A}
43 write_bw=${write_bw:-N/A}
44 read_iops=${read_iops:-N/A}
45 write_iops=${write_iops:-N/A}
46 if [ "x$read_lat" = "x" ]; then
49 read_lat=$read_lat$read_lat_unit
51 if [ "x$write_lat" = "x" ]; then
54 write_lat=$write_lat$write_lat_unit
58 \"read_bw\":\"$read_bw\", \
59 \"write_bw\":\"$write_bw\", \
60 \"read_iops\":\"$read_iops\", \
61 \"write_iops\":\"$write_iops\", \
62 \"read_lat\":\"$read_lat\", \
63 \"write_lat\":\"$write_lat\" \