vacuum-2.1.0.0: Graph representation of the GHC heap

Portabilitynon-portable (GHC only)
Stabilityexperimental
Maintainermad.one@gmail.com
Safe HaskellNone

GHC.Vacuum

Description

vacuum is a library that allows you to look at the graph representation of an arbitrary value or expression.

Evaluation in Haskell proceeds by graph reduction, where values on the GHC heap are represented in a graph structure, and where nodes in the graph represent things like constructors or regular values. With this library, you can extract the graph representation of said heap values, and display them in meaningful ways to observe properties like sharing, or a birds eye view of how much memory you're using.

By itself, this module and package is not very useful to the end user - it is meant to be consumed by those who would want to visualise the abstract graph output in some meaningful way, using graphviz or ubigraph, for example.

If you are an end user who wants to visualize their data structures and nothing more, please look at the vacuum-graphviz package, which exports convenient APIs for rendering the output graphs into pretty PNG/SVG files.

Synopsis

Documentation

data HNode Source

Constructors

HNode 

Fields

nodePtrs :: [HNodeId]
 
nodeLits :: [Word]
 
nodeInfo :: InfoTab
 

vacuum :: a -> IntMap HNodeSource

Vacuums the entire reachable heap subgraph rooted at the a.

vacuumTo :: Int -> a -> IntMap HNodeSource

Stop after a given depth.

vacuumLazy :: a -> IntMap HNodeSource

Doesn't force anything.

vacuumStream :: a -> [(HNodeId, HNode)]Source

Returns nodes as it encounters them.

data ShowHNode Source

Constructors

ShowHNode 

Fields

showHNode :: Int -> HNode -> String
 
externHNode :: Int -> String
 

data Draw e v m a Source

To assist in "rendering" the graph to some source.

Constructors

Draw 

Fields

mkV :: Int -> a -> m v
 
mkE :: v -> v -> m e
 
succs :: a -> [Int]
 

newtype G e v Source

Constructors

G 

Fields

unG :: IntMap (v, IntMap e)
 

Instances

(Eq e, Eq v) => Eq (G e v) 
(Eq (G e v), Ord e, Ord v) => Ord (G e v) 
(Read e, Read v) => Read (G e v) 
(Show e, Show v) => Show (G e v) 

draw :: Monad m => Draw e v m a -> IntMap a -> m (G e v)Source

printDraw :: Draw (Int, Int) Int IO HNodeSource

An example Draw

split :: (a -> [Int]) -> IntMap a -> IntMap ([Int], [Int])Source

Build a map to (preds,succs)

data Closure Source

Constructors

Closure 

Fields

closPtrs :: [HValue]
 
closLits :: [Word]
 
closITab :: InfoTab
 

Instances

getClosure :: a -> IO ClosureSource

This is in part borrowed from RtClosureInspect.getClosureData.