ghc-debug-client-0.2.0.0: Useful functions for writing heap analysis tools which use ghc-debug.
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Debug.ParTrace

Description

Functions to support the constant space traversal of a heap. This module is like the Trace module but performs the tracing in parellel. The speed-up is quite modest but hopefully can be improved in future.

The tracing functions create a thread for each MBlock which we traverse, closures are then sent to the relevant threads to be dereferenced and thread-local storage is accumulated.

Synopsis

Documentation

traceParFromM :: Monoid s => TraceFunctionsIO a s -> [ClosurePtrWithInfo a] -> DebugM s Source #

A generic heap traversal function which will use a small amount of memory linear in the heap size. Using this function with appropiate accumulation functions you should be able to traverse quite big heaps in not a huge amount of memory.

The performance of this parralel version depends on how much contention the functions given in TraceFunctionsIO content for the handle connecting for the debuggee (which is protected by an MVar). With no contention, and precached blocks, the workload can be very evenly distributed leading to high core utilisation.

As performance depends highly on contention, snapshot mode is much more amenable to parrelisation where the time taken for requests is much lower.

tracePar :: [ClosurePtr] -> DebugM () Source #

A parellel tracing function.

data ClosurePtrWithInfo a Source #

A ClosurePtr with some additional information which needs to be communicated across to another thread.

Constructors

ClosurePtrWithInfo !a !ClosurePtr