diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
commit | 0065d5ab628975892cea1ec7303f968c3338cbe1 (patch) | |
tree | 8e2afe0ab48ee33cf95009809d67c9649573ef92 /utils/stat2resid/stat2resid.prl | |
parent | 28a464a75e14cece5db40f2765a29348273ff2d2 (diff) | |
download | haskell-0065d5ab628975892cea1ec7303f968c3338cbe1.tar.gz |
Reorganisation of the source tree
Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.
The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level. The build system now makes no
pretense at being multi-project, it is just the GHC build system.
No doubt this will break many things, and there will be a period of
instability while we fix the dependencies. A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
Diffstat (limited to 'utils/stat2resid/stat2resid.prl')
-rw-r--r-- | utils/stat2resid/stat2resid.prl | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/utils/stat2resid/stat2resid.prl b/utils/stat2resid/stat2resid.prl new file mode 100644 index 0000000000..bf0a262428 --- /dev/null +++ b/utils/stat2resid/stat2resid.prl @@ -0,0 +1,81 @@ +# +# (c) The GRASP/AQUA Project, Glasgow University, 1992-1996 +# +# Perl script expect bindings for the following variables to be prepended +# +# DEFAULT_TMPDIR libdir +# +# without them, not much success :-( +# + +$debug = 0; # first line of script, builds confidence :-) +$outsuffix = ".resid.ps"; # change as appropriate + +if ( $ENV{'TMPDIR'} ) { # where to make tmp file names + $tmpfile = $ENV{'TMPDIR'} . "/$$.resid.data"; +} else { + $tmpfile ="${DEFAULT_TMPDIR}/$$.resid.data"; + $ENV{'TMPDIR'} = ${DEFAULT_TMPDIR}; # set the env var as well +} + +@INC = ( ${libdir} ); + +require('parse-gcstats.prl') || die "Can't load parse-gcstats.prl!\n"; +require('process-gcstats.prl') || die "Can't load process-gcstats.prl!\n"; + +if ($#ARGV < 0) { + $infile = "-"; + $outfile = ""; # gnuplot: set output +} elsif ($#ARGV == 0) { + $infile = $ARGV[0]; + if ($infile =~ /^(.*)\.stat$/) { + $base = $1; + } else { + $base = $infile; + $infile = "$base.stat"; + }; + $outfile = "\"$base$outsuffix\""; # gnuplot: set output "outfile" +} elsif ($#ARGV == 1) { + $infile = $ARGV[0]; + $outfile = "\"$ARGV[1]\""; +} else { + die "Usage: command [infile[.stat] [outfile]]"; +}; + +%gcstats = &parse_stats($infile); + +&print_stats(">&STDERR", %gcstats) if $debug; + +if ($gcstats{"collector"} eq "APPEL") { + die "APPEL stats: no residency plot possible\n"; +} + +# +# stats are now loaded into %gcstats -- write out info +# + +open(DATAFILE, ">$tmpfile") || die "Cant open >$tmpfile \n"; +$i = -1; +$user = 0; +printf DATAFILE "%4.2f %d\n", $user, 0; +while (++$i < $gcstats{"gc_no"}) { + $user += $gcstats{"mut_user_$i"}; + printf DATAFILE "%4.2f %d\n", $user, $gcstats{"live_$i"}; +}; +printf DATAFILE "%4.2f %d\n", $gcstats{"mut_user_total"}, 0; +close(DATAFILE); + +open(PLOTFILE, "|gnuplot") || die "Cant pipe into |gnuplot \n"; +print PLOTFILE "set data style linespoints\n"; +print PLOTFILE "set function style lines\n"; +print PLOTFILE "set nokey\n"; +print PLOTFILE "set xlabel \"Mutator Time (secs)\"\n"; +print PLOTFILE "set ylabel \"Heap Residency (bytes)\" 0,-1\n"; +print PLOTFILE "set term post eps \"Times-Roman\" 20\n"; +printf PLOTFILE "set title \"%s %s (%s)\"\n", $gcstats{"command"}, $gcstats{"args"}, $infile; +print PLOTFILE "set output $outfile\n" ; +print PLOTFILE "plot \"$tmpfile\"\n"; +close(PLOTFILE); + +unlink($tmpfile); +exit 0; |