echo
gendirlist tiobench
printheader

CLIENTS=`ls tiobench-$KERNEL_BASE/$TOPLEVEL/tiobench-*.log | sed -e 's/.*\///' -e 's/tiobench-//' -e 's/.log//' | sort -n`

# Generate plot files
for DIR in $DIRLIST; do
	INPUTS="$INPUTS `pwd`/$DIR/$TOPLEVEL/tiobench-OPERATION.plot"
	TITLES="$TITLES `echo $DIR | sed -e 's/dbench3-//'`"
	for OPERATION in seq-read rand-read seq-write rand-write; do
		echo -n > $DIR/$TOPLEVEL/tiobench-$OPERATION.plot
		echo -n > $DIR/$TOPLEVEL/tiobench-$OPERATION-ratio.plot
	done
done

echo TIOBench Throughput
for OPERATION in seq-read rand-read seq-write rand-write; do
for CLIENT in $CLIENTS; do
	case $OPERATION in
	seq-read)
		LONG_OPERATION="Sequential Reads"
		;;
	rand-read)
		LONG_OPERATION="Random Reads"
		;;
	seq-write)
		LONG_OPERATION="Sequential Writes"
		;;
	rand-write)
		LONG_OPERATION="Random Writes"
		;;
	esac

	printf "%-7s %3d %-10s" Clients $CLIENT $OPERATION
	VANILLA=`grep -A 1 "$LONG_OPERATION" tiobench-$KERNEL_BASE/$TOPLEVEL/tiobench-$CLIENT.log | tail -1 | awk '{print $5}'`

	for DIR in $DIRLIST; do
		RESULT=`grep -A 1 "$LONG_OPERATION" $DIR/$TOPLEVEL/tiobench-$CLIENT.log | tail -1 | awk '{print $5}'`
		printf " %6.2f (%6.2f%%)" $RESULT `pdiff $RESULT $VANILLA`
		echo $CLIENT $RESULT >> $DIR/$TOPLEVEL/tiobench-$OPERATION.plot
		echo $CLIENT `rdiff $RESULT $VANILLA` >> $DIR/$TOPLEVEL/tiobench-$OPERATION-ratio.plot
	done
	echo
done
done
