Whamcloud - gitweb
LU-9140 nrs: measure the runtime of dd directly 78/27878/10
authorQian Yingjin <qian@ddn.com>
Thu, 29 Jun 2017 09:03:44 +0000 (17:03 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 19 Oct 2017 17:06:29 +0000 (17:06 +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".

Change-Id: Ibd2e3963f791404ee927981238227012cf4dbf2c
Test-Parameters: trivial testlist=sanityn
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/27878
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanityn.sh

index c20f7f7..821cae9 100755 (executable)
@@ -3161,33 +3161,41 @@ tbf_verify() {
        local client1=${CLIENT1:-$(hostname)}
        local myRUNAS="$3"
 
        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"
        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"
        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"
 
        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"
 
        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"
 
        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"
 
        cancel_lru_locks osc
        cleanup_tbf_verify || error "rm -rf $dir failed"