eventlog-live-0.3.0.0: Live processing of eventlog data.
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

GHC.Eventlog.Live.Machine.Analysis.Capability

Description

 
Synopsis

Capability Usage

Capability Usage Metrics

processCapabilityUsageMetrics :: forall (m :: Type -> Type). MonadIO m => ProcessT m (WithStartTime CapabilityUsageSpan) (Metric Timestamp) Source #

This machine processes CapabilityUsageSpan spans and produces metrics that contain the duration and category of each such span and each idle period in between.

Capability Usage Spans

data CapabilityUser Source #

The type of process using a capability, which is either a mutator thread or garbage collection.

Constructors

GC 
Mutator 

Fields

processCapabilityUsageSpans :: forall (m :: Type -> Type). MonadIO m => Verbosity -> ProcessT m (WithStartTime Event) (WithStartTime CapabilityUsageSpan) Source #

This machine runs processGCSpans and processMutatorSpans in parallel and combines their output.

This is effectively a fanout of processGCSpans and processMutatorSpans, the latter of which runs processThreadStateSpans internally. If you are running processThreadStateSpans as well, then using asMutatorSpans and constructing the fanout yourself is more efficient.

processCapabilityUsageSpans' :: forall (m :: Type -> Type) s t1 t2. MonadIO m => (s -> Maybe Timestamp) -> (s -> Event) -> (s -> GCSpan -> t1) -> (s -> MutatorSpan -> t2) -> Verbosity -> ProcessT m s (Either t1 t2) Source #

Generalised version of processCapabilityUsageSpans that can be adapted to work on arbitrary types using a getter and a pair of lenses.

GC Spans

data GCSpan Source #

A GCSpan represents a segment of time during which the specified capability ran GC.

processGCSpans :: forall (m :: Type -> Type). MonadIO m => Verbosity -> ProcessT m (WithStartTime Event) (WithStartTime GCSpan) Source #

This machine processes StartGC and EndGC events to produce GCSpan values that represent the segments of time a capability spent in GC.

This processor uses the following finite-state automaton:

      ┌─(EndGC)───┐
      │           ↓
    ┌→[   Idle    ]─┐
    │               │
(EndGC)         (StartGC)
    │               │
    └─[    GC     ]←┘
      ↑           │
      └─(StartGC)─┘

The transition from GC to Idle yields a GC span.

processGCSpans' :: forall (m :: Type -> Type) s t. MonadIO m => (s -> Maybe Timestamp) -> (s -> Event) -> (s -> GCSpan -> t) -> Verbosity -> ProcessT m s t Source #

Generalised version of processGCSpans that can be adapted to work on arbitrary types using a getter and a lens.

Mutator Spans

data MutatorSpan Source #

A MutatorSpan represents a segment of time during which the specified capability ran the specified mutator thread.

asMutatorSpans :: forall (m :: Type -> Type). MonadIO m => ProcessT m ThreadStateSpan MutatorSpan Source #

This machine converts any Running ThreadStateSpan to a MutatorSpan.

asMutatorSpans' :: forall (m :: Type -> Type) s t. MonadIO m => (s -> ThreadStateSpan) -> (s -> MutatorSpan -> t) -> ProcessT m s t Source #

Generalised version of asMutatorSpans that can be adapted to work on arbitrary types using a getter and a lens.

processMutatorSpans :: forall (m :: Type -> Type). MonadIO m => Verbosity -> ProcessT m (WithStartTime Event) (WithStartTime MutatorSpan) Source #

This machine processes RunThread and StopThread events to produce tMutatorSpan values that represent the segments of time a capability spent executating a mutator.

This processor uses the following finite-state automaton:

      ┌─(StopThread[X])─┐
      │                 ↓
    ┌→[      Idle       ]─┐
    │                     │
(StopThread[X])       (RunThread[X])
    │                     │
    └─[   Mutator[X]    ]←┘
      ↑                 │
      └─(RunThread[X])──┘

The transition from Mutator[X] to Idle yields a MutatorSpan. While in the Mutator[X] state, any RunThread[Y] or StopThread[Y] events result in an error. Furthermore, when a StopThread[X] event with the ThreadFinished status is processed, the thread X is added to a set of finished threads, and any further RunThread[X] events for that thread are ignored. This is done because the GHC RTS frequently emits a RunThread[X] event immediately after a StopThread[X] event with the ThreadFinished status.

This runs processThreadStateSpans internally. If you are also running processThreadStateSpans, then post-composing it with asMutatorSpans is more efficient.

processMutatorSpans' :: forall (m :: Type -> Type) s t. MonadIO m => (s -> Maybe Timestamp) -> (s -> Event) -> (s -> MutatorSpan -> t) -> Verbosity -> ProcessT m s t Source #

Generalised version of processMutatorSpans that can be adapted to work on arbitrary types using a getter and a lens.