File:  [Local Repository] / badi / public_scripts / parallelstarter / matsim / parallelstarter.cleanup
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Mon Jul 18 11:49:04 2011 UTC (13 years, 4 months ago) by adi
CVS tags: MAIN, HEAD
Initial revision


RUNDIR_PREFIX="$TEMPLATE_DIRNAME$RUN_DIR_PREFIX"

STOPWATCH_FILE_RELPATH="output/stopwatch.txt"
SUMMARY_FILE="time_summary.txt"
CURRENT_DIR="$(pwd)"
TIMESUM=""

function phase_calc(){

	TIMESUM="$(date --utc --date "today 00:00:00")"
	TIMESUM_OFFSET="$(date --date "$TIMESUM -1 second" "+%s")"

	while read line; do
		if  [ $(echo "$line" | grep -ce "^[0-9]\+") -eq 1 ]; then
			ADDTIME="$(echo "$line" | awk -F '\t' '{print $'"$phase_col"'}' |\
				 sed -e "s/^\([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)/\1 hours \2 minutes \3 seconds/")"
			TIMESUM="$(date --date "$TIMESUM $ADDTIME")"
		fi
	done < "$STOPWATCH_FILE"
	TIMESUM="$(date --utc --date "$TIMESUM -$TIMESUM_OFFSET seconds" "+%H:%M:%S")"
}


echo -e "Benchmark\ttotal\treplan\tmobsim\tdump\targuments" > "$SUMMARY_FILE"

for benchdir in $RUNDIR_PREFIX* ; do
	STOPWATCH_FILE="$benchdir/$STOPWATCH_FILE_RELPATH"
	linenr=0
	echo -en "$benchdir\t" >> "$SUMMARY_FILE"

	for phase in "iteration" "replanning" "mobsim" "dump" ; do

		case "$phase" in
		   replanning)
			phase_col=11
			;;
		   dump)
			phase_col=12
			;;
		   mobsim)
			phase_col=13
			;;
		   iteration)
			phase_col=14
		   	;;

		esac
	 	phase_calc
		echo -en "$TIMESUM\t" >> "$SUMMARY_FILE"

	done
	tail -1 "$benchdir/my_args" >> "$SUMMARY_FILE"
done


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>