Skip to content

Commit

Permalink
Add support for era event types
Browse files Browse the repository at this point in the history
  • Loading branch information
mpickering authored and fendor committed Apr 10, 2024
1 parent 4e26bd1 commit 92db486
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/GHC/RTS/EventTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ data HeapProfBreakdown
| HeapProfBreakdownBiography
| HeapProfBreakdownClosureType
| HeapProfBreakdownInfoTable
| HeapProfBreakdownEra
deriving Show

instance Binary HeapProfBreakdown where
Expand All @@ -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)
Expand All @@ -657,6 +659,9 @@ instance Binary HeapProfBreakdown where
HeapProfBreakdownBiography -> 6
HeapProfBreakdownClosureType -> 7
HeapProfBreakdownInfoTable -> 8
HeapProfBreakdownEra -> 9



newtype HeapProfFlags = HeapProfFlags Word8
deriving (Show, Binary)
Expand Down
3 changes: 2 additions & 1 deletion src/GHC/RTS/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 92db486

Please sign in to comment.