2 # (C) Hans Wolfgang Loidl, July 1995
3 #############################################################################
4 # Time-stamp: <Thu Oct 26 1995 18:23:00 Stardate: [-31]6498.62 hwloidl>
6 # Usage: SPLIT [options] <gr-file>
8 # Generate a set of granularity graphs out of the GrAnSim profile <gr-file>.
9 # The granularity graphs are put into subdirs of the structure:
10 # <basename of gr-file>-<spark-name>
13 # -s <list> ... a perl list of spark names; the given <gr-file> is scanned
14 # for each given name in turn and granularity graphs are
15 # generated for each of these sparks
16 # -O ... use gr2RTS and RTS2gran instead of gran-extr;
17 # this generates fewer output files (only granularity graphs)
18 # but should be faster and far less memory consuming
19 # -d <dir> ... use <dir> as basename for the sub-directories
20 # -o <file> ... use <file> as basename for the generated latex files;
21 # the overall result is in <file>.ps
22 # -t <file> ... use <file> as gran-extr type template file
23 # ('.' for local template, ',' for global template)
24 # -A ... surpress generation of granularity profiles for overall .gr
25 # -h ... help; print this text.
26 # -v ... verbose mode.
28 #############################################################################
32 &Getopts('hvOAd:o:s:t:');
36 if ( $opt_v ) { do print_verbose_message(); }
38 # ---------------------------------------------------------------------------
40 # ---------------------------------------------------------------------------
42 $latex = "/usr/local/tex/bin/latex2e"; # or "/usr/local/tex/bin/latex2e"
46 foreach $s (@sparks) {
47 if ( -f $tmp_file ) { system "rm -f $tmp_file"; }
48 system "tf -H -s $s $gr_file > $tmp_file"
49 || die "Can't open pipe: tf -s $s $gr_file > $tmp_file\n";
60 mkdir($dir,"755"); # system "mkdir $dir";
61 system "chmod u+rwx $dir";
64 system "mv $tmp_file $dir/$gr_file";
67 do print_va("Title",$s);
68 if ( -f $va_ps_file ) {
69 local ($old) = $va_ps_file;
70 $old =~ s/\.ps/-o.ps/g;
71 system "mv $va_ps_file $old";
74 system "gr2RTS -o $rts_file $gr_file; " .
75 "RTS2gran -t $template_file $rts_file; " .
76 "$latex $va_file; dvips $va_dvi_file > $va_ps_file";
78 system "gran-extr -t $template_file $gr_file; " .
79 "$latex $va_file; dvips $va_dvi_file > $va_ps_file";
81 chdir ".."; # system "cd ..";
86 # -----------------------------------------------------------------------------
95 mkdir($dir,"755"); # system "mkdir $dir";
96 system "chmod u+rwx $dir";
99 system "cp $gr_file $dir/$gr_file";
102 do print_va("All","all");
103 if ( -f $va_ps_file ) {
104 local ($old) = $va_ps_file;
105 $old =~ s/\.ps/-o.ps/g;
106 system "mv $va_ps_file $old";
109 system "gr2RTS -o $rts_file $gr_file; " .
110 "RTS2gran -t $template_file $rts_file; " .
111 "$latex $va_file; dvips $va_dvi_file > $va_ps_file";
113 system "gran-extr -t $template_file $gr_file; " .
114 "$latex $va_file; dvips $va_dvi_file > $va_ps_file";
116 chdir ".."; # system "cd ..";
119 # ---------------------------------------------------------------------------
123 open (TEMPL,">$template_file") || die "Can't open $template_file\n";
126 -- Originally copied from the master template: GrAn/bin/TEMPL
127 -- Intervals for pure exec. times
128 G: (1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000, 40000, 50000, 100000, 200000, 300000)
129 -- Intervals for communication (i.e. fetch) times
130 F: (1000, 2000, 3000, 4000, 5000, 10000, 20000, 30000, 40000, 50000, 100000, 200000, 300000)
131 -- Intervals for communication percentages
132 C: (0, 1, 2, 5, 8, 10, 20, 30, 40, 50, 100)
133 -- Intervals for no. of sparks
135 -- Intervals for heap allocations
136 A: (10,20,30,40,50,100,200,300,400,500,1000,2000,3000)
137 -- A: (100, 50000, 66000, 100000)
146 -- Select file name corr coeff file
149 -- Select file names for GNUPLOT data files for cumulative runtime and
151 Xcumulat-rts: cumu-rts.dat
152 Xcumulat-fts: cumu-fts.dat
153 Xcumulat-has: cumu-has.dat
154 Xcumulat-cps: cumu-cps.dat
155 Xclust-rts: clust-rts.dat
156 Xclust-has: clust-has.dat
157 Xclust-cps: clust-cps.dat
159 -- Select file names for GNUPLOT data files for per proc. runnable time
160 -- and per spark site runtime
164 -- Select file names for sorted lists of runtimes, heap allocs, number of
165 -- local and global sparks and communication percentage
176 -- ('g',"xy",'Cg',"xy",'Ca',"xy")
178 -- Gray level of impulses in the graph (0=black)
181 -- Number of clusters
184 -- Width of impulses (needed for gp-ext-imp)
194 # -----------------------------------------------------------------------------
195 # NB: different file must be generated for $opt_O and default setup.
196 # -----------------------------------------------------------------------------
199 local ($title, $spark) = @_;
201 open (VA,">$va_file") || die "Can't open $va_file\n";
205 % Originally copied from master va-file: grasp/tests/va.tex
206 \\documentstyle[11pt,psfig]{article}
209 \\topmargin=0cm %0.5cm
210 \\textheight=24cm %22cm
212 \\oddsidemargin=0cm %0.75cm
213 \\evensidemargin=0cm %0.75cm
214 \\rightmargin=0cm %0.75cm
215 \\leftmargin=0cm %0.75cm
216 \\textwidth=16cm %14.5cm
234 \\centerline{\\psfig{angle=270,width=7cm,file=$gran_file}}
237 \\caption{Granularity {\\bf $spark}}
243 \\psfig{angle=270,width=7cm,file=cumu-rts.ps} &
244 \\psfig{angle=270,width=7cm,file=cumu-rts0.ps}
247 \\caption{Cumulative Execution Times {\\bf $spark}}
254 % Originally copied from master va-file: grasp/tests/va.tex
255 \\documentstyle[11pt,psfig]{article}
258 \\topmargin=0cm %0.5cm
259 \\textheight=24cm %22cm
261 \\oddsidemargin=0cm %0.75cm
262 \\evensidemargin=0cm %0.75cm
263 \\rightmargin=0cm %0.75cm
264 \\leftmargin=0cm %0.75cm
265 \\textwidth=16cm %14.5cm
267 \\title{$title; Spark: $spark}
281 \\psfig{angle=270,width=7cm,file=$gran_file} &
282 \\psfig{angle=270,width=7cm,file=a.ps}
285 \\caption{Granularity \\& Heap Allocations {\\bf $spark}}
291 \\psfig{angle=270,width=7cm,file=f.ps} &
292 \\psfig{angle=270,width=7cm,file=c.ps}
295 \\caption{Fetching Profile {\\bf $spark}}
301 \\psfig{angle=270,width=7cm,file=cumu-rts.ps} &
302 \\psfig{angle=270,width=7cm,file=cumu-rts0.ps}
305 \\caption{Cumulative Execution Times {\\bf $spark}}
314 # -----------------------------------------------------------------------------
316 sub process_options {
319 open(ME,$0) || die "Can't open myself ($0): $!\n";
331 $opt_s =~ s/[\(\)\[\]]//g;
332 @sparks = split(/[,;. ]+/, $opt_s);
334 @sparks = ( 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15);
338 print "Usage: $0 [options] <gr-file>\n;";
339 print "Use -h option to get details\n";
344 ($basename = $gr_file) =~ s/\.gr//;
345 $rts_file = $basename . ".rts"; # "RTS";
346 $gran_file = "g.ps"; # $basename . ".ps";
347 #$rts_file = $gr_file;
348 #$rts_file =~ s/\.gr/.rts/g;
352 $va_dvi_file = $va_file;
353 $va_dvi_file =~ s/\.tex/.dvi/g;
354 $va_ps_file = $va_file;
355 $va_ps_file =~ s/\.tex/.ps/g;
358 $va_dvi_file = "va.dvi";
359 $va_ps_file = "va.ps";
363 $template_file = $opt_t;
365 $template_file = "TEMPL";
371 # -----------------------------------------------------------------------------
373 sub print_verbose_message {
374 print "Sparks: (" . join(',',@sparks) . ")\n";
375 print "Files: .gr " . $gr_file . " template " . $template_file .
376 " va " . $va_file . "\n";
379 # -----------------------------------------------------------------------------