Commit ac8921f5 authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

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: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451885


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent c55c85f8
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -14,27 +14,28 @@ 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

	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")

	if [ $LIMIT_TYPE = IOPS ]; then
		end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
		read_result=$(((end_io_count-start_io_count)/5))
	else
		end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
		read_result=$(((end_bytes_read-start_bytes_read)/5))
	fi

	read_result=$(((end_io_count-start_io_count)/5))

	if [ $enable_limit = true ]; then
		#qos realization is related with bytes transfered.It currently have like 5% variation.
		retval=$(echo "$qos_limit*0.85 < $read_result && $read_result < $qos_limit*1.05" | bc)