From: Qian Yingjin Date: Thu, 29 Jun 2017 09:03:44 +0000 (+0800) Subject: LU-9140 nrs: measure the runtime of dd directly X-Git-Tag: 2.10.55~46 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=66abf6ffe9f032aaa7c271ee2bd1f9b569058bd5 LU-9140 nrs: measure the runtime of dd directly This patch changes the way to measure the runtime of "dd". Instead of parsing the output of "dd", we use date command to calculate the runtime of dd directly, avoiding the parsing failure caused by changed output format of "dd". Change-Id: Ibd2e3963f791404ee927981238227012cf4dbf2c Test-Parameters: trivial testlist=sanityn Signed-off-by: Qian Yingjin Reviewed-on: https://review.whamcloud.com/27878 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: Minh Diep Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index c20f7f7..821cae9 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -3161,33 +3161,41 @@ tbf_verify() { local client1=${CLIENT1:-$(hostname)} local myRUNAS="$3" + local np=$(check_cpt_number ost1) + [ $np -gt 0 ] || error "CPU partitions should not be $np." + echo "cpu_npartitions on ost1 is $np" + mkdir $dir || error "mkdir $dir failed" - $LFS setstripe -c 1 $dir || error "setstripe to $dir failed" + $LFS setstripe -c 1 -i 0 $dir || error "setstripe to $dir failed" chmod 777 $dir trap cleanup_tbf_verify EXIT echo "Limited write rate: $1, read rate: $2" echo "Verify the write rate is under TBF control" - local runtime=$(do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \ - bs=1M count=100 oflag=direct 2>&1 | awk '/bytes/ {print $6}') + local start=$SECONDS + do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \ + bs=1M count=100 oflag=direct 2>&1 + local runtime=$((SECONDS - start + 1)) local rate=$(bc <<< "scale=6; 100 / $runtime") echo "Write runtime is $runtime s, speed is $rate IOPS" - # verify the write rate does not exceed 110% of TBF limited rate - [ $(bc <<< "$rate < 1.1 * $1") -eq 1 ] || - error "The write rate ($rate) exceeds 110% of preset rate ($1)" + # verify the write rate does not exceed TBF rate limit + [ $(bc <<< "$rate < 1.1 * $np * $1") -eq 1 ] || + error "The write rate ($rate) exceeds 110% of rate limit ($1 * $np)" cancel_lru_locks osc echo "Verify the read rate is under TBF control" - runtime=$(do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \ - bs=1M count=100 iflag=direct 2>&1 | awk '/bytes/ {print $6}') + start=$SECONDS + do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \ + bs=1M count=100 iflag=direct 2>&1 + runtime=$((SECONDS - start + 1)) rate=$(bc <<< "scale=6; 100 / $runtime") echo "Read runtime is $runtime s, speed is $rate IOPS" - # verify the read rate does not exceed 110% of TBF limited rate - [ $(bc <<< "$rate < 1.1 * $2") -eq 1 ] || - error "The read rate ($rate) exceeds 110% of preset rate ($2)" + # verify the read rate does not exceed TBF rate limit + [ $(bc <<< "$rate < 1.1 * $np * $2") -eq 1 ] || + error "The read rate ($rate) exceeds 110% of rate limit ($2 * $np)" cancel_lru_locks osc cleanup_tbf_verify || error "rm -rf $dir failed"