{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiWayIf #-}
{-# OPTIONS_GHC -fsimpl-tick-factor=150 #-}
module GHC.RTS.Events (
EventLog(..),
Header(..),
Data(..),
EventType(..),
Event(..),
EventInfo(..),
ThreadStopStatus(..),
CapsetType(..),
HeapProfBreakdown(..),
HeapProfFlags(..),
Timestamp,
ThreadId,
TaskId,
KernelThreadId(..),
EventTypeNum,
EventTypeDesc,
EventTypeSize,
BlockSize,
Capset,
PID,
StringId,
ProcessId,
MachineId,
PortId,
MessageSize,
MessageTag(..),
ParConjDynId,
ParConjStaticId,
SparkId,
FutureId,
PerfEventTypeNum,
readEventLogFromFile,
writeEventLogToFile,
serialiseEventLog,
CapEvent(..), sortEvents,
buildEventTypeMap,
printEventsIncremental,
showEventInfo, buildEventInfo,
showThreadStopStatus,
ppEventLog, ppEventType,
ppEvent, buildEvent, buildEvent',
nEVENT_PERF_NAME, nEVENT_PERF_COUNTER, nEVENT_PERF_TRACEPOINT,
sz_perf_num, sz_kernel_tid,
spec,
time,
) where
import Control.Applicative
import Control.Concurrent hiding (ThreadId)
import qualified Data.Binary.Put as P
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import Data.Char (isPrint)
import Data.IntMap (IntMap)
import qualified Data.IntMap as IM
import Data.Function hiding (id)
import Data.List
import Data.String (IsString)
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import qualified Data.Text.Lazy as TL
import qualified Data.Text.Lazy.Builder as TB
import qualified Data.Text.Lazy.Builder.Int as TB
import qualified Data.Text.Lazy.IO as TL
import qualified Data.Vector.Unboxed as VU
import Data.Word
import System.IO
import Prelude hiding (gcd, rem, id)
import GHC.RTS.EventTypes
import GHC.RTS.Events.Binary
import GHC.RTS.Events.Incremental
#if !MIN_VERSION_base(4, 8, 0)
import Data.Foldable (foldMap)
import Data.Monoid (mempty)
#endif
#if !MIN_VERSION_base(4, 11, 0)
import Data.Monoid ((<>))
#endif
readEventLogFromFile :: FilePath -> IO (Either String EventLog)
readEventLogFromFile :: [Char] -> IO (Either [Char] EventLog)
readEventLogFromFile [Char]
path = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. (a, b) -> a
fst forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Either [Char] (EventLog, Maybe [Char])
readEventLog forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Char] -> IO ByteString
BL.readFile [Char]
path
printEventsIncremental
:: Bool
-> FilePath
-> IO ()
printEventsIncremental :: Bool -> [Char] -> IO ()
printEventsIncremental Bool
follow [Char]
path =
forall r. [Char] -> IOMode -> (Handle -> IO r) -> IO r
withFile [Char]
path IOMode
ReadMode (Bool -> Handle -> IO ()
hPrintEventsIncremental Bool
follow)
hPrintEventsIncremental
:: Bool
-> Handle
-> IO ()
hPrintEventsIncremental :: Bool -> Handle -> IO ()
hPrintEventsIncremental Bool
follow Handle
hdl = Decoder Event -> IO ()
go Decoder Event
decodeEventLog
where
go :: Decoder Event -> IO ()
go Decoder Event
decoder = case Decoder Event
decoder of
Produce Event
event Decoder Event
decoder' -> do
Handle -> Text -> IO ()
TL.hPutStrLn Handle
stdout forall a b. (a -> b) -> a -> b
$ Builder -> Text
TB.toLazyText forall a b. (a -> b) -> a -> b
$ Event -> Builder
buildEvent' Event
event
Decoder Event -> IO ()
go Decoder Event
decoder'
Consume ByteString -> Decoder Event
k -> do
ByteString
chunk <- Handle -> Int -> IO ByteString
B.hGetSome Handle
hdl Int
4096
if
| Bool -> Bool
not (ByteString -> Bool
B.null ByteString
chunk) -> Decoder Event -> IO ()
go forall a b. (a -> b) -> a -> b
$ ByteString -> Decoder Event
k ByteString
chunk
| Bool
follow -> Int -> IO ()
threadDelay Int
1000000 forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Decoder Event -> IO ()
go Decoder Event
decoder
| Bool
otherwise -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
Done {} -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
Error ByteString
_ [Char]
err -> forall (m :: * -> *) a. MonadFail m => [Char] -> m a
fail [Char]
err
writeEventLogToFile :: FilePath -> EventLog -> IO ()
writeEventLogToFile :: [Char] -> EventLog -> IO ()
writeEventLogToFile [Char]
fp = [Char] -> ByteString -> IO ()
BL.writeFile [Char]
fp forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventLog -> ByteString
serialiseEventLog
serialiseEventLog :: EventLog -> BL.ByteString
serialiseEventLog :: EventLog -> ByteString
serialiseEventLog el :: EventLog
el@(EventLog Header
_ (Data [Event]
events)) =
Put -> ByteString
P.runPut forall a b. (a -> b) -> a -> b
$ EventLog -> Put
putEventLog EventLog
blockedEl
where
eventsMap :: IntMap [Event]
eventsMap = [Event] -> IntMap [Event]
capSplitEvents [Event]
events
blockedEventsMap :: IntMap [Event]
blockedEventsMap = forall a b. (Int -> a -> b) -> IntMap a -> IntMap b
IM.mapWithKey Int -> [Event] -> [Event]
addBlockMarker IntMap [Event]
eventsMap
blockedEl :: EventLog
blockedEl = EventLog
el{dat :: Data
dat = [Event] -> Data
Data [Event]
blockedEvents}
blockedEvents :: [Event]
blockedEvents = forall a b. (a -> b -> b) -> b -> IntMap a -> b
IM.foldr forall a. [a] -> [a] -> [a]
(++) [] IntMap [Event]
blockedEventsMap
getIntCap :: Event -> Int
getIntCap :: Event -> Int
getIntCap Event{evCap :: Event -> Maybe Int
evCap = Maybe Int
cap} =
case Maybe Int
cap of
Just Int
capNo -> Int
capNo
Maybe Int
Nothing -> -Int
1
capSplitEvents :: [Event] -> IM.IntMap [Event]
capSplitEvents :: [Event] -> IntMap [Event]
capSplitEvents [Event]
evts = [Event] -> IntMap [Event] -> IntMap [Event]
capSplitEvents' [Event]
evts forall a. IntMap a
IM.empty
capSplitEvents' :: [Event] -> IM.IntMap [Event] -> IM.IntMap [Event]
capSplitEvents' :: [Event] -> IntMap [Event] -> IntMap [Event]
capSplitEvents' [Event]
evts IntMap [Event]
imap =
case [Event]
evts of
(Event
x:[Event]
xs) -> [Event] -> IntMap [Event] -> IntMap [Event]
capSplitEvents' [Event]
xs (forall a. (a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
IM.insertWith forall a. [a] -> [a] -> [a]
(++) (Event -> Int
getIntCap Event
x) [Event
x] IntMap [Event]
imap)
[] -> IntMap [Event]
imap
addBlockMarker :: Int -> [Event] -> [Event]
addBlockMarker :: Int -> [Event] -> [Event]
addBlockMarker Int
cap [Event]
evts =
(Timestamp -> EventInfo -> Maybe Int -> Event
Event Timestamp
startTime (Timestamp -> Int -> ThreadId -> EventInfo
EventBlock Timestamp
endTime Int
cap ThreadId
sz) (Int -> Maybe Int
mkCap Int
cap)) forall a. a -> [a] -> [a]
: [Event]
sortedEvts
where
sz :: ThreadId
sz = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int64
BL.length forall a b. (a -> b) -> a -> b
$ Put -> ByteString
P.runPut forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Event -> Put
putEvent [Event]
evts
startTime :: Timestamp
startTime = case [Event]
sortedEvts of
(Event
x:[Event]
_) -> Event -> Timestamp
evTime Event
x
[] -> forall a. HasCallStack => [Char] -> a
error [Char]
"Cannot add block marker to an empty list of events"
sortedEvts :: [Event]
sortedEvts = [Event] -> [Event]
sortEvents [Event]
evts
endTime :: Timestamp
endTime = Event -> Timestamp
evTime forall a b. (a -> b) -> a -> b
$ forall a. [a] -> a
last [Event]
sortedEvts
sortEvents :: [Event] -> [Event]
sortEvents :: [Event] -> [Event]
sortEvents = forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (forall a. Ord a => a -> a -> Ordering
compare forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` Event -> Timestamp
evTime)
buildEventTypeMap :: [EventType] -> IntMap EventType
buildEventTypeMap :: [EventType] -> IntMap EventType
buildEventTypeMap [EventType]
etypes =
forall a. [(Int, a)] -> IntMap a
IM.fromList [ (forall a b. (Integral a, Num b) => a -> b
fromIntegral (EventType -> EventTypeNum
num EventType
t),EventType
t) | EventType
t <- [EventType]
etypes ]
showEventInfo :: EventInfo -> String
showEventInfo :: EventInfo -> [Char]
showEventInfo = Text -> [Char]
TL.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventInfo -> Builder
buildEventInfo
buildEventInfo :: EventInfo -> TB.Builder
buildEventInfo :: EventInfo -> Builder
buildEventInfo EventInfo
spec' =
case EventInfo
spec' of
EventBlock Timestamp
end_time Int
cap ThreadId
_block_events ->
Builder
"event block: cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
forall a. Semigroup a => a -> a -> a
<> Builder
", end time: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
end_time forall a. Semigroup a => a -> a -> a
<> Builder
"\n"
Startup Int
n_caps ->
Builder
"startup: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
n_caps forall a. Semigroup a => a -> a -> a
<> Builder
" capabilities"
CreateThread ThreadId
thread ->
Builder
"creating thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
RunThread ThreadId
thread ->
Builder
"running thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
StopThread ThreadId
thread ThreadStopStatus
status ->
Builder
"stopping thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
forall a. Semigroup a => a -> a -> a
<> Builder
" (" forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (ThreadStopStatus -> [Char]
showThreadStopStatus ThreadStopStatus
status) forall a. Semigroup a => a -> a -> a
<> Builder
")"
ThreadRunnable ThreadId
thread ->
Builder
"thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread forall a. Semigroup a => a -> a -> a
<> Builder
" is runnable"
MigrateThread ThreadId
thread Int
newCap ->
Builder
"migrating thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
forall a. Semigroup a => a -> a -> a
<> Builder
" to cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
newCap
CreateSparkThread ThreadId
sparkThread ->
Builder
"creating spark thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
sparkThread
SparkCounters Timestamp
crt Timestamp
dud Timestamp
ovf Timestamp
cnv Timestamp
fiz Timestamp
gcd Timestamp
rem ->
Builder
"spark stats: "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
crt forall a. Semigroup a => a -> a -> a
<> Builder
" created, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
cnv forall a. Semigroup a => a -> a -> a
<> Builder
" converted, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
rem forall a. Semigroup a => a -> a -> a
<> Builder
" remaining ("
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
ovf forall a. Semigroup a => a -> a -> a
<> Builder
" overflowed, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
dud forall a. Semigroup a => a -> a -> a
<> Builder
" dud, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
gcd forall a. Semigroup a => a -> a -> a
<> Builder
" GC'd, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
fiz forall a. Semigroup a => a -> a -> a
<> Builder
" fizzled)"
EventInfo
SparkCreate ->
Builder
"spark created"
EventInfo
SparkDud ->
Builder
"dud spark discarded"
EventInfo
SparkOverflow ->
Builder
"overflowed spark discarded"
EventInfo
SparkRun ->
Builder
"running a local spark"
SparkSteal Int
victimCap ->
Builder
"stealing a spark from cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
victimCap
EventInfo
SparkFizzle ->
Builder
"spark fizzled"
EventInfo
SparkGC ->
Builder
"spark GCed"
TaskCreate Timestamp
taskId Int
cap KernelThreadId
tid ->
Builder
"task 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
taskId
forall a. Semigroup a => a -> a -> a
<> Builder
" created on cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
forall a. Semigroup a => a -> a -> a
<>Builder
" with OS kernel thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal (KernelThreadId -> Timestamp
kernelThreadId KernelThreadId
tid)
TaskMigrate Timestamp
taskId Int
cap Int
new_cap ->
Builder
"task 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
taskId
forall a. Semigroup a => a -> a -> a
<> Builder
" migrated from cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
forall a. Semigroup a => a -> a -> a
<> Builder
" to cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
new_cap
TaskDelete Timestamp
taskId ->
Builder
"task 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
taskId forall a. Semigroup a => a -> a -> a
<> Builder
" deleted"
EventInfo
Shutdown ->
Builder
"shutting down"
WakeupThread ThreadId
thread Int
otherCap ->
Builder
"waking up thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
forall a. Semigroup a => a -> a -> a
<> Builder
" on cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
otherCap
ThreadLabel ThreadId
thread Text
label ->
Builder
"thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
forall a. Semigroup a => a -> a -> a
<> Builder
" has label \"" forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
label forall a. Semigroup a => a -> a -> a
<> Builder
"\""
EventInfo
RequestSeqGC ->
Builder
"requesting sequential GC"
EventInfo
RequestParGC ->
Builder
"requesting parallel GC"
EventInfo
StartGC ->
Builder
"starting GC"
EventInfo
EndGC ->
Builder
"finished GC"
EventInfo
GCWork ->
Builder
"GC working"
EventInfo
GCIdle ->
Builder
"GC idle"
EventInfo
GCDone ->
Builder
"GC done"
EventInfo
GlobalSyncGC ->
Builder
"all caps stopped for GC"
GCStatsGHC{Int
Maybe Timestamp
ThreadId
Timestamp
parBalancedCopied :: EventInfo -> Maybe Timestamp
parTotCopied :: EventInfo -> Timestamp
parMaxCopied :: EventInfo -> Timestamp
parNThreads :: EventInfo -> Int
frag :: EventInfo -> Timestamp
slop :: EventInfo -> Timestamp
copied :: EventInfo -> Timestamp
gen :: EventInfo -> Int
heapCapset :: EventInfo -> ThreadId
parBalancedCopied :: Maybe Timestamp
parTotCopied :: Timestamp
parMaxCopied :: Timestamp
parNThreads :: Int
frag :: Timestamp
slop :: Timestamp
copied :: Timestamp
gen :: Int
heapCapset :: ThreadId
..} ->
Builder
"GC stats for heap capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapCapset
forall a. Semigroup a => a -> a -> a
<> Builder
": generation " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
gen forall a. Semigroup a => a -> a -> a
<> Builder
", "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
copied forall a. Semigroup a => a -> a -> a
<> Builder
" bytes copied, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
slop forall a. Semigroup a => a -> a -> a
<> Builder
" bytes slop, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
frag forall a. Semigroup a => a -> a -> a
<> Builder
" bytes fragmentation, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
parNThreads forall a. Semigroup a => a -> a -> a
<> Builder
" par threads, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
parMaxCopied forall a. Semigroup a => a -> a -> a
<> Builder
" bytes max par copied, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
parTotCopied forall a. Semigroup a => a -> a -> a
<> Builder
" bytes total par copied"
forall a. Semigroup a => a -> a -> a
<> forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Monoid a => a
mempty (\Timestamp
val -> Builder
", " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
val forall a. Semigroup a => a -> a -> a
<> Builder
" bytes balanced par copied") Maybe Timestamp
parBalancedCopied
MemReturn{ThreadId
returned :: EventInfo -> ThreadId
needed :: EventInfo -> ThreadId
current :: EventInfo -> ThreadId
returned :: ThreadId
needed :: ThreadId
current :: ThreadId
heapCapset :: ThreadId
heapCapset :: EventInfo -> ThreadId
..} ->
Builder
"memory returned (mblocks): current(" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
current forall a. Semigroup a => a -> a -> a
<>
Builder
") needed(" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
needed forall a. Semigroup a => a -> a -> a
<>
Builder
") returned(" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
returned forall a. Semigroup a => a -> a -> a
<> Builder
")"
HeapAllocated{ThreadId
Timestamp
allocBytes :: EventInfo -> Timestamp
allocBytes :: Timestamp
heapCapset :: ThreadId
heapCapset :: EventInfo -> ThreadId
..} ->
Builder
"allocated on heap capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapCapset
forall a. Semigroup a => a -> a -> a
<> Builder
": " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
allocBytes forall a. Semigroup a => a -> a -> a
<> Builder
" total bytes till now"
HeapSize{ThreadId
Timestamp
sizeBytes :: EventInfo -> Timestamp
sizeBytes :: Timestamp
heapCapset :: ThreadId
heapCapset :: EventInfo -> ThreadId
..} ->
Builder
"size of heap capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapCapset
forall a. Semigroup a => a -> a -> a
<> Builder
": " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
sizeBytes forall a. Semigroup a => a -> a -> a
<> Builder
" bytes"
BlocksSize{ThreadId
Timestamp
blocksSize :: EventInfo -> Timestamp
blocksSize :: Timestamp
heapCapset :: ThreadId
heapCapset :: EventInfo -> ThreadId
..} ->
Builder
"blocks size of heap capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapCapset
forall a. Semigroup a => a -> a -> a
<> Builder
": " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
blocksSize forall a. Semigroup a => a -> a -> a
<> Builder
" bytes"
HeapLive{ThreadId
Timestamp
liveBytes :: EventInfo -> Timestamp
liveBytes :: Timestamp
heapCapset :: ThreadId
heapCapset :: EventInfo -> ThreadId
..} ->
Builder
"live data in heap capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapCapset
forall a. Semigroup a => a -> a -> a
<> Builder
": " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
liveBytes forall a. Semigroup a => a -> a -> a
<> Builder
" bytes"
HeapInfoGHC{Int
ThreadId
Timestamp
blockSize :: EventInfo -> Timestamp
mblockSize :: EventInfo -> Timestamp
allocAreaSize :: EventInfo -> Timestamp
maxHeapSize :: EventInfo -> Timestamp
gens :: EventInfo -> Int
blockSize :: Timestamp
mblockSize :: Timestamp
allocAreaSize :: Timestamp
maxHeapSize :: Timestamp
gens :: Int
heapCapset :: ThreadId
heapCapset :: EventInfo -> ThreadId
..} ->
Builder
"heap stats for heap capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapCapset
forall a. Semigroup a => a -> a -> a
<> Builder
": generations " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
gens forall a. Semigroup a => a -> a -> a
<> Builder
", "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
maxHeapSize forall a. Semigroup a => a -> a -> a
<> Builder
" bytes max heap size, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
allocAreaSize forall a. Semigroup a => a -> a -> a
<> Builder
" bytes alloc area size, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
mblockSize forall a. Semigroup a => a -> a -> a
<> Builder
" bytes mblock size, "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
blockSize forall a. Semigroup a => a -> a -> a
<> Builder
" bytes block size"
CapCreate{Int
cap :: EventInfo -> Int
cap :: Int
cap} ->
Builder
"created cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
CapDelete{Int
cap :: Int
cap :: EventInfo -> Int
cap} ->
Builder
"deleted cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
CapDisable{Int
cap :: Int
cap :: EventInfo -> Int
cap} ->
Builder
"disabled cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
CapEnable{Int
cap :: Int
cap :: EventInfo -> Int
cap} ->
Builder
"enabled cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
Message Text
msg ->
Text -> Builder
TB.fromText Text
msg
UserMessage Text
msg ->
Text -> Builder
TB.fromText Text
msg
UserMarker Text
markername ->
Builder
"marker: " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
markername
CapsetCreate ThreadId
cs CapsetType
ct ->
Builder
"created capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
forall a. Semigroup a => a -> a -> a
<> Builder
" of type " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (forall a. Show a => a -> [Char]
show CapsetType
ct)
CapsetDelete ThreadId
cs ->
Builder
"deleted capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
CapsetAssignCap ThreadId
cs Int
cp ->
Builder
"assigned cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cp forall a. Semigroup a => a -> a -> a
<> Builder
" to capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
CapsetRemoveCap ThreadId
cs Int
cp ->
Builder
"removed cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cp forall a. Semigroup a => a -> a -> a
<> Builder
" from capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
OsProcessPid ThreadId
cs ThreadId
pid ->
Builder
"capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs forall a. Semigroup a => a -> a -> a
<> Builder
": pid " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
pid
OsProcessParentPid ThreadId
cs ThreadId
ppid ->
Builder
"capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs forall a. Semigroup a => a -> a -> a
<> Builder
": parent pid " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
ppid
WallClockTime ThreadId
cs Timestamp
sec ThreadId
nsec ->
Builder
"capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs forall a. Semigroup a => a -> a -> a
<> Builder
": wall clock time "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
sec forall a. Semigroup a => a -> a -> a
<> Builder
"s "
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
nsec forall a. Semigroup a => a -> a -> a
<> Builder
"ns (unix epoch)"
RtsIdentifier ThreadId
cs Text
i ->
Builder
"capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
forall a. Semigroup a => a -> a -> a
<> Builder
": RTS version \"" forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
i forall a. Semigroup a => a -> a -> a
<> Builder
"\""
ProgramArgs ThreadId
cs [Text]
args ->
Builder
"capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
forall a. Semigroup a => a -> a -> a
<> Builder
": args: " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (forall a. Show a => a -> [Char]
show [Text]
args)
ProgramEnv ThreadId
cs [Text]
env ->
Builder
"capset " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
cs
forall a. Semigroup a => a -> a -> a
<> Builder
": env: " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (forall a. Show a => a -> [Char]
show [Text]
env)
UnknownEvent EventTypeNum
n ->
Builder
"Unknown event type " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
n
InternString [Char]
str ThreadId
sId ->
Builder
"Interned string: \"" forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString [Char]
str
forall a. Semigroup a => a -> a -> a
<> Builder
"\" with id " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
sId
Version [Char]
version ->
Builder
"compiler version is " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString [Char]
version
ProgramInvocation [Char]
commandline ->
Builder
"program invocation: " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString [Char]
commandline
EventInfo
EdenStartReceive ->
Builder
"starting to receive"
EventInfo
EdenEndReceive ->
Builder
"stop receiving"
CreateProcess ThreadId
process ->
Builder
"creating process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
process
KillProcess ThreadId
process ->
Builder
"killing process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
process
AssignThreadToProcess ThreadId
thread ThreadId
process ->
Builder
"assigning thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread
forall a. Semigroup a => a -> a -> a
<> Builder
" to process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
process
CreateMachine EventTypeNum
machine Timestamp
realtime ->
Builder
"creating machine " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
machine
forall a. Semigroup a => a -> a -> a
<> Builder
" at " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
realtime
KillMachine EventTypeNum
machine ->
Builder
"killing machine " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
machine
SendMessage MessageTag
mesTag ThreadId
senderProcess ThreadId
senderThread
EventTypeNum
receiverMachine ThreadId
receiverProcess ThreadId
receiverInport ->
Builder
"sending message with tag " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (forall a. Show a => a -> [Char]
show MessageTag
mesTag)
forall a. Semigroup a => a -> a -> a
<> Builder
" from process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
senderProcess
forall a. Semigroup a => a -> a -> a
<> Builder
", thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
senderThread
forall a. Semigroup a => a -> a -> a
<> Builder
" to machine " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
receiverMachine
forall a. Semigroup a => a -> a -> a
<> Builder
", process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
receiverProcess
forall a. Semigroup a => a -> a -> a
<> Builder
" on inport " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
receiverInport
ReceiveMessage MessageTag
mesTag ThreadId
receiverProcess ThreadId
receiverInport
EventTypeNum
senderMachine ThreadId
senderProcess ThreadId
senderThread ThreadId
messageSize ->
Builder
"receiving message with tag " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (forall a. Show a => a -> [Char]
show MessageTag
mesTag)
forall a. Semigroup a => a -> a -> a
<> Builder
" at process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
receiverProcess
forall a. Semigroup a => a -> a -> a
<> Builder
", inport " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
receiverInport
forall a. Semigroup a => a -> a -> a
<> Builder
" from machine " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
senderMachine
forall a. Semigroup a => a -> a -> a
<> Builder
", process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
senderProcess
forall a. Semigroup a => a -> a -> a
<> Builder
", thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
senderThread
forall a. Semigroup a => a -> a -> a
<> Builder
" with size " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
messageSize
SendReceiveLocalMessage MessageTag
mesTag ThreadId
senderProcess ThreadId
senderThread
ThreadId
receiverProcess ThreadId
receiverInport ->
Builder
"sending/receiving message with tag " forall a. Semigroup a => a -> a -> a
<> [Char] -> Builder
TB.fromString (forall a. Show a => a -> [Char]
show MessageTag
mesTag)
forall a. Semigroup a => a -> a -> a
<> Builder
" from process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
senderProcess
forall a. Semigroup a => a -> a -> a
<> Builder
", thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
senderThread
forall a. Semigroup a => a -> a -> a
<> Builder
" to process " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
receiverProcess
forall a. Semigroup a => a -> a -> a
<> Builder
" on inport " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
receiverInport
MerStartParConjunction Timestamp
dyn_id ThreadId
static_id ->
Builder
"Start a parallel conjunction 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
forall a. Semigroup a => a -> a -> a
<> Builder
", static_id: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
static_id
MerEndParConjunction Timestamp
dyn_id ->
Builder
"End par conjunction: 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
MerEndParConjunct Timestamp
dyn_id ->
Builder
"End par conjunct: 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
MerCreateSpark Timestamp
dyn_id ThreadId
spark_id ->
Builder
"Create spark for conjunction: 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
forall a. Semigroup a => a -> a -> a
<> Builder
" spark: 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal ThreadId
spark_id
MerFutureCreate Timestamp
future_id ThreadId
name_id ->
Builder
"Create future 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
forall a. Semigroup a => a -> a -> a
<> Builder
" named " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
name_id
MerFutureWaitNosuspend Timestamp
future_id ->
Builder
"Wait didn't suspend for future: 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
MerFutureWaitSuspended Timestamp
future_id ->
Builder
"Wait suspended on future: 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
MerFutureSignal Timestamp
future_id ->
Builder
"Signaled future 0x" forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
EventInfo
MerLookingForGlobalThread ->
Builder
"Looking for global thread to resume"
EventInfo
MerWorkStealing ->
Builder
"Trying to steal a spark"
EventInfo
MerLookingForLocalSpark ->
Builder
"Looking for a local spark to execute"
MerReleaseThread ThreadId
thread_id ->
Builder
"Releasing thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
thread_id forall a. Semigroup a => a -> a -> a
<> Builder
" to the free pool"
EventInfo
MerCapSleeping ->
Builder
"Capability going to sleep"
EventInfo
MerCallingMain ->
Builder
"About to call the program entry point"
PerfName{ThreadId
perfNum :: EventInfo -> ThreadId
perfNum :: ThreadId
perfNum, Text
name :: EventInfo -> Text
name :: Text
name} ->
Builder
"perf event " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
perfNum
forall a. Semigroup a => a -> a -> a
<> Builder
" named \"" forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
name forall a. Semigroup a => a -> a -> a
<> Builder
"\""
PerfCounter{ThreadId
perfNum :: ThreadId
perfNum :: EventInfo -> ThreadId
perfNum, KernelThreadId
tid :: EventInfo -> KernelThreadId
tid :: KernelThreadId
tid, Timestamp
period :: EventInfo -> Timestamp
period :: Timestamp
period} ->
Builder
"perf event counter " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
perfNum
forall a. Semigroup a => a -> a -> a
<> Builder
" incremented by " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal (Timestamp
period forall a. Num a => a -> a -> a
+ Timestamp
1)
forall a. Semigroup a => a -> a -> a
<> Builder
" in OS thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal (KernelThreadId -> Timestamp
kernelThreadId KernelThreadId
tid)
PerfTracepoint{ThreadId
perfNum :: ThreadId
perfNum :: EventInfo -> ThreadId
perfNum, KernelThreadId
tid :: KernelThreadId
tid :: EventInfo -> KernelThreadId
tid} ->
Builder
"perf event tracepoint " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
perfNum
forall a. Semigroup a => a -> a -> a
<> Builder
" reached in OS thread " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal (KernelThreadId -> Timestamp
kernelThreadId KernelThreadId
tid)
HeapProfBegin {Word8
Timestamp
Text
HeapProfBreakdown
heapProfBiographyFilter :: EventInfo -> Text
heapProfRetainerFilter :: EventInfo -> Text
heapProfCostCentreStackFilter :: EventInfo -> Text
heapProfCostCentreFilter :: EventInfo -> Text
heapProfTypeDescrFilter :: EventInfo -> Text
heapProfClosureDescrFilter :: EventInfo -> Text
heapProfModuleFilter :: EventInfo -> Text
heapProfBreakdown :: EventInfo -> HeapProfBreakdown
heapProfSamplingPeriod :: EventInfo -> Timestamp
heapProfId :: EventInfo -> Word8
heapProfBiographyFilter :: Text
heapProfRetainerFilter :: Text
heapProfCostCentreStackFilter :: Text
heapProfCostCentreFilter :: Text
heapProfTypeDescrFilter :: Text
heapProfClosureDescrFilter :: Text
heapProfModuleFilter :: Text
heapProfBreakdown :: HeapProfBreakdown
heapProfSamplingPeriod :: Timestamp
heapProfId :: Word8
..} ->
Builder
"start heap profiling " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Word8
heapProfId
forall a. Semigroup a => a -> a -> a
<> Builder
" at sampling period " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSamplingPeriod
forall a. Semigroup a => a -> a -> a
<> Builder
" broken down by " forall a. Semigroup a => a -> a -> a
<> forall s. IsString s => HeapProfBreakdown -> s
showHeapProfBreakdown HeapProfBreakdown
heapProfBreakdown
forall a. Semigroup a => a -> a -> a
<> forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (Builder
" filtered by " forall a. Semigroup a => a -> a -> a
<>)
([Text] -> Maybe Builder
buildFilters
[ Text
heapProfModuleFilter
, Text
heapProfClosureDescrFilter
, Text
heapProfTypeDescrFilter
, Text
heapProfCostCentreFilter
, Text
heapProfCostCentreStackFilter
, Text
heapProfRetainerFilter
, Text
heapProfBiographyFilter
])
HeapProfCostCentre {ThreadId
Text
HeapProfFlags
heapProfFlags :: EventInfo -> HeapProfFlags
heapProfSrcLoc :: EventInfo -> Text
heapProfModule :: EventInfo -> Text
heapProfLabel :: EventInfo -> Text
heapProfCostCentreId :: EventInfo -> ThreadId
heapProfFlags :: HeapProfFlags
heapProfSrcLoc :: Text
heapProfModule :: Text
heapProfLabel :: Text
heapProfCostCentreId :: ThreadId
..} ->
Builder
"cost centre " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
heapProfCostCentreId
forall a. Semigroup a => a -> a -> a
<> Builder
" " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfLabel
forall a. Semigroup a => a -> a -> a
<> Builder
" in " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfModule
forall a. Semigroup a => a -> a -> a
<> Builder
" at " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfSrcLoc
forall a. Semigroup a => a -> a -> a
<> if HeapProfFlags -> Bool
isCaf HeapProfFlags
heapProfFlags then Builder
" CAF" else Builder
""
InfoTableProv{Int
Timestamp
Text
itSrcLoc :: EventInfo -> Text
itModule :: EventInfo -> Text
itLabel :: EventInfo -> Text
itTyDesc :: EventInfo -> Text
itClosureDesc :: EventInfo -> Int
itTableName :: EventInfo -> Text
itInfo :: EventInfo -> Timestamp
itSrcLoc :: Text
itModule :: Text
itLabel :: Text
itTyDesc :: Text
itClosureDesc :: Int
itTableName :: Text
itInfo :: Timestamp
..} ->
Builder
"Info Table: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
itInfo forall a. Semigroup a => a -> a -> a
<> Builder
":"
forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
itClosureDesc forall a. Semigroup a => a -> a -> a
<> Builder
":"
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
itTableName
forall a. Semigroup a => a -> a -> a
<> Builder
" - " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
itSrcLoc
HeapProfSampleBegin {Timestamp
heapProfSampleEra :: EventInfo -> Timestamp
heapProfSampleEra :: Timestamp
..} ->
Builder
"start heap prof sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleEra
HeapProfSampleEnd {Timestamp
heapProfSampleEra :: Timestamp
heapProfSampleEra :: EventInfo -> Timestamp
..} ->
Builder
"end prof sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleEra
HeapBioProfSampleBegin {Timestamp
heapProfSampleTime :: EventInfo -> Timestamp
heapProfSampleTime :: Timestamp
heapProfSampleEra :: Timestamp
heapProfSampleEra :: EventInfo -> Timestamp
..} ->
Builder
"start heap prof sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleEra
forall a. Semigroup a => a -> a -> a
<> Builder
" at time " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleTime
HeapProfSampleCostCentre {Word8
Timestamp
Vector ThreadId
heapProfStack :: EventInfo -> Vector ThreadId
heapProfStackDepth :: EventInfo -> Word8
heapProfResidency :: EventInfo -> Timestamp
heapProfStack :: Vector ThreadId
heapProfStackDepth :: Word8
heapProfResidency :: Timestamp
heapProfId :: Word8
heapProfId :: EventInfo -> Word8
..} ->
Builder
"heap prof sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Word8
heapProfId
forall a. Semigroup a => a -> a -> a
<> Builder
", residency " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfResidency
forall a. Semigroup a => a -> a -> a
<> Builder
", cost centre stack " forall a. Semigroup a => a -> a -> a
<> Vector ThreadId -> Builder
buildCostCentreStack Vector ThreadId
heapProfStack
HeapProfSampleString {Word8
Timestamp
Text
heapProfLabel :: Text
heapProfResidency :: Timestamp
heapProfId :: Word8
heapProfResidency :: EventInfo -> Timestamp
heapProfLabel :: EventInfo -> Text
heapProfId :: EventInfo -> Word8
..} ->
Builder
"heap prof sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Word8
heapProfId
forall a. Semigroup a => a -> a -> a
<> Builder
", residency " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfResidency
forall a. Semigroup a => a -> a -> a
<> Builder
", label " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfLabel
ProfSampleCostCentre {Word8
ThreadId
Timestamp
Vector ThreadId
profCcsStack :: EventInfo -> Vector ThreadId
profStackDepth :: EventInfo -> Word8
profTicks :: EventInfo -> Timestamp
profCapset :: EventInfo -> ThreadId
profCcsStack :: Vector ThreadId
profStackDepth :: Word8
profTicks :: Timestamp
profCapset :: ThreadId
..} ->
Builder
"cap no " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
profCapset
forall a. Semigroup a => a -> a -> a
<> Builder
", prof sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
profTicks
forall a. Semigroup a => a -> a -> a
<> Builder
", cost centre stack " forall a. Semigroup a => a -> a -> a
<> Vector ThreadId -> Builder
buildCostCentreStack Vector ThreadId
profCcsStack
ProfBegin {Timestamp
profTickInterval :: EventInfo -> Timestamp
profTickInterval :: Timestamp
..} ->
Builder
"start time profiling, tick interval " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
profTickInterval forall a. Semigroup a => a -> a -> a
<> Builder
" (ns)"
UserBinaryMessage {ByteString
payload :: EventInfo -> ByteString
payload :: ByteString
..} ->
Builder
"binary message " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText (Char -> ByteString -> Text
replaceUnprintableWith Char
'.' ByteString
payload)
EventInfo
ConcMarkBegin ->
Builder
"concurrent mark began"
ConcMarkEnd {ThreadId
concMarkedObjectCount :: EventInfo -> ThreadId
concMarkedObjectCount :: ThreadId
..} ->
Builder
"concurrent mark ended: "
forall a. Semigroup a => a -> a -> a
<> Builder
"marked " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
concMarkedObjectCount forall a. Semigroup a => a -> a -> a
<> Builder
" objects"
EventInfo
ConcSyncBegin ->
Builder
"post-mark synchronization began"
EventInfo
ConcSyncEnd ->
Builder
"post-mark synchronization ended"
EventInfo
ConcSweepBegin ->
Builder
"concurrent sweep began"
EventInfo
ConcSweepEnd ->
Builder
"concurrent sweep ended"
ConcUpdRemSetFlush {Int
cap :: Int
cap :: EventInfo -> Int
..} ->
Builder
"update remembered set flushed by " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
cap
NonmovingHeapCensus {Word8
ThreadId
nonmovingCensusLiveBlocks :: EventInfo -> ThreadId
nonmovingCensusFilledSegs :: EventInfo -> ThreadId
nonmovingCensusActiveSegs :: EventInfo -> ThreadId
nonmovingCensusBlkSize :: EventInfo -> Word8
nonmovingCensusLiveBlocks :: ThreadId
nonmovingCensusFilledSegs :: ThreadId
nonmovingCensusActiveSegs :: ThreadId
nonmovingCensusBlkSize :: Word8
..} ->
Builder
"nonmoving heap census " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal (Int
2forall a b. (Num a, Integral b) => a -> b -> a
^Word8
nonmovingCensusBlkSize :: Int)
forall a. Semigroup a => a -> a -> a
<> Builder
": " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
nonmovingCensusActiveSegs forall a. Semigroup a => a -> a -> a
<> Builder
" active segments"
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
nonmovingCensusFilledSegs forall a. Semigroup a => a -> a -> a
<> Builder
" filled segments"
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal ThreadId
nonmovingCensusLiveBlocks forall a. Semigroup a => a -> a -> a
<> Builder
" live blocks"
TickyCounterDef {Maybe Text
EventTypeNum
Timestamp
Text
tickyCtrJsonDesc :: EventInfo -> Maybe Text
tickyCtrInfoTbl :: EventInfo -> Timestamp
tickyCtrDefName :: EventInfo -> Text
tickyCtrDefKinds :: EventInfo -> Text
tickyCtrDefArity :: EventInfo -> EventTypeNum
tickyCtrDefId :: EventInfo -> Timestamp
tickyCtrJsonDesc :: Maybe Text
tickyCtrInfoTbl :: Timestamp
tickyCtrDefName :: Text
tickyCtrDefKinds :: Text
tickyCtrDefArity :: EventTypeNum
tickyCtrDefId :: Timestamp
..} ->
Builder
"ticky counter definition " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrDefId
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> Builder
"arity: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
tickyCtrDefArity
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> Builder
"def kinds: " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
tickyCtrDefKinds
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> Builder
"name: " forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
tickyCtrDefName
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> Builder
"itbl: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
tickyCtrInfoTbl
TickyCounterSample {Timestamp
tickyCtrSampleAllocd :: EventInfo -> Timestamp
tickyCtrSampleAllocs :: EventInfo -> Timestamp
tickyCtrSampleEntryCount :: EventInfo -> Timestamp
tickyCtrSampleId :: EventInfo -> Timestamp
tickyCtrSampleAllocd :: Timestamp
tickyCtrSampleAllocs :: Timestamp
tickyCtrSampleEntryCount :: Timestamp
tickyCtrSampleId :: Timestamp
..} ->
Builder
"ticky counter sample " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleId
forall a. Semigroup a => a -> a -> a
<> Builder
": " forall a. Semigroup a => a -> a -> a
<> Builder
"entry count: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleEntryCount
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleAllocs forall a. Semigroup a => a -> a -> a
<> Builder
" allocs"
forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleAllocd forall a. Semigroup a => a -> a -> a
<> Builder
" allocd"
EventInfo
TickyBeginSample ->
Builder
"ticky begin counter sample"
replaceUnprintableWith
:: Char
-> B.ByteString
-> T.Text
replaceUnprintableWith :: Char -> ByteString -> Text
replaceUnprintableWith Char
replacement = (Char -> Char) -> Text -> Text
T.map Char -> Char
replace forall b c a. (b -> c) -> (a -> b) -> a -> c
. OnDecodeError -> ByteString -> Text
TE.decodeUtf8With (\[Char]
_ Maybe Word8
_ -> forall a. a -> Maybe a
Just Char
replacement)
where
replace :: Char -> Char
replace Char
c
| Char -> Bool
isPrint Char
c = Char
c
| Bool
otherwise = Char
replacement
buildFilters :: [T.Text] -> Maybe TB.Builder
buildFilters :: [Text] -> Maybe Builder
buildFilters = forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Text -> Maybe Builder -> Maybe Builder
g forall a. Maybe a
Nothing
where
g :: Text -> Maybe Builder -> Maybe Builder
g Text
f Maybe Builder
b
| Text -> Bool
T.null Text
f = Maybe Builder
b
| Bool
otherwise = forall a. a -> Maybe a
Just (Text -> Builder
TB.fromText Text
f forall a. Semigroup a => a -> a -> a
<> Builder
", ") forall a. Semigroup a => a -> a -> a
<> Maybe Builder
b
buildCostCentreStack :: VU.Vector Word32 -> TB.Builder
buildCostCentreStack :: Vector ThreadId -> Builder
buildCostCentreStack = forall b a. Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a
VU.ifoldl' forall {a} {a}.
(Integral a, Num a, Eq a) =>
Builder -> a -> a -> Builder
go Builder
""
where
go :: Builder -> a -> a -> Builder
go Builder
b a
i a
cc
| a
i forall a. Eq a => a -> a -> Bool
== a
0 = forall a. Integral a => a -> Builder
TB.decimal a
cc
| Bool
otherwise = Builder
b forall a. Semigroup a => a -> a -> a
<> Builder
", " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal a
cc
showThreadStopStatus :: ThreadStopStatus -> String
showThreadStopStatus :: ThreadStopStatus -> [Char]
showThreadStopStatus ThreadStopStatus
HeapOverflow = [Char]
"heap overflow"
showThreadStopStatus ThreadStopStatus
StackOverflow = [Char]
"stack overflow"
showThreadStopStatus ThreadStopStatus
ThreadYielding = [Char]
"thread yielding"
showThreadStopStatus ThreadStopStatus
ThreadBlocked = [Char]
"thread blocked"
showThreadStopStatus ThreadStopStatus
ThreadFinished = [Char]
"thread finished"
showThreadStopStatus ThreadStopStatus
ForeignCall = [Char]
"making a foreign call"
showThreadStopStatus ThreadStopStatus
BlockedOnMVar = [Char]
"blocked on an MVar"
showThreadStopStatus ThreadStopStatus
BlockedOnMVarRead = [Char]
"blocked reading an MVar"
showThreadStopStatus ThreadStopStatus
BlockedOnBlackHole = [Char]
"blocked on a black hole"
showThreadStopStatus ThreadStopStatus
BlockedOnRead = [Char]
"blocked on I/O read"
showThreadStopStatus ThreadStopStatus
BlockedOnWrite = [Char]
"blocked on I/O write"
showThreadStopStatus ThreadStopStatus
BlockedOnDelay = [Char]
"blocked on threadDelay"
showThreadStopStatus ThreadStopStatus
BlockedOnSTM = [Char]
"blocked in STM retry"
showThreadStopStatus ThreadStopStatus
BlockedOnDoProc = [Char]
"blocked on asyncDoProc"
showThreadStopStatus ThreadStopStatus
BlockedOnCCall = [Char]
"blocked in a foreign call"
showThreadStopStatus ThreadStopStatus
BlockedOnCCall_NoUnblockExc = [Char]
"blocked in a foreign call"
showThreadStopStatus ThreadStopStatus
BlockedOnMsgThrowTo = [Char]
"blocked in throwTo"
showThreadStopStatus ThreadStopStatus
ThreadMigrating = [Char]
"thread migrating"
showThreadStopStatus ThreadStopStatus
BlockedOnMsgGlobalise = [Char]
"waiting for data to be globalised"
showThreadStopStatus (BlockedOnBlackHoleOwnedBy ThreadId
target) =
[Char]
"blocked on black hole owned by thread " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show ThreadId
target
showThreadStopStatus ThreadStopStatus
NoStatus = [Char]
"No stop thread status"
showHeapProfBreakdown :: IsString s => HeapProfBreakdown -> s
showHeapProfBreakdown :: forall s. IsString s => HeapProfBreakdown -> s
showHeapProfBreakdown HeapProfBreakdown
breakdown = case HeapProfBreakdown
breakdown of
HeapProfBreakdown
HeapProfBreakdownCostCentre -> s
"cost centre"
HeapProfBreakdown
HeapProfBreakdownModule -> s
"module"
HeapProfBreakdown
HeapProfBreakdownClosureDescr -> s
"closure description"
HeapProfBreakdown
HeapProfBreakdownTypeDescr -> s
"type description"
HeapProfBreakdown
HeapProfBreakdownRetainer -> s
"retainer"
HeapProfBreakdown
HeapProfBreakdownBiography -> s
"biography"
HeapProfBreakdown
HeapProfBreakdownClosureType -> s
"closure type"
HeapProfBreakdown
HeapProfBreakdownInfoTable -> s
"info table"
ppEventLog :: EventLog -> String
ppEventLog :: EventLog -> [Char]
ppEventLog = Text -> [Char]
TL.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventLog -> Builder
buildEventLog
buildEventLog :: EventLog -> TB.Builder
buildEventLog :: EventLog -> Builder
buildEventLog (EventLog (Header [EventType]
ets) (Data [Event]
es)) =
Builder
"Event Types:\n"
forall a. Semigroup a => a -> a -> a
<> forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (\EventType
evType -> EventType -> Builder
buildEventType EventType
evType forall a. Semigroup a => a -> a -> a
<> Builder
"\n") [EventType]
ets
forall a. Semigroup a => a -> a -> a
<> Builder
"\n"
forall a. Semigroup a => a -> a -> a
<> Builder
"Events:\n"
forall a. Semigroup a => a -> a -> a
<> forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (\Event
ev -> IntMap EventType -> Event -> Builder
buildEvent IntMap EventType
imap Event
ev forall a. Semigroup a => a -> a -> a
<> Builder
"\n") [Event]
sorted
where
imap :: IntMap EventType
imap = [EventType] -> IntMap EventType
buildEventTypeMap [EventType]
ets
sorted :: [Event]
sorted = [Event] -> [Event]
sortEvents [Event]
es
ppEventType :: EventType -> String
ppEventType :: EventType -> [Char]
ppEventType = Text -> [Char]
TL.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventType -> Builder
buildEventType
buildEventType :: EventType -> TB.Builder
buildEventType :: EventType -> Builder
buildEventType (EventType EventTypeNum
num Text
dsc Maybe EventTypeNum
msz) =
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
num forall a. Semigroup a => a -> a -> a
<> Builder
": "
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
dsc forall a. Semigroup a => a -> a -> a
<> Builder
" (size "
forall a. Semigroup a => a -> a -> a
<> forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"variable" forall a. Integral a => a -> Builder
TB.decimal Maybe EventTypeNum
msz forall a. Semigroup a => a -> a -> a
<> Builder
")"
ppEvent
:: IntMap EventType
-> Event
-> String
ppEvent :: IntMap EventType -> Event -> [Char]
ppEvent IntMap EventType
imap = Text -> [Char]
TL.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText forall b c a. (b -> c) -> (a -> b) -> a -> c
. IntMap EventType -> Event -> Builder
buildEvent IntMap EventType
imap
buildEvent :: IntMap EventType -> Event -> TB.Builder
buildEvent :: IntMap EventType -> Event -> Builder
buildEvent IntMap EventType
imap Event {Maybe Int
Timestamp
EventInfo
evSpec :: Event -> EventInfo
evCap :: Maybe Int
evSpec :: EventInfo
evTime :: Timestamp
evTime :: Event -> Timestamp
evCap :: Event -> Maybe Int
..} =
forall a. Integral a => a -> Builder
TB.decimal Timestamp
evTime
forall a. Semigroup a => a -> a -> a
<> Builder
": "
forall a. Semigroup a => a -> a -> a
<> forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (\Int
c -> Builder
"cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
c forall a. Semigroup a => a -> a -> a
<> Builder
": ") Maybe Int
evCap
forall a. Semigroup a => a -> a -> a
<> case EventInfo
evSpec of
UnknownEvent{ ref :: EventInfo -> EventTypeNum
ref=EventTypeNum
ref } ->
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (Text -> Builder
TB.fromText forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventType -> Text
desc) forall a b. (a -> b) -> a -> b
$ forall a. Int -> IntMap a -> Maybe a
IM.lookup (forall a b. (Integral a, Num b) => a -> b
fromIntegral EventTypeNum
ref) IntMap EventType
imap
EventInfo
_ -> EventInfo -> Builder
buildEventInfo EventInfo
evSpec
buildEvent' :: Event -> TB.Builder
buildEvent' :: Event -> Builder
buildEvent' Event {Maybe Int
Timestamp
EventInfo
evCap :: Maybe Int
evSpec :: EventInfo
evTime :: Timestamp
evSpec :: Event -> EventInfo
evTime :: Event -> Timestamp
evCap :: Event -> Maybe Int
..} =
forall a. Integral a => a -> Builder
TB.decimal Timestamp
evTime
forall a. Semigroup a => a -> a -> a
<> Builder
": "
forall a. Semigroup a => a -> a -> a
<> forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (\Int
c -> Builder
"cap " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal Int
c forall a. Semigroup a => a -> a -> a
<> Builder
": ") Maybe Int
evCap
forall a. Semigroup a => a -> a -> a
<> case EventInfo
evSpec of
UnknownEvent{ ref :: EventInfo -> EventTypeNum
ref=EventTypeNum
ref } ->
Builder
"Unknown Event (ref: " forall a. Semigroup a => a -> a -> a
<> forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
ref forall a. Semigroup a => a -> a -> a
<> Builder
")"
EventInfo
_ -> EventInfo -> Builder
buildEventInfo EventInfo
evSpec