2 ##############################################################################
3 # Time-stamp: <Wed Jul 24 1996 20:38:02 Stardate: [-31]7859.09 hwloidl>
5 # Usage: gr3jv [options] <gr-file>
7 # Create a per-thread activity graph from a GrAnSim (or GUM) profile.
8 # Transform the log file of a GrAnSim run (a .gr file) into a quasi-parallel
9 # profile (a .qp file) using gr3qp and then into a PostScript file using qp3ap.
10 # The generated PostScript file shows one horizontal line for each task. The
11 # thickness of the line indicates the state of the thread:
12 # thick ... active, medium ... suspended, thin ... fetching remote data
15 # -o <file> ... write .ps file to <file>
16 # -m ... create mono PostScript file instead a color one.
17 # -O ... optimise i.e. try to minimise the size of the .ps file.
18 # -v ... be talkative.
19 # -h ... print help message (this header).
21 ##############################################################################
23 progname="`basename $0`"
34 getopts "hvmo:s:w:OD" name
35 while [ "$name" != "?" ] ; do
41 s) scale="-s $OPTARG";;
42 w) width="-w $OPTARG";;
46 getopts "hvmo:s:w:OD" name
49 opts="$mono $optimise $scale $width"
51 shift $[ $OPTIND - 1 ]
54 then no_of_lines=`cat $0 | awk 'BEGIN { n = 0; } \
58 echo "`head -$no_of_lines $0`"
64 then echo "Usage: $progname [options] file[.gr]"
65 echo "Use -h option for details"
76 then apfile="$f"-ap.ps
80 then echo "Input file: $grfile"
81 echo "Quasi-parallel file: $qpfile"
82 echo "PostScript file: $apfile"
83 echo "Options forwarded to qp3ap: $opts"
85 then echo "Producing monochrome PS file"
86 else echo "Producing color PS file"
88 if [ "$debug" = "-D" ]
89 then echo "Debugging is turned ON"
90 else echo "Debugging is turned OFF"
99 echo "$grfile does not exist"
102 # rm -f "$qpfile" "$apfile"
103 prog=`head -1 "$grfile" | sed -e 's/Granularity Simulation for //'`
104 echo "$prog" >| "$jvfile"
106 then echo "Executed program: $prog"
109 #date="`date`" # This is the date of running the script
110 date="`tail +2 $grfile | head -1 | sed -e 's/Start-Time: //'`"
111 cat "$grfile" | gr2java >> "$jvfile"
112 # Sorting is part of gr2qp now.
113 # | ghc-fool-sort | sort -n +0 -1 | ghc-unfool-sort >> "$qpfile"
114 # max=`tail -2 "$qpfile" | awk '!/^Number of threads:/ { print $1; }'`
115 xmax=`tail -1 "$jvfile" | awk '{ print $2; }'`
116 ymax=`tail -1 "$jvfile" | awk '{ print $8; }'`
118 then echo "Total runtime: $xmax"
119 echo "Total number of tasks: $ymax"
121 # Old: qp2ap.pl $mono $max "$prog" "$date" < "$qpfile" > "$apfile"