]>
git.proxmox.com Git - ceph.git/blob - ceph/src/erasure-code/jerasure/gf-complete/tools/time_tool.sh
1 # time_tool.sh - Shell script to test various timings.
2 # This is a rough tester -- its job is to work quickly rather than precisely.
8 echo 'usage sh time_tool.sh M|D|R|B w method' >&2
19 if [ $op != M
-a $op != D
-a $op != R
-a $op != B
]; then
20 echo 'usage sh time_tool.sh M|D|R|B w method' >&2
21 echo 'You have to specify a test: ' >&2
22 echo ' M=Multiplication' >&2
23 echo ' D=Division' >&2
25 echo ' B=Best-Region' >&2
29 # First, use a 16K buffer to test the performance of single multiplies.
31 fac
=`echo $w | awk '{ n = $1; while (n != 0 && n%2==0) n /= 2; print n }'`
32 if [ $fac -eq 0 ]; then
33 echo 'usage sh time_tool.sh M|D|R|B w method' >&2
39 bsize
=`echo $bsize $fac | awk '{ print $1 * $2 }'`
41 if [ `./gf_time $w M -1 $bsize 1 $method 2>&1 | wc | awk '{ print $1 }'` -gt 2 ]; then
42 echo 'usage sh time_tool.sh w method' >&2
47 if [ $op = M
-o $op = D
]; then
49 c1
=`./gf_time $w $op -1 $bsize $iter $method`
50 t
=`echo $c1 | awk '{ printf "%d\n", $4*100 }'`
51 s
=`echo $c1 | awk '{ print $8 }'`
54 while [ $t -lt 1 ]; do
56 iter
=`echo $iter | awk '{ print $1*2 }'`
57 c1
=`./gf_time $w $op -1 $bsize $iter $method`
58 t
=`echo $c1 | awk '{ printf "%d\n", $4*100 }'`
59 s
=`echo $c1 | awk '{ print $8 }'`
62 echo $op $bs |
awk '{ printf "%s speed (MB/s): %8.2lf W-Method: ", $1, $2 }'
68 bsize
=`echo $bsize $fac | awk '{ print $1 * $2 }'`
71 while [ $bsize -le 4194304 ]; do
73 c1
=`./gf_time $w G -1 $bsize $iter $method`
74 t
=`echo $c1 | awk '{ printf "%d\n", $6*500 }'`
75 s
=`echo $c1 | awk '{ print $10 }'`
78 while [ $t -lt 1 ]; do
80 iter
=`echo $iter | awk '{ print $1*2 }'`
81 c1
=`./gf_time $w G -1 $bsize $iter $method`
82 t
=`echo $c1 | awk '{ printf "%d\n", $6*500 }'`
83 s
=`echo $c1 | awk '{ print $10 }'`
85 if [ $bsize -lt 1048576 ]; then
86 str
=`echo $bsize | awk '{ printf "%3dK\n", $1/1024 }'`
88 str
=`echo $bsize | awk '{ printf "%3dM\n", $1/1024/1024 }'`
91 echo $str $bs |
awk '{ printf "Region Buffer-Size: %4s (MB/s): %8.2lf W-Method: ", $1, $2 }'
94 best
=`echo $best $bs | awk '{ print ($1 > $2) ? $1 : $2 }'`
95 bsize
=`echo $bsize | awk '{ print $1 * 2 }'`
97 echo $best |
awk '{ printf "Region Best (MB/s): %8.2lf W-Method: ", $1 }'