[project @ 2005-01-26 13:45:11 by simonmar]
[ghc-hetmet.git] / ghc / utils / stat2resid / parse-gcstats.prl
index b6e80fd..d882ee6 100644 (file)
@@ -1,4 +1,3 @@
-#!/local/sun4/bin/perl
 #
 # Subroutines to parses a ghc Garbage Collection stats file
 #
@@ -36,9 +35,10 @@ sub parse_stats {
     local($statsfile, $line, $row, $col, $val);
     local(@stats, @hdr1, @hdr2, @line_vals);
     local(%the_stats);
+    local(*STATS);
 
-    open($statsfile, $filename) || die "Cant open $filename \n";
-    @stats = <$statsfile>;
+    open(STATS, $filename) || die "Cant open $filename \n";
+    @stats = <STATS>;
 
     do {$line = shift(@stats);} until ($line !~ /^$/);
     chop($line);
@@ -161,14 +161,16 @@ arg: while($_ = $stats[0]) {
                                        $the_stats{"mut_elap_$row"} = $2 - $tot_gc_elap - $tot_mut_elap;
                                        next arg; };
 
-    /GC  time\s+([\d\.]+)s\s+\(\s*([\d.]+)s elapsed\)/ && do {
+    /GC\s+time\s+([\d\.]+)s\s+\(\s*([\d.]+)s elapsed\)/ && do {
                                        # $1 == $tot_gc_user || die "GCuser $1 != $tot_gc_user \n";
                                        # $2 == $tot_gc_elap || die "GCelap $2 != $tot_gc_elap \n";
                                        $the_stats{"gc_user_total"} = $tot_gc_user;
                                        $the_stats{"gc_elap_total"} = $tot_gc_elap;
                                        next arg; };
     
-    /MUT time/                 && do { next arg; };
+    /MUT\s+time/               && do { next arg; };
+    /INIT\s+time/              && do { next arg; };
+    /^\s*([\d,]+) bytes maximum residency/ && do { next arg; };
 
     /\%GC time/                        && do { next arg; };
     /Alloc rate/               && do { next arg; };
@@ -179,7 +181,7 @@ arg: while($_ = $stats[0]) {
     print STDERR "Unmatched line: $_";
     }
 
-    close($statsfile);
+    close(STATS);
     %the_stats;
 }