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

Safe HaskellSafe-Inferred




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.




initial :: s

Initial state

final :: s -> Bool

Valid final states

alpha :: i -> Bool

Valid input alphabet

delta :: s -> i -> Maybe s

State transition function

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

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.




profileState :: s

The current state

profileTime :: Timestamp

The entry time of the state


Show s => Show (Profile s) 



:: (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 iSource

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) iSource

This function takes a machine and profiles its state.



:: 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


Fail e 
Prod a (Process e a) 


(Show e, Show a) => Show (Process e a) 

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

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.