GHC 8.2 GC time stats going negative

Ben Gamari ben at
Thu Nov 9 18:19:30 UTC 2017

Harendra Kumar <harendra.kumar at> writes:

> Hi,
> I am trying to use the mutator_cpu_ns and mutator_elapsed_ns from GHC 8.2
> RTSStats structure retrieved using getRTSStats API documented here -
> .
> I am seeing that the values of these stats retrieved about 30 ms later are
> lower than the values retrieved earlier. Sometimes even after 100 ms the
> values decrease from the previous ones. However, as the time duration
> between two calls increase this becomes less and less likely.
> Is this an expected behavior or am I using it incorrectly? If it is
> expected, why does it happen, what is the underlying mechanism that makes
> it happen?
Hmm, interesting. I don't believe this should happen and I do know of
bugs in the RTS's time accounting at exit-time (manifesting in profiling
issues, e.g. #14257) however what you describe doesn't seem to fit that
description. Do you have a simple repro? Is there anything special about
your program (e.g. lots of FFI calls)?


- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list