Skip to content

RTS Stats and Nofib inconsistency

Summary

In commit 264e1c7877 the following changes have been done:

diff --git a/rts/Stats.c b/rts/Stats.c
index 461eb7604c..264e1c7877 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -685,9 +685,9 @@ static void report_summary(const RTSSummaryStats* sum)
     showStgWord64(stats.max_slop_bytes, temp, true/*commas*/);
     statsPrintf("%16s bytes maximum slop\n", temp);
 
-    statsPrintf("%16" FMT_Word64 " MB total memory in use (%"
+    statsPrintf("%16" FMT_Word64 " MiB total memory in use (%"
                 FMT_Word64 " MB lost due to fragmentation)\n\n",
-                stats.max_live_bytes  / (1024 * 1024),
+                stats.max_mem_in_use_bytes  / (1024 * 1024),
                 sum->fragmentation_bytes / (1024 * 1024));
 
     /* Print garbage collections in each gen */

Note, the unit changed from MB to MiB. This introduces a regression with nofib/runstdtest/runstdtest.prl which matches only MB:

if ( /^\s+([0-9]+)\s+M[Bb] total memory/ ) {
    $TotMem = $1;
}

Steps to reproduce

Clone and build GHC (e.g. 7208160d). Then run nofib benchmark:

$ git clone ...
$ cd ghc/nofib
$ make clean
$ make boot
$ make
[...]
Warning: total memory not found in stats file
[...]

Example Solution

In order to support old and new syntax, allow an optional i:

if ( /^\s+([0-9]+)\s+Mi?[Bb] total memory/ ) {
    $TotMem = $1;
}

or change rts/Stats.c to only print MB.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information