From 92db4866a58b891dc771e54b27dc317b458d58be Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Fri, 22 Dec 2023 10:48:36 +0000 Subject: [PATCH] Add support for era event types --- src/GHC/RTS/EventTypes.hs | 5 +++++ src/GHC/RTS/Events.hs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GHC/RTS/EventTypes.hs b/src/GHC/RTS/EventTypes.hs index 30c9840..779c959 100644 --- a/src/GHC/RTS/EventTypes.hs +++ b/src/GHC/RTS/EventTypes.hs @@ -633,6 +633,7 @@ data HeapProfBreakdown | HeapProfBreakdownBiography | HeapProfBreakdownClosureType | HeapProfBreakdownInfoTable + | HeapProfBreakdownEra deriving Show instance Binary HeapProfBreakdown where @@ -647,6 +648,7 @@ instance Binary HeapProfBreakdown where 6 -> return HeapProfBreakdownBiography 7 -> return HeapProfBreakdownClosureType 8 -> return HeapProfBreakdownInfoTable + 9 -> return HeapProfBreakdownEra _ -> fail $ "Unknown HeapProfBreakdown: " ++ show n put breakdown = put $ case breakdown of HeapProfBreakdownCostCentre -> (1 :: Word32) @@ -657,6 +659,9 @@ instance Binary HeapProfBreakdown where HeapProfBreakdownBiography -> 6 HeapProfBreakdownClosureType -> 7 HeapProfBreakdownInfoTable -> 8 + HeapProfBreakdownEra -> 9 + + newtype HeapProfFlags = HeapProfFlags Word8 deriving (Show, Binary) diff --git a/src/GHC/RTS/Events.hs b/src/GHC/RTS/Events.hs index 1d447d8..8723495 100644 --- a/src/GHC/RTS/Events.hs +++ b/src/GHC/RTS/Events.hs @@ -538,7 +538,7 @@ replaceUnprintableWith :: Char -- ^ Replacement character -> B.ByteString -- ^ Binary message which may contain unprintable bytes -> T.Text -replaceUnprintableWith replacement = T.map replace . TE.decodeUtf8With (\_ _ -> Just replacement) +replaceUnprintableWith replacement = T.map replace . TE.decodeUtf8With (\_ _ -> Just replacement) where replace c | isPrint c = c @@ -592,6 +592,7 @@ showHeapProfBreakdown breakdown = case breakdown of HeapProfBreakdownBiography -> "biography" HeapProfBreakdownClosureType -> "closure type" HeapProfBreakdownInfoTable -> "info table" + HeapProfBreakdownEra -> "era" -- | How to format event timestamps data TimeFormat = RawTime | PrettyTime