2 # (c) The GRASP Project, Glasgow University, 1992
4 # *** MSUB does some substitutions here ***
9 $outsuffix = ".resid.ps"; # change as appropriate
10 $tmpfile = "$(TMPDIR)/$$.resid.data";
12 @INC = ( ( $(INSTALLING) ) ? '$(INSTLIBDIR_GHC)'
13 : '$(TOP_PWD)/$(CURRENT_DIR)' );
15 require('parse-gcstats.prl') || die "Can't load parse-gcstats.prl!\n";
16 require('process-gcstats.prl') || die "Can't load process-gcstats.prl!\n";
20 $outfile = ""; # gnuplot: set output
21 } elsif ($#ARGV == 0) {
23 if ($infile =~ /^(.*)\.stat$/) {
27 $infile = "$base.stat";
29 $outfile = "\"$base$outsuffix\""; # gnuplot: set output "outfile"
30 } elsif ($#ARGV == 1) {
32 $outfile = "\"$ARGV[1]\"";
34 die "Usage: command [infile[.stat] [outfile]]";
37 %gcstats = &parse_stats($infile);
39 &print_stats(">&STDERR", %gcstats) if $debug;
41 if ($gcstats{"collector"} eq "APPEL") {
42 die "APPEL stats: no residency plot possible\n";
46 # stats are now loaded into %gcstats -- write out info
49 open(DATAFILE, ">$tmpfile") || die "Cant open >$tmpfile \n";
52 printf DATAFILE "%4.2f %d\n", $user, 0;
53 while (++$i < $gcstats{"gc_no"}) {
54 $user += $gcstats{"mut_user_$i"};
55 printf DATAFILE "%4.2f %d\n", $user, $gcstats{"live_$i"};
57 printf DATAFILE "%4.2f %d\n", $gcstats{"mut_user_total"}, 0;
60 open(PLOTFILE, "|gnuplot") || die "Cant pipe into |gnuplot \n";
61 print PLOTFILE "set data style linespoints\n";
62 print PLOTFILE "set function style lines\n";
63 print PLOTFILE "set nokey\n";
64 print PLOTFILE "set xlabel \"Mutator Time (secs)\"\n";
65 print PLOTFILE "set ylabel \"Heap Residency (bytes)\" 0,-1\n";
66 print PLOTFILE "set term post eps \"Times-Roman\" 20\n";
67 printf PLOTFILE "set title \"%s %s (%s)\"\n", $gcstats{"command"}, $gcstats{"args"}, $infile;
68 print PLOTFILE "set output $outfile\n" ;
69 print PLOTFILE "plot \"$tmpfile\"\n";