{-# 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.Char8 as B8
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 :: FilePath -> IO (Either FilePath EventLog)
readEventLogFromFile FilePath
path = ((EventLog, Maybe FilePath) -> EventLog)
-> Either FilePath (EventLog, Maybe FilePath)
-> Either FilePath EventLog
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (EventLog, Maybe FilePath) -> EventLog
forall a b. (a, b) -> a
fst (Either FilePath (EventLog, Maybe FilePath)
-> Either FilePath EventLog)
-> (ByteString -> Either FilePath (EventLog, Maybe FilePath))
-> ByteString
-> Either FilePath EventLog
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Either FilePath (EventLog, Maybe FilePath)
readEventLog (ByteString -> Either FilePath EventLog)
-> IO ByteString -> IO (Either FilePath EventLog)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FilePath -> IO ByteString
BL.readFile FilePath
path
printEventsIncremental
:: Bool
-> FilePath
-> IO ()
printEventsIncremental :: Bool -> FilePath -> IO ()
printEventsIncremental Bool
follow FilePath
path =
FilePath -> IOMode -> (Handle -> IO ()) -> IO ()
forall r. FilePath -> IOMode -> (Handle -> IO r) -> IO r
withFile FilePath
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 (Text -> IO ()) -> Text -> IO ()
forall a b. (a -> b) -> a -> b
$ Builder -> Text
TB.toLazyText (Builder -> Text) -> Builder -> Text
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 (Decoder Event -> IO ()) -> Decoder Event -> IO ()
forall a b. (a -> b) -> a -> b
$ ByteString -> Decoder Event
k ByteString
chunk
| Bool
follow -> Int -> IO ()
threadDelay Int
1000000 IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Decoder Event -> IO ()
go Decoder Event
decoder
| Bool
otherwise -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
Done {} -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
Error ByteString
_ FilePath
err -> FilePath -> IO ()
forall (m :: * -> *) a. MonadFail m => FilePath -> m a
fail FilePath
err
writeEventLogToFile :: FilePath -> EventLog -> IO ()
writeEventLogToFile :: FilePath -> EventLog -> IO ()
writeEventLogToFile FilePath
fp = FilePath -> ByteString -> IO ()
BL.writeFile FilePath
fp (ByteString -> IO ())
-> (EventLog -> ByteString) -> EventLog -> IO ()
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 (Put -> ByteString) -> Put -> ByteString
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 = (Int -> [Event] -> [Event]) -> IntMap [Event] -> IntMap [Event]
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 = ([Event] -> [Event] -> [Event])
-> [Event] -> IntMap [Event] -> [Event]
forall a b. (a -> b -> b) -> b -> IntMap a -> b
IM.foldr [Event] -> [Event] -> [Event]
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 IntMap [Event]
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 (([Event] -> [Event] -> [Event])
-> Int -> [Event] -> IntMap [Event] -> IntMap [Event]
forall a. (a -> a -> a) -> Int -> a -> IntMap a -> IntMap a
IM.insertWith [Event] -> [Event] -> [Event]
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 -> BlockSize -> EventInfo
EventBlock Timestamp
endTime Int
cap BlockSize
sz) (Int -> Maybe Int
mkCap Int
cap)) Event -> [Event] -> [Event]
forall a. a -> [a] -> [a]
: [Event]
sortedEvts
where
sz :: BlockSize
sz = Int64 -> BlockSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int64 -> BlockSize)
-> (ByteString -> Int64) -> ByteString -> BlockSize
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int64
BL.length (ByteString -> BlockSize) -> ByteString -> BlockSize
forall a b. (a -> b) -> a -> b
$ Put -> ByteString
P.runPut (Put -> ByteString) -> Put -> ByteString
forall a b. (a -> b) -> a -> b
$ (Event -> Put) -> [Event] -> Put
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
[] -> FilePath -> Timestamp
forall a. HasCallStack => FilePath -> a
error FilePath
"Cannot add block marker to an empty list of events"
sortedEvts :: [Event]
sortedEvts = [Event] -> [Event]
sortEvents [Event]
evts
endTime :: Timestamp
endTime = Event -> Timestamp
evTime (Event -> Timestamp) -> Event -> Timestamp
forall a b. (a -> b) -> a -> b
$ [Event] -> Event
forall a. [a] -> a
last [Event]
sortedEvts
sortEvents :: [Event] -> [Event]
sortEvents :: [Event] -> [Event]
sortEvents = (Event -> Event -> Ordering) -> [Event] -> [Event]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (Timestamp -> Timestamp -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Timestamp -> Timestamp -> Ordering)
-> (Event -> Timestamp) -> Event -> Event -> Ordering
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 =
[(Int, EventType)] -> IntMap EventType
forall a. [(Int, a)] -> IntMap a
IM.fromList [ (EventTypeNum -> Int
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 -> FilePath
showEventInfo = Text -> FilePath
TL.unpack (Text -> FilePath) -> (EventInfo -> Text) -> EventInfo -> FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText (Builder -> Text) -> (EventInfo -> Builder) -> EventInfo -> Text
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 BlockSize
_block_events ->
Builder
"event block: cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", end time: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
end_time Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"\n"
Startup Int
n_caps ->
Builder
"startup: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
n_caps Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" capabilities"
CreateThread BlockSize
thread ->
Builder
"creating thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
RunThread BlockSize
thread ->
Builder
"running thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
StopThread BlockSize
thread ThreadStopStatus
status ->
Builder
"stopping thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" (" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString (ThreadStopStatus -> FilePath
showThreadStopStatus ThreadStopStatus
status) Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
")"
ThreadRunnable BlockSize
thread ->
Builder
"thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" is runnable"
MigrateThread BlockSize
thread Int
newCap ->
Builder
"migrating thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" to cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
newCap
CreateSparkThread BlockSize
sparkThread ->
Builder
"creating spark thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
sparkThread
SparkCounters Timestamp
crt Timestamp
dud Timestamp
ovf Timestamp
cnv Timestamp
fiz Timestamp
gcd Timestamp
rem ->
Builder
"spark stats: "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
crt Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" created, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
cnv Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" converted, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
rem Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" remaining ("
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
ovf Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" overflowed, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
dud Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" dud, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
gcd Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" GC'd, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
fiz Builder -> Builder -> Builder
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 " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
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" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
taskId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" created on cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<>Builder
" with OS kernel thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal (KernelThreadId -> Timestamp
kernelThreadId KernelThreadId
tid)
TaskMigrate Timestamp
taskId Int
cap Int
new_cap ->
Builder
"task 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
taskId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" migrated from cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" to cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
new_cap
TaskDelete Timestamp
taskId ->
Builder
"task 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
taskId Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" deleted"
EventInfo
Shutdown ->
Builder
"shutting down"
WakeupThread BlockSize
thread Int
otherCap ->
Builder
"waking up thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" on cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
otherCap
ThreadLabel BlockSize
thread Text
label ->
Builder
"thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" has label \"" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
label Builder -> Builder -> Builder
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
BlockSize
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 -> BlockSize
parBalancedCopied :: Maybe Timestamp
parTotCopied :: Timestamp
parMaxCopied :: Timestamp
parNThreads :: Int
frag :: Timestamp
slop :: Timestamp
copied :: Timestamp
gen :: Int
heapCapset :: BlockSize
..} ->
Builder
"GC stats for heap capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
heapCapset
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": generation " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
gen Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
copied Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes copied, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
slop Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes slop, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
frag Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes fragmentation, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
parNThreads Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" par threads, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
parMaxCopied Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes max par copied, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
parTotCopied Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes total par copied"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> (Timestamp -> Builder) -> Maybe Timestamp -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
forall a. Monoid a => a
mempty (\Timestamp
val -> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
val Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes balanced par copied") Maybe Timestamp
parBalancedCopied
HeapAllocated{BlockSize
Timestamp
allocBytes :: EventInfo -> Timestamp
allocBytes :: Timestamp
heapCapset :: BlockSize
heapCapset :: EventInfo -> BlockSize
..} ->
Builder
"allocated on heap capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
heapCapset
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
allocBytes Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" total bytes till now"
HeapSize{BlockSize
Timestamp
sizeBytes :: EventInfo -> Timestamp
sizeBytes :: Timestamp
heapCapset :: BlockSize
heapCapset :: EventInfo -> BlockSize
..} ->
Builder
"size of heap capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
heapCapset
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
sizeBytes Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes"
HeapLive{BlockSize
Timestamp
liveBytes :: EventInfo -> Timestamp
liveBytes :: Timestamp
heapCapset :: BlockSize
heapCapset :: EventInfo -> BlockSize
..} ->
Builder
"live data in heap capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
heapCapset
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
liveBytes Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes"
HeapInfoGHC{Int
BlockSize
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 :: BlockSize
heapCapset :: EventInfo -> BlockSize
..} ->
Builder
"heap stats for heap capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
heapCapset
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": generations " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
gens Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
maxHeapSize Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes max heap size, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
allocAreaSize Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes alloc area size, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
mblockSize Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes mblock size, "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
blockSize Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" bytes block size"
CapCreate{Int
cap :: EventInfo -> Int
cap :: Int
cap} ->
Builder
"created cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
CapDelete{Int
cap :: Int
cap :: EventInfo -> Int
cap} ->
Builder
"deleted cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
CapDisable{Int
cap :: Int
cap :: EventInfo -> Int
cap} ->
Builder
"disabled cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
CapEnable{Int
cap :: Int
cap :: EventInfo -> Int
cap} ->
Builder
"enabled cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
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: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
markername
CapsetCreate BlockSize
cs CapsetType
ct ->
Builder
"created capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" of type " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString (CapsetType -> FilePath
forall a. Show a => a -> FilePath
show CapsetType
ct)
CapsetDelete BlockSize
cs ->
Builder
"deleted capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
CapsetAssignCap BlockSize
cs Int
cp ->
Builder
"assigned cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cp Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" to capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
CapsetRemoveCap BlockSize
cs Int
cp ->
Builder
"removed cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cp Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" from capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
OsProcessPid BlockSize
cs BlockSize
pid ->
Builder
"capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": pid " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
pid
OsProcessParentPid BlockSize
cs BlockSize
ppid ->
Builder
"capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": parent pid " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
ppid
WallClockTime BlockSize
cs Timestamp
sec BlockSize
nsec ->
Builder
"capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": wall clock time "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
sec Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"s "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
nsec Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"ns (unix epoch)"
RtsIdentifier BlockSize
cs Text
i ->
Builder
"capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": RTS version \"" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
i Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"\""
ProgramArgs BlockSize
cs [Text]
args ->
Builder
"capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": args: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString ([Text] -> FilePath
forall a. Show a => a -> FilePath
show [Text]
args)
ProgramEnv BlockSize
cs [Text]
env ->
Builder
"capset " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
cs
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": env: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString ([Text] -> FilePath
forall a. Show a => a -> FilePath
show [Text]
env)
UnknownEvent EventTypeNum
n ->
Builder
"Unknown event type " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
n
InternString FilePath
str BlockSize
sId ->
Builder
"Interned string: \"" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString FilePath
str
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"\" with id " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
sId
Version FilePath
version ->
Builder
"compiler version is " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString FilePath
version
ProgramInvocation FilePath
commandline ->
Builder
"program invocation: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString FilePath
commandline
EventInfo
EdenStartReceive ->
Builder
"starting to receive"
EventInfo
EdenEndReceive ->
Builder
"stop receiving"
CreateProcess BlockSize
process ->
Builder
"creating process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
process
KillProcess BlockSize
process ->
Builder
"killing process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
process
AssignThreadToProcess BlockSize
thread BlockSize
process ->
Builder
"assigning thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" to process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
process
CreateMachine EventTypeNum
machine Timestamp
realtime ->
Builder
"creating machine " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
machine
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" at " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
realtime
KillMachine EventTypeNum
machine ->
Builder
"killing machine " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
machine
SendMessage MessageTag
mesTag BlockSize
senderProcess BlockSize
senderThread
EventTypeNum
receiverMachine BlockSize
receiverProcess BlockSize
receiverInport ->
Builder
"sending message with tag " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString (MessageTag -> FilePath
forall a. Show a => a -> FilePath
show MessageTag
mesTag)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" from process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
senderProcess
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
senderThread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" to machine " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
receiverMachine
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
receiverProcess
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" on inport " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
receiverInport
ReceiveMessage MessageTag
mesTag BlockSize
receiverProcess BlockSize
receiverInport
EventTypeNum
senderMachine BlockSize
senderProcess BlockSize
senderThread BlockSize
messageSize ->
Builder
"receiving message with tag " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString (MessageTag -> FilePath
forall a. Show a => a -> FilePath
show MessageTag
mesTag)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" at process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
receiverProcess
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", inport " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
receiverInport
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" from machine " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
senderMachine
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
senderProcess
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
senderThread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" with size " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
messageSize
SendReceiveLocalMessage MessageTag
mesTag BlockSize
senderProcess BlockSize
senderThread
BlockSize
receiverProcess BlockSize
receiverInport ->
Builder
"sending/receiving message with tag " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FilePath -> Builder
TB.fromString (MessageTag -> FilePath
forall a. Show a => a -> FilePath
show MessageTag
mesTag)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" from process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
senderProcess
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
senderThread
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" to process " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
receiverProcess
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" on inport " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
receiverInport
MerStartParConjunction Timestamp
dyn_id BlockSize
static_id ->
Builder
"Start a parallel conjunction 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", static_id: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
static_id
MerEndParConjunction Timestamp
dyn_id ->
Builder
"End par conjunction: 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
MerEndParConjunct Timestamp
dyn_id ->
Builder
"End par conjunct: 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
MerCreateSpark Timestamp
dyn_id BlockSize
spark_id ->
Builder
"Create spark for conjunction: 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
dyn_id
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" spark: 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal BlockSize
spark_id
MerFutureCreate Timestamp
future_id BlockSize
name_id ->
Builder
"Create future 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" named " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
name_id
MerFutureWaitNosuspend Timestamp
future_id ->
Builder
"Wait didn't suspend for future: 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
MerFutureWaitSuspended Timestamp
future_id ->
Builder
"Wait suspended on future: 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.hexadecimal Timestamp
future_id
MerFutureSignal Timestamp
future_id ->
Builder
"Signaled future 0x" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
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 BlockSize
thread_id ->
Builder
"Releasing thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
thread_id Builder -> Builder -> Builder
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{BlockSize
perfNum :: EventInfo -> BlockSize
perfNum :: BlockSize
perfNum, Text
name :: EventInfo -> Text
name :: Text
name} ->
Builder
"perf event " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
perfNum
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" named \"" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
name Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"\""
PerfCounter{BlockSize
perfNum :: BlockSize
perfNum :: EventInfo -> BlockSize
perfNum, KernelThreadId
tid :: EventInfo -> KernelThreadId
tid :: KernelThreadId
tid, Timestamp
period :: EventInfo -> Timestamp
period :: Timestamp
period} ->
Builder
"perf event counter " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
perfNum
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" incremented by " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal (Timestamp
period Timestamp -> Timestamp -> Timestamp
forall a. Num a => a -> a -> a
+ Timestamp
1)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" in OS thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal (KernelThreadId -> Timestamp
kernelThreadId KernelThreadId
tid)
PerfTracepoint{BlockSize
perfNum :: BlockSize
perfNum :: EventInfo -> BlockSize
perfNum, KernelThreadId
tid :: KernelThreadId
tid :: EventInfo -> KernelThreadId
tid} ->
Builder
"perf event tracepoint " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
perfNum
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" reached in OS thread " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
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 " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Word8 -> Builder
forall a. Integral a => a -> Builder
TB.decimal Word8
heapProfId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" at sampling period " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSamplingPeriod
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" broken down by " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> HeapProfBreakdown -> Builder
forall s. IsString s => HeapProfBreakdown -> s
showHeapProfBreakdown HeapProfBreakdown
heapProfBreakdown
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> (Builder -> Builder) -> Maybe Builder -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (Builder
" filtered by " Builder -> Builder -> Builder
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 {BlockSize
Text
HeapProfFlags
heapProfFlags :: EventInfo -> HeapProfFlags
heapProfSrcLoc :: EventInfo -> Text
heapProfModule :: EventInfo -> Text
heapProfLabel :: EventInfo -> Text
heapProfCostCentreId :: EventInfo -> BlockSize
heapProfFlags :: HeapProfFlags
heapProfSrcLoc :: Text
heapProfModule :: Text
heapProfLabel :: Text
heapProfCostCentreId :: BlockSize
..} ->
Builder
"cost centre " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
heapProfCostCentreId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfLabel
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" in " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfModule
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" at " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfSrcLoc
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> if HeapProfFlags -> Bool
isCaf HeapProfFlags
heapProfFlags then Builder
" CAF" else Builder
""
HeapProfSampleBegin {Timestamp
heapProfSampleEra :: EventInfo -> Timestamp
heapProfSampleEra :: Timestamp
..} ->
Builder
"start heap prof sample " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleEra
HeapProfSampleEnd {Timestamp
heapProfSampleEra :: Timestamp
heapProfSampleEra :: EventInfo -> Timestamp
..} ->
Builder
"end prof sample " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
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 " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleEra
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" at time " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfSampleTime
HeapProfSampleCostCentre {Word8
Timestamp
Vector BlockSize
heapProfStack :: EventInfo -> Vector BlockSize
heapProfStackDepth :: EventInfo -> Word8
heapProfResidency :: EventInfo -> Timestamp
heapProfStack :: Vector BlockSize
heapProfStackDepth :: Word8
heapProfResidency :: Timestamp
heapProfId :: Word8
heapProfId :: EventInfo -> Word8
..} ->
Builder
"heap prof sample " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Word8 -> Builder
forall a. Integral a => a -> Builder
TB.decimal Word8
heapProfId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", residency " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfResidency
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", cost centre stack " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Vector BlockSize -> Builder
buildCostCentreStack Vector BlockSize
heapProfStack
HeapProfSampleString {Word8
Timestamp
Text
heapProfLabel :: Text
heapProfResidency :: Timestamp
heapProfId :: Word8
heapProfResidency :: EventInfo -> Timestamp
heapProfLabel :: EventInfo -> Text
heapProfId :: EventInfo -> Word8
..} ->
Builder
"heap prof sample " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Word8 -> Builder
forall a. Integral a => a -> Builder
TB.decimal Word8
heapProfId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", residency " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
heapProfResidency
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", label " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
heapProfLabel
ProfSampleCostCentre {Word8
BlockSize
Timestamp
Vector BlockSize
profCcsStack :: EventInfo -> Vector BlockSize
profStackDepth :: EventInfo -> Word8
profTicks :: EventInfo -> Timestamp
profCapset :: EventInfo -> BlockSize
profCcsStack :: Vector BlockSize
profStackDepth :: Word8
profTicks :: Timestamp
profCapset :: BlockSize
..} ->
Builder
"cap no " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
profCapset
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", prof sample " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
profTicks
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", cost centre stack " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Vector BlockSize -> Builder
buildCostCentreStack Vector BlockSize
profCcsStack
ProfBegin {Timestamp
profTickInterval :: EventInfo -> Timestamp
profTickInterval :: Timestamp
..} ->
Builder
"start time profiling, tick interval " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
profTickInterval Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" (ns)"
UserBinaryMessage {ByteString
payload :: EventInfo -> ByteString
payload :: ByteString
..} ->
Builder
"binary message " Builder -> Builder -> Builder
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 {BlockSize
concMarkedObjectCount :: EventInfo -> BlockSize
concMarkedObjectCount :: BlockSize
..} ->
Builder
"concurrent mark ended: "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"marked " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
concMarkedObjectCount Builder -> Builder -> Builder
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 " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
cap
NonmovingHeapCensus {Word8
BlockSize
nonmovingCensusLiveBlocks :: EventInfo -> BlockSize
nonmovingCensusFilledSegs :: EventInfo -> BlockSize
nonmovingCensusActiveSegs :: EventInfo -> BlockSize
nonmovingCensusBlkSize :: EventInfo -> Word8
nonmovingCensusLiveBlocks :: BlockSize
nonmovingCensusFilledSegs :: BlockSize
nonmovingCensusActiveSegs :: BlockSize
nonmovingCensusBlkSize :: Word8
..} ->
Builder
"nonmoving heap census " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal (Int
2Int -> Word8 -> Int
forall a b. (Num a, Integral b) => a -> b -> a
^Word8
nonmovingCensusBlkSize :: Int)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
nonmovingCensusActiveSegs Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" active segments"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
nonmovingCensusFilledSegs Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" filled segments"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> BlockSize -> Builder
forall a. Integral a => a -> Builder
TB.decimal BlockSize
nonmovingCensusLiveBlocks Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" live blocks"
TickyCounterDef {EventTypeNum
Timestamp
Text
tickyCtrDefName :: EventInfo -> Text
tickyCtrDefKinds :: EventInfo -> Text
tickyCtrDefArity :: EventInfo -> EventTypeNum
tickyCtrDefId :: EventInfo -> Timestamp
tickyCtrDefName :: Text
tickyCtrDefKinds :: Text
tickyCtrDefArity :: EventTypeNum
tickyCtrDefId :: Timestamp
..} ->
Builder
"ticky counter definition " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrDefId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"arity: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
tickyCtrDefArity
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"def kinds: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
tickyCtrDefKinds
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"name: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
tickyCtrDefName
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 " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleId
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"entry count: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleEntryCount
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleAllocs Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" allocs"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
tickyCtrSampleAllocd Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" allocd"
replaceUnprintableWith
:: Char
-> B.ByteString
-> T.Text
replaceUnprintableWith :: Char -> ByteString -> Text
replaceUnprintableWith Char
replacement = ByteString -> Text
TE.decodeUtf8 (ByteString -> Text)
-> (ByteString -> ByteString) -> ByteString -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Char) -> ByteString -> ByteString
B8.map Char -> Char
replace
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 = (Text -> Maybe Builder -> Maybe Builder)
-> Maybe Builder -> [Text] -> Maybe Builder
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Text -> Maybe Builder -> Maybe Builder
g Maybe Builder
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 = Builder -> Maybe Builder
forall a. a -> Maybe a
Just (Text -> Builder
TB.fromText Text
f Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", ") Maybe Builder -> Maybe Builder -> Maybe Builder
forall a. Semigroup a => a -> a -> a
<> Maybe Builder
b
buildCostCentreStack :: VU.Vector Word32 -> TB.Builder
buildCostCentreStack :: Vector BlockSize -> Builder
buildCostCentreStack = (Builder -> Int -> BlockSize -> Builder)
-> Builder -> Vector BlockSize -> Builder
forall b a. Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a
VU.ifoldl' Builder -> Int -> BlockSize -> Builder
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 a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
0 = a -> Builder
forall a. Integral a => a -> Builder
TB.decimal a
cc
| Bool
otherwise = Builder
b Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
", " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> a -> Builder
forall a. Integral a => a -> Builder
TB.decimal a
cc
showThreadStopStatus :: ThreadStopStatus -> String
showThreadStopStatus :: ThreadStopStatus -> FilePath
showThreadStopStatus ThreadStopStatus
HeapOverflow = FilePath
"heap overflow"
showThreadStopStatus ThreadStopStatus
StackOverflow = FilePath
"stack overflow"
showThreadStopStatus ThreadStopStatus
ThreadYielding = FilePath
"thread yielding"
showThreadStopStatus ThreadStopStatus
ThreadBlocked = FilePath
"thread blocked"
showThreadStopStatus ThreadStopStatus
ThreadFinished = FilePath
"thread finished"
showThreadStopStatus ThreadStopStatus
ForeignCall = FilePath
"making a foreign call"
showThreadStopStatus ThreadStopStatus
BlockedOnMVar = FilePath
"blocked on an MVar"
showThreadStopStatus ThreadStopStatus
BlockedOnMVarRead = FilePath
"blocked reading an MVar"
showThreadStopStatus ThreadStopStatus
BlockedOnBlackHole = FilePath
"blocked on a black hole"
showThreadStopStatus ThreadStopStatus
BlockedOnRead = FilePath
"blocked on I/O read"
showThreadStopStatus ThreadStopStatus
BlockedOnWrite = FilePath
"blocked on I/O write"
showThreadStopStatus ThreadStopStatus
BlockedOnDelay = FilePath
"blocked on threadDelay"
showThreadStopStatus ThreadStopStatus
BlockedOnSTM = FilePath
"blocked in STM retry"
showThreadStopStatus ThreadStopStatus
BlockedOnDoProc = FilePath
"blocked on asyncDoProc"
showThreadStopStatus ThreadStopStatus
BlockedOnCCall = FilePath
"blocked in a foreign call"
showThreadStopStatus ThreadStopStatus
BlockedOnCCall_NoUnblockExc = FilePath
"blocked in a foreign call"
showThreadStopStatus ThreadStopStatus
BlockedOnMsgThrowTo = FilePath
"blocked in throwTo"
showThreadStopStatus ThreadStopStatus
ThreadMigrating = FilePath
"thread migrating"
showThreadStopStatus ThreadStopStatus
BlockedOnMsgGlobalise = FilePath
"waiting for data to be globalised"
showThreadStopStatus (BlockedOnBlackHoleOwnedBy BlockSize
target) =
FilePath
"blocked on black hole owned by thread " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ BlockSize -> FilePath
forall a. Show a => a -> FilePath
show BlockSize
target
showThreadStopStatus ThreadStopStatus
NoStatus = FilePath
"No stop thread status"
showHeapProfBreakdown :: IsString s => HeapProfBreakdown -> s
showHeapProfBreakdown :: 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"
ppEventLog :: EventLog -> String
ppEventLog :: EventLog -> FilePath
ppEventLog = Text -> FilePath
TL.unpack (Text -> FilePath) -> (EventLog -> Text) -> EventLog -> FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText (Builder -> Text) -> (EventLog -> Builder) -> EventLog -> Text
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"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> (EventType -> Builder) -> [EventType] -> Builder
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (\EventType
evType -> EventType -> Builder
buildEventType EventType
evType Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"\n") [EventType]
ets
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"\n"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
"Events:\n"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> (Event -> Builder) -> [Event] -> Builder
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 Builder -> Builder -> Builder
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 -> FilePath
ppEventType = Text -> FilePath
TL.unpack (Text -> FilePath) -> (EventType -> Text) -> EventType -> FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText (Builder -> Text) -> (EventType -> Builder) -> EventType -> Text
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) =
EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
num Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.fromText Text
dsc Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
" (size "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
-> (EventTypeNum -> Builder) -> Maybe EventTypeNum -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"variable" EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal Maybe EventTypeNum
msz Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
")"
ppEvent :: IntMap EventType -> Event -> String
ppEvent :: IntMap EventType -> Event -> FilePath
ppEvent IntMap EventType
imap = Text -> FilePath
TL.unpack (Text -> FilePath) -> (Event -> Text) -> Event -> FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> Text
TB.toLazyText (Builder -> Text) -> (Event -> Builder) -> Event -> Text
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
..} =
Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
evTime
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> (Int -> Builder) -> Maybe Int -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (\Int
c -> Builder
"cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
c Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": ") Maybe Int
evCap
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> case EventInfo
evSpec of
UnknownEvent{ ref :: EventInfo -> EventTypeNum
ref=EventTypeNum
ref } ->
Builder -> (EventType -> Builder) -> Maybe EventType -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (Text -> Builder
TB.fromText (Text -> Builder) -> (EventType -> Text) -> EventType -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventType -> Text
desc) (Maybe EventType -> Builder) -> Maybe EventType -> Builder
forall a b. (a -> b) -> a -> b
$ Int -> IntMap EventType -> Maybe EventType
forall a. Int -> IntMap a -> Maybe a
IM.lookup (EventTypeNum -> Int
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
..} =
Timestamp -> Builder
forall a. Integral a => a -> Builder
TB.decimal Timestamp
evTime
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": "
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> (Int -> Builder) -> Maybe Int -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" (\Int
c -> Builder
"cap " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Int -> Builder
forall a. Integral a => a -> Builder
TB.decimal Int
c Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
": ") Maybe Int
evCap
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> case EventInfo
evSpec of
UnknownEvent{ ref :: EventInfo -> EventTypeNum
ref=EventTypeNum
ref } ->
Builder
"Unknown Event (ref: " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> EventTypeNum -> Builder
forall a. Integral a => a -> Builder
TB.decimal EventTypeNum
ref Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder
")"
EventInfo
_ -> EventInfo -> Builder
buildEventInfo EventInfo
evSpec