From ac8921f56c0fc81c496898276b206f3559080836 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Wed, 24 Apr 2019 10:57:07 +0200 Subject: [PATCH] test/qos: use a single RPC for getting bandwidth and iops stats Do a single RPC instead of two, cache the result, parse it twice. Change-Id: Ib0ae19da5cb6b6db7bf1a46c3960104d1975afdd Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451885 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- test/iscsi_tgt/qos/qos.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/iscsi_tgt/qos/qos.sh b/test/iscsi_tgt/qos/qos.sh index 9eeeceb76..b4112a26c 100755 --- a/test/iscsi_tgt/qos/qos.sh +++ b/test/iscsi_tgt/qos/qos.sh @@ -14,26 +14,27 @@ function check_qos_works_well() { local qos_limit=$2 local check_qos=$4 local retval=0 + local iostats if [ $LIMIT_TYPE = BANDWIDTH ]; then qos_limit=$((qos_limit*1024*1024)) fi - if [ $LIMIT_TYPE = IOPS ]; then - start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops') - else - start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read') - fi + iostats=$($rpc_py get_bdevs_iostat -b $3) + start_io_count=$(jq -r '.bdevs[0].num_read_ops' <<< "$iostats") + start_bytes_read=$(jq -r '.bdevs[0].bytes_read' <<< "$iostats") $fio_py iscsi 1024 128 randread 5 1 - if [ $LIMIT_TYPE = IOPS ]; then - end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops') - else - end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read') - fi + iostats=$($rpc_py get_bdevs_iostat -b $3) + end_io_count=$(jq -r '.bdevs[0].num_read_ops' <<< "$iostats") + end_bytes_read=$(jq -r '.bdevs[0].bytes_read' <<< "$iostats") - read_result=$(((end_io_count-start_io_count)/5)) + if [ $LIMIT_TYPE = IOPS ]; then + read_result=$(((end_io_count-start_io_count)/5)) + else + read_result=$(((end_bytes_read-start_bytes_read)/5)) + fi if [ $enable_limit = true ]; then #qos realization is related with bytes transfered.It currently have like 5% variation.