-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Library and tool for parsing .eventlog files from GHC
--   
--   Parses .eventlog files emitted by GHC 6.12.1 and later. Includes the
--   ghc-events tool permitting, in particular, to dump an event log file
--   as text.
@package ghc-events
@version 0.4.2.0

module GHC.RTS.Events
data EventLog
EventLog :: Header -> Data -> EventLog
header :: EventLog -> Header
dat :: EventLog -> Data
data EventType
EventType :: EventTypeNum -> EventTypeDesc -> Maybe EventTypeSize -> EventType
num :: EventType -> EventTypeNum
desc :: EventType -> EventTypeDesc

-- | <a>Nothing</a> indicates variable size
size :: EventType -> Maybe EventTypeSize
data Event
Event :: {-# UNPACK #-} !Timestamp -> EventInfo -> Event
time :: Event -> {-# UNPACK #-} !Timestamp
spec :: Event -> EventInfo
data EventInfo
EventBlock :: Timestamp -> Int -> [Event] -> EventInfo
end_time :: EventInfo -> Timestamp
cap :: EventInfo -> Int
block_events :: EventInfo -> [Event]
UnknownEvent :: {-# UNPACK #-} !EventTypeNum -> EventInfo
ref :: EventInfo -> {-# UNPACK #-} !EventTypeNum
Startup :: Int -> EventInfo
n_caps :: EventInfo -> Int
Shutdown :: EventInfo
CreateThread :: {-# UNPACK #-} !ThreadId -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
RunThread :: {-# UNPACK #-} !ThreadId -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
StopThread :: {-# UNPACK #-} !ThreadId -> ThreadStopStatus -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
status :: EventInfo -> ThreadStopStatus
ThreadRunnable :: {-# UNPACK #-} !ThreadId -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
MigrateThread :: {-# UNPACK #-} !ThreadId -> {-# UNPACK #-} !Int -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
newCap :: EventInfo -> {-# UNPACK #-} !Int
WakeupThread :: {-# UNPACK #-} !ThreadId -> {-# UNPACK #-} !Int -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
otherCap :: EventInfo -> {-# UNPACK #-} !Int
ThreadLabel :: {-# UNPACK #-} !ThreadId -> String -> EventInfo
thread :: EventInfo -> {-# UNPACK #-} !ThreadId
threadlabel :: EventInfo -> String
CreateSparkThread :: {-# UNPACK #-} !ThreadId -> EventInfo
sparkThread :: EventInfo -> {-# UNPACK #-} !ThreadId
SparkCounters :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> EventInfo
sparksCreated :: EventInfo -> {-# UNPACK #-} !Word64
sparksDud :: EventInfo -> {-# UNPACK #-} !Word64
sparksOverflowed :: EventInfo -> {-# UNPACK #-} !Word64
sparksConverted :: EventInfo -> {-# UNPACK #-} !Word64
sparksFizzled :: EventInfo -> {-# UNPACK #-} !Word64
sparksGCd :: EventInfo -> {-# UNPACK #-} !Word64
sparksRemaining :: EventInfo -> {-# UNPACK #-} !Word64
SparkCreate :: EventInfo
SparkDud :: EventInfo
SparkOverflow :: EventInfo
SparkRun :: EventInfo
SparkSteal :: {-# UNPACK #-} !Int -> EventInfo
victimCap :: EventInfo -> {-# UNPACK #-} !Int
SparkFizzle :: EventInfo
SparkGC :: EventInfo
TaskCreate :: TaskId -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !KernelThreadId -> EventInfo
taskId :: EventInfo -> TaskId
cap :: EventInfo -> {-# UNPACK #-} !Int
tid :: EventInfo -> {-# UNPACK #-} !KernelThreadId
TaskMigrate :: TaskId -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> EventInfo
taskId :: EventInfo -> TaskId
cap :: EventInfo -> {-# UNPACK #-} !Int
new_cap :: EventInfo -> {-# UNPACK #-} !Int
TaskDelete :: TaskId -> EventInfo
taskId :: EventInfo -> TaskId
RequestSeqGC :: EventInfo
RequestParGC :: EventInfo
StartGC :: EventInfo
GCWork :: EventInfo
GCIdle :: EventInfo
GCDone :: EventInfo
EndGC :: EventInfo
GlobalSyncGC :: EventInfo
GCStatsGHC :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> EventInfo
heapCapset :: EventInfo -> {-# UNPACK #-} !Capset
gen :: EventInfo -> {-# UNPACK #-} !Int
copied :: EventInfo -> {-# UNPACK #-} !Word64
slop :: EventInfo -> {-# UNPACK #-} !Word64
frag :: EventInfo -> {-# UNPACK #-} !Word64
parNThreads :: EventInfo -> {-# UNPACK #-} !Int
parMaxCopied :: EventInfo -> {-# UNPACK #-} !Word64
parTotCopied :: EventInfo -> {-# UNPACK #-} !Word64
HeapAllocated :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Word64 -> EventInfo
heapCapset :: EventInfo -> {-# UNPACK #-} !Capset
allocBytes :: EventInfo -> {-# UNPACK #-} !Word64
HeapSize :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Word64 -> EventInfo
heapCapset :: EventInfo -> {-# UNPACK #-} !Capset
sizeBytes :: EventInfo -> {-# UNPACK #-} !Word64
HeapLive :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Word64 -> EventInfo
heapCapset :: EventInfo -> {-# UNPACK #-} !Capset
liveBytes :: EventInfo -> {-# UNPACK #-} !Word64
HeapInfoGHC :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> EventInfo
heapCapset :: EventInfo -> {-# UNPACK #-} !Capset
gens :: EventInfo -> {-# UNPACK #-} !Int
maxHeapSize :: EventInfo -> {-# UNPACK #-} !Word64
allocAreaSize :: EventInfo -> {-# UNPACK #-} !Word64
mblockSize :: EventInfo -> {-# UNPACK #-} !Word64
blockSize :: EventInfo -> {-# UNPACK #-} !Word64
CapCreate :: {-# UNPACK #-} !Int -> EventInfo
cap :: EventInfo -> {-# UNPACK #-} !Int
CapDelete :: {-# UNPACK #-} !Int -> EventInfo
cap :: EventInfo -> {-# UNPACK #-} !Int
CapDisable :: {-# UNPACK #-} !Int -> EventInfo
cap :: EventInfo -> {-# UNPACK #-} !Int
CapEnable :: {-# UNPACK #-} !Int -> EventInfo
cap :: EventInfo -> {-# UNPACK #-} !Int
CapsetCreate :: {-# UNPACK #-} !Capset -> CapsetType -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
capsetType :: EventInfo -> CapsetType
CapsetDelete :: {-# UNPACK #-} !Capset -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
CapsetAssignCap :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Int -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
cap :: EventInfo -> {-# UNPACK #-} !Int
CapsetRemoveCap :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Int -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
cap :: EventInfo -> {-# UNPACK #-} !Int
RtsIdentifier :: {-# UNPACK #-} !Capset -> String -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
rtsident :: EventInfo -> String
ProgramArgs :: {-# UNPACK #-} !Capset -> [String] -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
args :: EventInfo -> [String]
ProgramEnv :: {-# UNPACK #-} !Capset -> [String] -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
env :: EventInfo -> [String]
OsProcessPid :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !PID -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
pid :: EventInfo -> {-# UNPACK #-} !PID
OsProcessParentPid :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !PID -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
ppid :: EventInfo -> {-# UNPACK #-} !PID
WallClockTime :: {-# UNPACK #-} !Capset -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word32 -> EventInfo
capset :: EventInfo -> {-# UNPACK #-} !Capset
sec :: EventInfo -> {-# UNPACK #-} !Word64
nsec :: EventInfo -> {-# UNPACK #-} !Word32
Message :: String -> EventInfo
msg :: EventInfo -> String
UserMessage :: String -> EventInfo
msg :: EventInfo -> String
UserMarker :: String -> EventInfo
markername :: EventInfo -> String
InternString :: String -> {-# UNPACK #-} !StringId -> EventInfo
str :: EventInfo -> String
sId :: EventInfo -> {-# UNPACK #-} !StringId
MerStartParConjunction :: {-# UNPACK #-} !ParConjDynId -> {-# UNPACK #-} !ParConjStaticId -> EventInfo
dyn_id :: EventInfo -> {-# UNPACK #-} !ParConjDynId
static_id :: EventInfo -> {-# UNPACK #-} !ParConjStaticId
MerEndParConjunction :: {-# UNPACK #-} !ParConjDynId -> EventInfo
dyn_id :: EventInfo -> {-# UNPACK #-} !ParConjDynId
MerEndParConjunct :: {-# UNPACK #-} !ParConjDynId -> EventInfo
dyn_id :: EventInfo -> {-# UNPACK #-} !ParConjDynId
MerCreateSpark :: {-# UNPACK #-} !ParConjDynId -> {-# UNPACK #-} !SparkId -> EventInfo
dyn_id :: EventInfo -> {-# UNPACK #-} !ParConjDynId
spark_id :: EventInfo -> {-# UNPACK #-} !SparkId
MerFutureCreate :: {-# UNPACK #-} !FutureId -> {-# UNPACK #-} !StringId -> EventInfo
future_id :: EventInfo -> {-# UNPACK #-} !FutureId
name_id :: EventInfo -> {-# UNPACK #-} !StringId
MerFutureWaitNosuspend :: {-# UNPACK #-} !FutureId -> EventInfo
future_id :: EventInfo -> {-# UNPACK #-} !FutureId
MerFutureWaitSuspended :: {-# UNPACK #-} !FutureId -> EventInfo
future_id :: EventInfo -> {-# UNPACK #-} !FutureId
MerFutureSignal :: {-# UNPACK #-} !FutureId -> EventInfo
future_id :: EventInfo -> {-# UNPACK #-} !FutureId
MerLookingForGlobalThread :: EventInfo
MerWorkStealing :: EventInfo
MerLookingForLocalSpark :: EventInfo
MerReleaseThread :: {-# UNPACK #-} !ThreadId -> EventInfo
thread_id :: EventInfo -> {-# UNPACK #-} !ThreadId
MerCapSleeping :: EventInfo
MerCallingMain :: EventInfo
PerfName :: {-# UNPACK #-} !PerfEventTypeNum -> String -> EventInfo
perfNum :: EventInfo -> {-# UNPACK #-} !PerfEventTypeNum
name :: EventInfo -> String
PerfCounter :: {-# UNPACK #-} !PerfEventTypeNum -> {-# UNPACK #-} !KernelThreadId -> {-# UNPACK #-} !Word64 -> EventInfo
perfNum :: EventInfo -> {-# UNPACK #-} !PerfEventTypeNum
tid :: EventInfo -> {-# UNPACK #-} !KernelThreadId
period :: EventInfo -> {-# UNPACK #-} !Word64
PerfTracepoint :: {-# UNPACK #-} !PerfEventTypeNum -> {-# UNPACK #-} !KernelThreadId -> EventInfo
perfNum :: EventInfo -> {-# UNPACK #-} !PerfEventTypeNum
tid :: EventInfo -> {-# UNPACK #-} !KernelThreadId
data ThreadStopStatus
NoStatus :: ThreadStopStatus
HeapOverflow :: ThreadStopStatus
StackOverflow :: ThreadStopStatus
ThreadYielding :: ThreadStopStatus
ThreadBlocked :: ThreadStopStatus
ThreadFinished :: ThreadStopStatus
ForeignCall :: ThreadStopStatus
BlockedOnMVar :: ThreadStopStatus
BlockedOnBlackHole :: ThreadStopStatus
BlockedOnRead :: ThreadStopStatus
BlockedOnWrite :: ThreadStopStatus
BlockedOnDelay :: ThreadStopStatus
BlockedOnSTM :: ThreadStopStatus
BlockedOnDoProc :: ThreadStopStatus
BlockedOnCCall :: ThreadStopStatus
BlockedOnCCall_NoUnblockExc :: ThreadStopStatus
BlockedOnMsgThrowTo :: ThreadStopStatus
ThreadMigrating :: ThreadStopStatus
BlockedOnMsgGlobalise :: ThreadStopStatus
BlockedOnBlackHoleOwnedBy :: {-# UNPACK #-} !ThreadId -> ThreadStopStatus
newtype Header
Header :: [EventType] -> Header
eventTypes :: Header -> [EventType]
data Data
Data :: [Event] -> Data
events :: Data -> [Event]
data CapsetType
CapsetCustom :: CapsetType
CapsetOsProcess :: CapsetType
CapsetClockDomain :: CapsetType
CapsetUnknown :: CapsetType
type Timestamp = Word64
type ThreadId = Word32
type TaskId = Word64
newtype KernelThreadId
KernelThreadId :: Word64 -> KernelThreadId
kernelThreadId :: KernelThreadId -> Word64
readEventLogFromFile :: FilePath -> IO (Either String EventLog)
writeEventLogToFile :: FilePath -> EventLog -> IO ()

-- | An event annotated with the Capability that generated it, if any
data CapEvent
CapEvent :: Maybe Int -> Event -> CapEvent
ce_cap :: CapEvent -> Maybe Int
ce_event :: CapEvent -> Event
sortEvents :: [Event] -> [CapEvent]
groupEvents :: [Event] -> [(Maybe Int, [Event])]

-- | Sort the raw event stream by time, annotating each event with the
--   capability that generated it.
sortGroups :: [(Maybe Int, [Event])] -> [CapEvent]
buildEventTypeMap :: [EventType] -> IntMap EventType
showEventInfo :: EventInfo -> String
showThreadStopStatus :: ThreadStopStatus -> String
ppEventLog :: EventLog -> String
ppEventType :: EventType -> String
ppEvent :: IntMap EventType -> CapEvent -> String
nEVENT_PERF_NAME :: EventTypeNum
nEVENT_PERF_COUNTER :: EventTypeNum
nEVENT_PERF_TRACEPOINT :: EventTypeNum
sz_perf_num :: EventTypeSize
sz_kernel_tid :: EventTypeSize

module GHC.RTS.Events.Merge
mergeEventLogs :: EventLog -> EventLog -> EventLog
instance Monoid MaxVars

module GHC.RTS.Events.Analysis

-- | This is based on a simple finite state machine hence the names
--   <a>delta</a> for the state transition function. Since states might be
--   more than simple pattern matched constructors, we use `finals :: state
--   -&gt; Bool`, rather than `Set state`, to indicate that the machine is
--   in some final state. Similarly for <a>alpha</a>, which indicates the
--   alphabet of inputs to a machine. The function <a>delta</a> returns
--   <a>Maybe</a> values, where <a>Nothing</a> indicates that no valid
--   transition is possible: ie, there has been an error.
data Machine s i
Machine :: s -> (s -> Bool) -> (i -> Bool) -> (s -> i -> Maybe s) -> Machine s i

-- | Initial state
initial :: Machine s i -> s

-- | Valid final states
final :: Machine s i -> s -> Bool

-- | Valid input alphabet
alpha :: Machine s i -> i -> Bool

-- | State transition function
delta :: Machine s i -> s -> i -> Maybe s

-- | The <a>validate</a> function takes a machine and a list of inputs. The
--   machine is started from its initial state and run against the inputs
--   in turn. It returns the state and input on failure, and just the state
--   on success.
validate :: Machine s i -> [i] -> Either (s, i) s

-- | This function is similar to <a>validate</a>, but outputs each
--   intermediary state as well. For an incremental version, use
--   <a>simulate</a>.
validates :: Machine s i -> [i] -> [Either (s, i) s]

-- | This function produces a process that outputs all the states that a
--   machine goes through.
simulate :: Machine s i -> [i] -> Process (s, i) (s, i)

-- | A state augmented by Timestamp information is held in
--   <a>profileState</a>. When the state changes, <tt>profileMap</tt>
--   stores a map between each state and its cumulative time.
data Profile s
Profile :: s -> Timestamp -> Profile s

-- | The current state
profileState :: Profile s -> s

-- | The entry time of the state
profileTime :: Profile s -> Timestamp
profile :: (Ord s, Eq s) => Machine s i -> (i -> Timestamp) -> [i] -> Process (Profile s, i) (s, Timestamp, Timestamp)
profileIndexed :: (Ord k, Ord s, Eq s) => Machine s i -> (i -> Maybe k) -> (i -> Timestamp) -> [i] -> Process (Map k (Profile s), i) (k, (s, Timestamp, Timestamp))
profileRouted :: (Ord k, Ord s, Eq s, Eq r) => Machine s i -> Machine r i -> (r -> i -> Maybe k) -> (i -> Timestamp) -> [i] -> Process ((Map k (Profile s), r), i) (k, (s, Timestamp, Timestamp))
extractIndexed :: Ord k => (s -> i -> Maybe o) -> (i -> Maybe k) -> (Map k s -> i -> Maybe (k, o))

-- | Machines sometimes need to operate on coarser input than they are
--   defined for. This function takes a function that refines input and a
--   machine that works on refined input, and produces a machine that can
--   work on coarse input.
refineM :: (i -> j) -> Machine s j -> Machine s i

-- | This function takes a machine and profiles its state.
profileM :: Ord s => (i -> Timestamp) -> Machine s i -> Machine (Profile s) i

-- | An indexed machine takes a function that multiplexes the input to a
--   key and then takes a machine description to an indexed machine.
indexM :: Ord k => (i -> Maybe k) -> Machine s i -> Machine (Map k s) i
toList :: Process e a -> [a]
toMaybe :: Process e a -> Maybe e
data Process e a
Done :: Process e a
Fail :: e -> Process e a
Prod :: a -> (Process e a) -> Process e a

-- | A machine can be indexed not only by the inputs, but also by the state
--   of an intermediary routing machine. This is a generalisation of
--   indexM.
routeM :: Ord k => Machine r i -> (r -> i -> Maybe k) -> Machine s i -> Machine (Map k s, r) i
instance (Show e, Show a) => Show (Process e a)
instance Show s => Show (Profile s)

module GHC.RTS.Events.Analysis.Capability

-- | This state machine tracks threads residing on capabilities. Each
--   thread can only reside on one capability, but can be migrated between
--   them.
capabilityThreadPoolMachine :: Machine (Map ThreadId Int) CapEvent

-- | This state machine tracks threads running on capabilities, only one
--   thread may run on a capability at a time.
capabilityThreadRunMachine :: Machine (Map Int ThreadId) CapEvent
capabilityThreadIndexer :: Map Int ThreadId -> CapEvent -> Maybe ThreadId

-- | This state machine tracks Haskell tasks, represented by TaskId,
--   residing on capabilities. Each Haskell task can only reside on one
--   capability, but can be migrated between them.
capabilityTaskPoolMachine :: Machine (Map TaskId Int) CapEvent

-- | This state machine tracks Haskell tasks (represented by the
--   KernelThreadId of their OS thread) residing on capabilities and
--   additionally tracks the (immutable) assignment of OS thread ids
--   (KernelThreadId) to tasks ids (TaskId). Each Haskell task can only
--   reside on one capability, but can be migrated between them.
--   
--   Invariant for the <tt>(Map KernelThreadId Int, Map TaskId
--   KernelThreadId)</tt> type: the second map is an injection (verified by
--   the machine in <tt>insertTaskOS</tt>) and the following sets are
--   equal: keys of the fist map and values of the second (follows from the
--   construction of the maps by the machine).
--   
--   The machine verifies as much as <a>capabilityTaskPoolMachine</a> and
--   additionally the data invariant, and offers a richer verification
--   profile.
capabilityTaskOSMachine :: Machine (Map KernelThreadId Int, Map TaskId KernelThreadId) CapEvent

module GHC.RTS.Events.Analysis.SparkThread
data SparkThreadState
SparkThreadInitial :: SparkThreadState
SparkThreadCreated :: SparkThreadState
SparkThreadRunning :: Int -> SparkThreadState
SparkThreadPaused :: Int -> SparkThreadState
SparkThreadFinal :: SparkThreadState
sparkThreadMachine :: Machine SparkThreadState EventInfo
capabilitySparkThreadMachine :: Machine (Map Int ThreadId, Set ThreadId) CapEvent
capabilitySparkThreadIndexer :: (Map Int ThreadId, Set ThreadId) -> CapEvent -> Maybe ThreadId
instance Eq SparkThreadState
instance Ord SparkThreadState
instance Show SparkThreadState

module GHC.RTS.Events.Analysis.Thread

-- | This datatype defines the state machine for a single thread.
data ThreadState
ThreadInitial :: ThreadState
ThreadQueued :: ThreadState
ThreadRunning :: ThreadState
ThreadStopped :: ThreadState
ThreadFinal :: ThreadState

-- | This state machine tracks the events processed by a thread.
threadMachine :: Machine ThreadState EventInfo
instance Show ThreadState
instance Eq ThreadState
instance Ord ThreadState
