#!/bin/bash function run10 { op=$1 size=$2 algo=$3 hosts=$4 shift 4 for i in $(seq 0 9); do ./ks_perf.py $op $size $algo $hosts $i $* & done for i in $(seq 0 9); do wait done } total_ops=0 high_secs=0 exec 3< <(run10 $* | grep "operations in" | cut -f2,5 -d" ") while read ops secs 0<&3; do echo "ops: $ops, secs: $secs" total_ops=$((total_ops+ops)) decisecs=$(python -c "print int(${secs}*10)") if [ $decisecs -gt $high_secs ]; then high_secs=$decisecs fi done echo "total ops: $total_ops, high_secs=$high_secs" python -c "print ${total_ops}.0*10.0/${high_secs}"