test/qos: update the IO result calculation
There is possible overflow when getting throughput as that value is in byte and we also use tick for the calculation. Change-Id: Id1f0fd4903af5e8362f1fcafebac33223d36eb34 Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475475 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
4342c0f0d5
commit
9b47757bc3
@ -76,7 +76,14 @@ function get_io_result() {
|
||||
fi
|
||||
ticks_after=$(echo $io_result | jq -r '.ticks')
|
||||
|
||||
echo $((((io_result_after-io_result_before)*tick_rate)/(ticks_after-ticks_before)))
|
||||
if [ $limit_type = IOPS ]; then
|
||||
io_result_diff=$((io_result_after-io_result_before))
|
||||
else
|
||||
# To avoid potential overflow as throughput is in byte
|
||||
# Return throughput in kilobyte
|
||||
io_result_diff=$(((io_result_after-io_result_before)/1024))
|
||||
fi
|
||||
echo $(((io_result_diff*tick_rate)/(ticks_after-ticks_before)))
|
||||
}
|
||||
|
||||
function run_qos_test() {
|
||||
@ -85,11 +92,11 @@ function run_qos_test() {
|
||||
|
||||
qos_result=$(get_io_result $2)
|
||||
if [ $2 = BANDWIDTH ]; then
|
||||
qos_limit=$((qos_limit*1024*1024))
|
||||
qos_limit=$((qos_limit*1024))
|
||||
fi
|
||||
lower_limit=$((qos_limit*9/10))
|
||||
upper_limit=$((qos_limit*11/10))
|
||||
|
||||
lower_limit=$(echo "$qos_limit 0.9" | awk '{printf("%i",$1*$2)}')
|
||||
upper_limit=$(echo "$qos_limit 1.1" | awk '{printf("%i",$1*$2)}')
|
||||
# QoS realization is related with bytes transfered. It currently has some variation.
|
||||
if [ $qos_result -lt $lower_limit ] || [ $qos_result -gt $upper_limit ]; then
|
||||
echo "Failed to limit the io read rate of NULL bdev by qos"
|
||||
|
Loading…
x
Reference in New Issue
Block a user