+if (($ndevs <= 0 || ${#host_names[@]} <= 0)); then
+ echo "no devices or hosts specified"
+ cleanup 0 $clean_srv_OSS $cleanup_oscs
+fi
+
+print_summary "$(date) Obdfilter-survey for case=$case from $(hostname)"
+for ((rsz = $rszlo; rsz <= $rszhi; rsz*=2)); do
+ for ((nobj = $nobjlo; nobj <= $nobjhi; nobj*=2)); do
+ for ((thr = $thrlo; thr <= $thrhi; thr*=2)); do
+ if ((thr % nobj)); then
+ continue
+ fi
+ # restart?
+ if [ -n "$restart_rsz" -a \
+ -n "$restart_nobj" -a \
+ -n "$restart_thr" ]; then
+ if ((rsz < restart_rsz ||
+ (rsz == restart_rsz &&
+ (nobj < restart_nobj ||
+ (nobj == restart_nobj &&
+ thr < restart_thr))))); then
+ continue;
+ fi
+ fi
+
+ # compute parameters
+ total_thr=$((ndevs * thr))
+ total_nobj=$((ndevs * nobj))
+ pages=$(( (rsz + PAGE_SIZE_KB - 1) / PAGE_SIZE_KB))
+ actual_rsz=$((pages * PAGE_SIZE_KB))
+ count=$((size * 1024 / (actual_rsz * thr)))
+ actual_size=$((actual_rsz * count * thr))
+ total_size=$((actual_size * ndevs))
+
+ # show computed parameters
+ str=$(printf 'ost %2d sz %8dK rsz %4dK obj %4d thr %4d ' \
+ $ndevs $total_size $actual_rsz $total_nobj $total_thr)
+ echo "=======================> $str" >> $workf
+ print_summary -n "$str"
+
+ # create the objects
+ tmpf="${workf}_tmp"
+ for ((idx = 0; idx < $ndevs; idx++)); do
+ host=${host_names[$idx]}
+ devno=${devnos[$idx]}
+ client_name="${host}:${client_names[$idx]}"
+ echo "=============> Create $nobj on $client_name" >> $workf
+ first_obj=$(create_objects $host $devno $nobj $tmpf)
+ cat $tmpf >> $workf
+ rm $tmpf
+ if [ $first_obj = "ERROR" ]; then
+ print_summary "created object #s on $client_name not contiguous"
+ cleanup 3
+ fi
+ first_objs[$idx]=$first_obj
+ done # $ndevs
+
+ # run tests
+ for test in ${tests[@]}; do
+ declare -a pidarray
+ for host in ${unique_hosts[@]}; do
+ remote_shell $host \
+ "lctl set_param -n osd*.*.force_sync 1 &>/dev/null || true"
+ echo "starting run for test: $test rsz: $rsz " \
+ "threads: $thr objects: $nobj" >> ${vmstatf}_${host}
+ done
+ print_summary -n "$test "
+
+ # create per-host script files
+ for host in ${unique_hosts[@]}; do
+ echo -n > ${cmdsf}_${host}
+ done
+ for ((idx = 0; idx < $ndevs; idx++)); do
+ host=${host_names[$idx]}
+ devno=${devnos[$idx]}
+ tmpfi="${tmpf}_$idx"
+ first_obj=${first_objs[$idx]}
+ thr_per_obj=$((${thr}/${nobj}))
+ echo >> ${cmdsf}_${host} \
+ "$lctl > $tmpfi 2>&1 \\
+ --threads $thr -$snap $devno \\
+ test_brw $count $(testname2type $test) q $pages \\
+ ${thr_per_obj}t${first_obj} $(testcase2mode)$pages &"
+ done # $ndevs
+ pidcount=0
+ for host in ${unique_hosts[@]}; do
+ echo "wait" >> ${cmdsf}_${host}
+ pidarray[$pidcount]=0
+ pidcount=$((pidcount + 1))
+ done
+ # timed run of all the per-host script files
+ t0=$(date +%s.%N)
+ pidcount=0
+ for host in ${unique_hosts[@]}; do
+ remote_shell $host bash < ${cmdsf}_${host} &
+ pidarray[$pidcount]=$!
+ pidcount=$((pidcount + 1))
+ done
+ pidcount=0
+ for host in ${unique_hosts[@]}; do
+ wait ${pidarray[$pidcount]}
+ pidcount=$((pidcount + 1))
+ done
+ #wait
+ t1=$(date +%s.%N)
+ # clean up per-host script files
+ for host in ${unique_hosts[@]}; do
+ rm ${cmdsf}_${host}
+ done
+
+ # compute bandwidth from total data / elapsed time
+ str=$(awk "BEGIN {printf \"%7.2f \",\
+ $total_size / (( $t1 - $t0 ) * 1024)}")
+ print_summary -n "$str"
+ # collect/check individual OST stats
+ echo -n > $tmpf
+ for ((idx = 0; idx < $ndevs; idx++)); do
+ client_name="${host_names[$idx]}:${client_names[$idx]}"
+ tmpfi="${tmpf}_$idx"
+ echo "=============> $test $client_name" >> $workf
+ host="${host_names[$idx]}"
+ remote_shell $host cat $tmpfi > ${tmpfi}_local
+ cat ${tmpfi}_local >> $workf
+ get_stats ${tmpfi}_local >> $tmpf
+ rm -f $tmpfi ${tmpfi}_local
+ done # $ndevs
+
+ # compute/display global min/max stats
+ echo "=============> $test global" >> $workf
+ cat $tmpf >> $workf
+ stats=($(get_global_stats $tmpf))
+ rm $tmpf
+ if ((stats[0] <= 0)); then
+ if ((stats[0] < 0)); then
+ str=$(printf "%17s " ERROR)
+ else
+ str=$(printf "%17s " SHORT)
+ fi
+ else
+ str=$(awk "BEGIN {printf \"[%7.2f, %7.2f] \",\
+ (${stats[1]} * $actual_rsz)/1024,\
+ (${stats[2]} * $actual_rsz)/1024; exit}")
+ fi
+ print_summary -n "$str"
+ done # $tests[]
+ print_summary ""
+
+ # destroy objects we created
+ for ((idx = 0; idx < $ndevs; idx++)); do
+ host=${host_names[$idx]}
+ devno=${devnos[$idx]}
+ client_name="${host}:${client_names[$idx]}"
+ first_obj=${first_objs[$idx]}
+ echo "=============> Destroy $nobj on $client_name" >> $workf
+ destroy_objects $host $devno $first_obj $nobj $tmpf
+ cat $tmpf >> $workf
+ rm $tmpf
+ done # $ndevs
+ done # $thr
+ done # $nobj
+done # $rsz
+cleanup 0 $clean_srv_OSS $cleanup_oscs
+exit 0