nonmoving_gc_elapsed_ns stat seems wrong
Summary
The nonmoving_gc_elapsed_ns
stat seems wrong. I noticed that in the output of +RTS -s
, for example, the total concurrent nonmoving GC time is greater than the CPU time.
Tot time (elapsed) Avg pause Max pause
Gen 1 concurrent, 0.328s 1.185s 0.1693s 0.7207s
Shouldn't elapsed always be less than or equal to total time, because total time is the sum of all CPUs' local elapsed times?
Looking at the code, it appears we use getProcessCPUTime()
to compute the start and end timestamps for nonmoving_gc_elapsed_ns
:
https://gitlab.haskell.org/ghc/ghc/-/blob/02372be119bd1a4e7099d2c7d5bb3de096e99409/rts/Stats.c#L301
I think that should be getProcessElapsedTime()
instead.
Steps to reproduce
Compile a program with -rtsopts
, run it with the nonmoving GC, and observe a stats dump: +RTS --nonmoving-gc -s
Expected behavior
Elapsed time should be less than or equal to total time.
Environment
- GHC version used: 9.2