3 ######################################################################
6 # the SG device to measure
10 # NB ensure the path exists if it includes subdirs
13 # what to do (read or write)
17 # NB bigger than device cache is good
20 # record size (KBytes)
28 # total numbers of threads to share between concurrent regions
29 # NB survey skips over #thr < #regions
33 #####################################################################
35 # disk block size (Bytes)
38 if [ $action = read ]; then
49 rsltf=${rslt}_${start}.summary
51 workf=${rslt}_${start}.detail
55 if [ "$1" = "-n" ]; then
60 echo $minusn "$*" >> $rsltf
64 for ((rsz=$rszlo;rsz<=$rszhi;rsz*=2)); do
65 for ((crg=$crglo;crg<=$crghi;crg*=2)); do
66 for ((thr=$thrlo;thr<=$thrhi;thr*=2)); do
67 if ((thr < crg)); then
72 blocks=$((size*((1024*1024)/bs)/crg))
74 # show computed parameters
75 actual_rsz=$((bpt*bs/1024))
76 actual_size=$((bs*count*crg/1024))
77 str=`printf 'total_size %8dK rsz %4d thr %5d crg %3d ' \
78 $actual_size $actual_rsz $thr $crg`
79 echo "==============> $str" >> $workf
80 print_summary -n "$str"
81 freemem=`awk < /proc/meminfo '/^MemTotal:/ {printf "%d\n", $2}'`
82 if (((actual_rsz * thr /crg + 64) * crg > freemem)); then
83 print_summary "ENOMEM"
88 for ((i=0;i<crg;i++)); do
89 sgp_dd 2> ${rslt}_tmp${i} \
90 $f1 $f2 ${skip}=$((1024+i*blocks)) \
91 thr=$((thr/crg)) count=$count bs=$bs bpt=$bpt time=1&
95 # collect all results in 1 file
96 rfile=${rslt}_thr${thr}_crg${crg}_rsz${rsz}
99 for ((i=0;i<crg;i++)); do
101 if grep 'time to transfer data' $rtmp > /dev/null 2>&1; then
104 cat ${rslt}_tmp${i} >> $rfile
105 cat ${rslt}_tmp${i} >> $workf
108 if [ $ok -ne $crg ]; then
109 print_summary `printf "failed %d" $((crg - ok))`
111 # compute MB/sec from elapsed
112 bw=`awk "BEGIN {printf \"%6.2f MB/s\", $actual_size / (( $t1 - $t0 ) * 1024); exit}"`
113 # compute MB/sec from nregions*slowest
114 check=`awk < $rfile \
115 '/time to transfer data/ {mb=$8/1.048576; if (n == 0 || mb < min) min = mb; n++}\
116 END {printf "%3d x %6.2f = %6.2f MB/s", n, min, min * n}'`
117 print_summary "$bw $check"