Fix parsing of maximum residency in runstdtest
authorSebastian Graf <sebastian.graf@kit.edu>
Fri, 21 Dec 2018 13:24:11 +0000 (14:24 +0100)
committerSebastian Graf <sebastian.graf@kit.edu>
Fri, 21 Dec 2018 13:24:12 +0000 (14:24 +0100)
Summary:
`runstdtest` switched from `-S` to `-s` output a while ago.
That broke parsing of maximum and average residency numbers.

This commit makes sure that at least maximum residency is parsed
correctly from `-s` output, while leaving the logic for `-S` output.

Reviewers: simonmar, bgamari, simonpj, osa1, AndreasK, O26 nofib

Reviewed By: bgamari

GHC Trac Issues: #16003

Differential Revision: https://phabricator.haskell.org/D5418

runstdtest/runstdtest.prl

index 648f381..78da420 100644 (file)
@@ -401,6 +401,10 @@ sub process_stats_file {
         $Balance = 1;
        while (<STATS>) {
            if (! /Gen:\s+0/ && /^\s*\d+\s+\d+\s+(\d+)\s+\d+\.\d+/ ) {
+               # This is only hit for -S and will override the residency
+               # numbers from -s if found.
+               # -S is needed for average residency numbers, which is 0
+               # otherwise.
                $max_live = $1 if $max_live < $1;
                $tot_live += $1;
                $tot_samples += 1;
@@ -414,9 +418,10 @@ sub process_stats_file {
               $GCWork += $tmp;
             }
 
-#           if ( /^\s*([0-9,]+) bytes maximum residency .* (\d+) sample/ ) {
-#              $MaxResidency = $1; $ResidencySamples = $2;
-#          }
+            if ( /^\s*([0-9,]+) bytes maximum residency.*(\d+) sample/ ) {
+                $MaxResidency = $1;
+                $ResidencySamples = $2;
+            }
 
             if ( /^\s+([0-9]+)\s+M[Bb] total memory/ ) {
                $TotMem = $1;
@@ -501,6 +506,7 @@ sub process_stats_file {
        }
        close(STATS) || die "Failed when closing $StatsFile\n";
        if ( $tot_samples > 0 ) {
+           # This is only hit for -S
            $ResidencySamples = $tot_samples;
            $MaxResidency = $max_live;
            $AvgResidency = int ($tot_live / $tot_samples) ;