Annotation of badi/public_scripts/parallelstarter/matsim/analyze_stopwatch, revision 1.1.1.1
1.1 adi 1:
2: RUNDIR_PREFIX="$TEMPLATE_DIRNAME$RUN_DIR_PREFIX"
3:
4: STOPWATCH_FILE_RELPATH="output/stopwatch.txt"
5: SUMMARY_FILE="time_summary.txt"
6: CURRENT_DIR="$(pwd)"
7: TIMESUM=""
8:
9: function phase_calc(){
10:
11: TIMESUM="$(date --utc --date "today 00:00:00")"
12: TIMESUM_OFFSET="$(date --date "$TIMESUM -1 second" "+%s")"
13:
14: while read line; do
15: if [ $(echo "$line" | grep -ce "^[0-9]\+") -eq 1 ]; then
16: ADDTIME="$(echo "$line" | awk -F '\t' '{print $'"$phase_col"'}' |\
17: sed -e "s/^\([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)/\1 hours \2 minutes \3 seconds/")"
18: TIMESUM="$(date --date "$TIMESUM $ADDTIME")"
19: fi
20: done < "$STOPWATCH_FILE"
21: TIMESUM="$(date --utc --date "$TIMESUM -$TIMESUM_OFFSET seconds" "+%H:%M:%S")"
22: }
23:
24:
25: echo -e "Benchmark\ttotal\treplan\tmobsim\tdump\targuments" > "$SUMMARY_FILE"
26:
27: for benchdir in $RUNDIR_PREFIX* ; do
28: STOPWATCH_FILE="$benchdir/$STOPWATCH_FILE_RELPATH"
29: linenr=0
30: echo -en "$benchdir\t" >> "$SUMMARY_FILE"
31:
32: for phase in "iteration" "replanning" "mobsim" "dump" ; do
33:
34: case "$phase" in
35: replanning)
36: phase_col=11
37: ;;
38: dump)
39: phase_col=12
40: ;;
41: mobsim)
42: phase_col=13
43: ;;
44: iteration)
45: phase_col=14
46: ;;
47:
48: esac
49: phase_calc
50: echo -en "$TIMESUM\t" >> "$SUMMARY_FILE"
51:
52: done
53: tail -1 "$benchdir/my_args" >> "$SUMMARY_FILE"
54: done
55:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>