From cceb84ec29ad0d2f9323b8b1d46214fa898816b5 Mon Sep 17 00:00:00 2001 From: Teo Camarasu Date: Fri, 9 Aug 2024 18:15:12 +0100 Subject: [PATCH] Add support for the NonmovingPrunedSegments event See: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12152 --- include/EventLogFormat.h | 1 + src/GHC/RTS/EventTypes.hs | 8 + src/GHC/RTS/Events.hs | 4 + src/GHC/RTS/Events/Binary.hs | 9 + test/Utils.hs | 1 + test/nonmoving-gc-pruned-segments.eventlog | Bin 0 -> 15827 bytes ...ving-gc-pruned-segments.eventlog.reference | 604 ++++++++++++++++++ 7 files changed, 627 insertions(+) create mode 100644 test/nonmoving-gc-pruned-segments.eventlog create mode 100644 test/nonmoving-gc-pruned-segments.eventlog.reference diff --git a/include/EventLogFormat.h b/include/EventLogFormat.h index fa3f976..7b89184 100644 --- a/include/EventLogFormat.h +++ b/include/EventLogFormat.h @@ -213,6 +213,7 @@ #define EVENT_CONC_SWEEP_END 205 #define EVENT_CONC_UPD_REM_SET_FLUSH 206 #define EVENT_NONMOVING_HEAP_CENSUS 207 +#define EVENT_NONMOVING_PRUNED_SEGMENTS 208 #define EVENT_TICKY_COUNTER_DEF 210 #define EVENT_TICKY_COUNTER_SAMPLE 211 diff --git a/src/GHC/RTS/EventTypes.hs b/src/GHC/RTS/EventTypes.hs index e38efaf..d6ac43b 100644 --- a/src/GHC/RTS/EventTypes.hs +++ b/src/GHC/RTS/EventTypes.hs @@ -462,6 +462,14 @@ data EventInfo , nonmovingCensusFilledSegs :: !Word32 , nonmovingCensusLiveBlocks :: !Word32 } + | NonmovingPrunedSegments + { -- | The number of pruned segments. + nonmovingPrunedSegments :: !Word32 + -- | The number of leftover free segments. + -- These could not be pruned as they belong to megablocks + -- with at least one non-free segment. + , nonmovingFreeSegments :: !Word32 + } | TickyCounterDef { tickyCtrDefId :: !Word64 , tickyCtrDefArity :: !Word16 diff --git a/src/GHC/RTS/Events.hs b/src/GHC/RTS/Events.hs index fc5d7f4..fec41d2 100644 --- a/src/GHC/RTS/Events.hs +++ b/src/GHC/RTS/Events.hs @@ -519,6 +519,10 @@ buildEventInfo spec' = <> ": " <> TB.decimal nonmovingCensusActiveSegs <> " active segments" <> ", " <> TB.decimal nonmovingCensusFilledSegs <> " filled segments" <> ", " <> TB.decimal nonmovingCensusLiveBlocks <> " live blocks" + NonmovingPrunedSegments {..} -> + "nonmoving segments pruned: " + <> TB.decimal nonmovingPrunedSegments <> " pruned segments, " + <> TB.decimal nonmovingFreeSegments <> " free segments retained" TickyCounterDef {..} -> "ticky counter definition " <> TB.decimal tickyCtrDefId <> ", " <> "arity: " <> TB.decimal tickyCtrDefArity diff --git a/src/GHC/RTS/Events/Binary.hs b/src/GHC/RTS/Events/Binary.hs index 0866ea6..8075840 100644 --- a/src/GHC/RTS/Events/Binary.hs +++ b/src/GHC/RTS/Events/Binary.hs @@ -359,6 +359,11 @@ standardParsers = [ nonmovingCensusLiveBlocks <- get :: Get Word32 return NonmovingHeapCensus{..} )), + (FixedSizeParser EVENT_NONMOVING_PRUNED_SEGMENTS 8 (do -- (pruned_segments, free_segments) + nonmovingPrunedSegments <- get :: Get Word32 + nonmovingFreeSegments <- get :: Get Word32 + return NonmovingPrunedSegments{..} + )), (FixedSizeParser EVENT_CREATE_THREAD sz_tid (do -- (thread) t <- get @@ -991,6 +996,7 @@ eventTypeNum e = case e of ConcSweepEnd {} -> EVENT_CONC_SWEEP_END ConcUpdRemSetFlush {} -> EVENT_CONC_UPD_REM_SET_FLUSH NonmovingHeapCensus {} -> EVENT_NONMOVING_HEAP_CENSUS + NonmovingPrunedSegments {} -> EVENT_NONMOVING_PRUNED_SEGMENTS TickyCounterDef {} -> EVENT_TICKY_COUNTER_DEF TickyCounterSample {} -> EVENT_TICKY_COUNTER_SAMPLE InfoTableProv {} -> EVENT_IPE @@ -1446,6 +1452,9 @@ putEventSpec NonmovingHeapCensus {..} = do putE nonmovingCensusActiveSegs putE nonmovingCensusFilledSegs putE nonmovingCensusLiveBlocks +putEventSpec NonmovingPrunedSegments {..} = do + putE nonmovingPrunedSegments + putE nonmovingFreeSegments putEventSpec TickyCounterDef {..} = do putE tickyCtrDefId putE tickyCtrDefArity diff --git a/test/Utils.hs b/test/Utils.hs index 06de4c9..a0a08be 100644 --- a/test/Utils.hs +++ b/test/Utils.hs @@ -5,6 +5,7 @@ files = map ("test/"++) [ "nonmoving-gc.eventlog" , "nonmoving-gc-census.eventlog" , "nonmoving-gc-census-T23340.eventlog" + , "nonmoving-gc-pruned-segments.eventlog" , "parallelTest.eventlog" , "sleep.h.eventlog" , "sleep.hC.eventlog" diff --git a/test/nonmoving-gc-pruned-segments.eventlog b/test/nonmoving-gc-pruned-segments.eventlog new file mode 100644 index 0000000000000000000000000000000000000000..67fa22ba78cb9aca731eef40e3945f78f80d9028 GIT binary patch literal 15827 zcmb8034Bvk_Qzjh60$T2ZE1mqFjTqLk;tVVRuB0bapBy zn0aZN^LdXZz^nu7n!(48ky_Qpm&sj9A`w|;?3O&q1I0O&o$;0qxeH<_D!IMhsC??4 zb74YJQU4*tS{hVSB}ZHP^>_g-azfF{xY_|7My~b1g|w77w#H+|It`}-QNUZ)66uaK zM?0h1YUne~5Tl58K|!_B31Q`*G4#=h^6b{ubSo{Me$_wt2?tC>4DcL1Q)Md#o$cTi&Xf!n%DU6g@ zPgIS^h@IRMQKKZyjSjM8hX77+Xo2CD=T;lSjiIHv^CK#W(2X0NDwTtiXCY0gmUuFz zLG2A;#*!;3hg(pl4dvr#xr3FrCXJ+zr-eK`^sU;~8DD8|KP}xIXf_m1kj!xHVzCpN z66rJ)7gJwewYKP`m-frb5?XF&?)?Zpop!c+E@^N~PH1ZXq&-6#4DQ|#04cXnWVC3P zF?oMMW90Cus58>680%L`tDk#9avK^kkr|zk*ao9X)F`hynjl$_mXQXl$t=_yIwPLU zs7xZ0j=U(Y!F1HFM7n|XuDH5dR$zE!Xl=X&CQaioPN6=Ns*) zxW(I!d&*tSq`MNd_w_m8Od6ul5TY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