Skip to content

GC stats report mislabels non-moving generation with >2 generations

Summary

When using more than 2 generations and the non-moving gc, the report generated by the -s flag always assumes that the non-moving generation is generation 1 instead of the oldest generation.

Steps to reproduce

Run a ghc compilled program with the following flags: +RTS --nonmoving-gc -s -G3 this will give you something like:

...
  Gen  0         1 colls,     0 par    0.001s   0.001s     0.0011s    0.0011s
  Gen  1         1 colls,     0 par    0.001s   0.001s     0.0006s    0.0006s
  Gen  2         1 colls,     0 par    0.000s   0.000s     0.0004s    0.0004s
  Gen  1         1 syncs,                       0.000s     0.0000s    0.0000s
  Gen  1      concurrent,              0.012s   0.018s     0.0177s    0.0177s

Expected behavior

It should instead output:

...
  Gen  0         1 colls,     0 par    0.001s   0.001s     0.0011s    0.0011s
  Gen  1         1 colls,     0 par    0.001s   0.001s     0.0006s    0.0006s
  Gen  2         1 colls,     0 par    0.000s   0.000s     0.0004s    0.0004s
  Gen  2         1 syncs,                       0.000s     0.0000s    0.0000s
  Gen  2      concurrent,              0.012s   0.018s     0.0177s    0.0177s
...

Environment

  • GHC version used: The Glorious Glasgow Haskell Compilation System, version 9.3.20210902

This is quite simple to fix, so I'll give it a go.

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