From 7bfe9ac514e18c0b0e24ff55230fe98ec9db894c Mon Sep 17 00:00:00 2001 From: Ben Gamari <ben@smart-cactus.org> Date: Wed, 22 Apr 2020 14:21:01 -0400 Subject: [PATCH] rts: Enable tracing of nonmoving heap census with -ln Previously this was not easily available to the user. Fix this. Non-moving collection lifecycle events are now reported with -lg. --- docs/users_guide/runtime_control.rst | 4 ++++ rts/RtsFlags.c | 1 + rts/sm/NonMoving.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst index f94c5846906d..2cf277176d53 100644 --- a/docs/users_guide/runtime_control.rst +++ b/docs/users_guide/runtime_control.rst @@ -1161,6 +1161,10 @@ When the program is linked with the :ghc-flag:`-eventlog` option - ``g`` — GC events, including GC start/stop. Enabled by default. + - ``n`` — non-moving garbage collector (see :rts-flag:`--nonmoving-gc`) + events including start and end of the concurrent mark and census + information to characterise heap fragmentation. Disabled by default. + - ``p`` — parallel sparks (sampled). Enabled by default. - ``f`` — parallel sparks (fully accurate). Disabled by default. diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 5b594c915d6b..6180f42e396f 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -382,6 +382,7 @@ usage_text[] = { " where [flags] can contain:", " s scheduler events", " g GC and heap events", +" n non-moving GC heap census events", " p par spark events (sampled)", " f par spark events (full detail)", " u user events (emitted from Haskell code)", diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c index a39b889c92b4..d230117b27a4 100644 --- a/rts/sm/NonMoving.c +++ b/rts/sm/NonMoving.c @@ -1125,6 +1125,10 @@ static void nonmovingMark_(MarkQueue *mark_queue, StgWeak **dead_weaks, StgTSO * if (RtsFlags.DebugFlags.nonmoving_gc) nonmovingPrintAllocatorCensus(); #endif +#if defined(TRACING) + if (RtsFlags.TraceFlags.nonmoving_gc) + nonmovingTraceAllocatorCensus(); +#endif // TODO: Remainder of things done by GarbageCollect (update stats) -- GitLab