ghc-events-0.9.0: Library and tool for parsing .eventlog files from GHC

Safe HaskellNone
LanguageHaskell98

GHC.RTS.Events.Analysis

Synopsis

Documentation

data Machine s i Source #

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

Constructors

Machine 

Fields

validate :: Machine s i -> [i] -> Either (s, i) s Source #

The validate 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.

validates :: Machine s i -> [i] -> [Either (s, i) s] Source #

This function is similar to validate, but outputs each intermediary state as well. For an incremental version, use simulate.

simulate :: Machine s i -> [i] -> Process (s, i) (s, i) Source #

This function produces a process that outputs all the states that a machine goes through.

data Profile s Source #

A state augmented by Timestamp information is held in profileState. When the state changes, profileMap stores a map between each state and its cumulative time.

Constructors

Profile 

Fields

Instances
Show s => Show (Profile s) Source # 
Instance details

Defined in GHC.RTS.Events.Analysis

Methods

showsPrec :: Int -> Profile s -> ShowS #

show :: Profile s -> String #

showList :: [Profile s] -> ShowS #

profile Source #

Arguments

:: (Ord s, Eq s) 
=> Machine s i

A machine to profile

-> (i -> Timestamp)

Converts input to timestamps

-> [i]

The list of input

-> 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)) Source #

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)) Source #

extractIndexed :: Ord k => (s -> i -> Maybe o) -> (i -> Maybe k) -> Map k s -> i -> Maybe (k, o) Source #

refineM :: (i -> j) -> Machine s j -> Machine s i Source #

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.

profileM :: Ord s => (i -> Timestamp) -> Machine s i -> Machine (Profile s) i Source #

This function takes a machine and profiles its state.

indexM Source #

Arguments

:: Ord k 
=> (i -> Maybe k)

An indexing function

-> Machine s i

A machine to index with

-> Machine (Map k s) i

The indexed machine

An indexed machine takes a function that multiplexes the input to a key and then takes a machine description to an indexed machine.

toList :: Process e a -> [a] Source #

data Process e a Source #

Constructors

Done 
Fail e 
Prod a (Process e a) 
Instances
(Show e, Show a) => Show (Process e a) Source # 
Instance details

Defined in GHC.RTS.Events.Analysis

Methods

showsPrec :: Int -> Process e a -> ShowS #

show :: Process e a -> String #

showList :: [Process e a] -> ShowS #

routeM :: Ord k => Machine r i -> (r -> i -> Maybe k) -> Machine s i -> Machine (Map k s, r) i Source #

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.