Whamcloud - gitweb
LU-9140 nrs: measure the runtime of dd directly 86/29686/2
authorQian Yingjin <qian@ddn.com>
Thu, 29 Jun 2017 09:03:44 +0000 (17:03 +0800)
committerJohn L. Hammond <john.hammond@intel.com>
Thu, 26 Oct 2017 16:08:47 +0000 (16:08 +0000)
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".

Lustre-change: https://review.whamcloud.com/27878
Lustre-commit: 66abf6ffe9f032aaa7c271ee2bd1f9b569058bd5

Change-Id: Ibd2e3963f791404ee927981238227012cf4dbf2c
Test-Parameters: trivial testlist=sanityn
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/29686
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/tests/sanityn.sh

index f72dccd..4f8f420 100755 (executable)
@@ -3147,33 +3147,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"