hp2any-graph-0.5.2: Real-time heap graphing utility and profile stream server with a reusable graphing module.




This module provides some half-ready solutions to visualise heap profiles both during and after execution with the help of OpenGL. All the rendering functions will fill the viewport if the model view matrix is the identity (they also change the matrix), assuming the projection matrix is the following:

 matrixMode $= Projection
 translate $ Vector3 (-1) (-1) 0
 scale 2 2 1

In other words, these functions fill the unit square at the origin.



colours :: [Color3 GLubyte]Source

A list of highly different colours, where the differences diminish as we advance in the list. The first element is black, and there is no white.

backgroundColour :: Color3 GLubyteSource

The colour of the background (white). It is not a member of colours.

otherColour :: Color3 GLubyteSource

The colour used for unimportant cost centres (black). It is the first element of colours.

Processing raw samples (full profiles)

data SamplePair Source

Two heap profile samples which contain the exact same cost centres in the exact same order.




prepareSamples :: ProfileQuery p => p -> [SamplePair]Source

Create a list of sample pairs where each cost centre is paired up with the consecutive one, so it is easier to render them. Cost centres with small costs (below costLimit) are lumped together under identifier 0, reserved for "Other".

renderSamples :: GraphMode -> [SamplePair] -> Time -> IO ()Source

Render a given list of prepared samples in the given mode. The third argument is the maximum time of the graph, which affects horizontal scaling.

addSample :: [SamplePair] -> (Time, ProfileSample) -> [SamplePair]Source

Integrating a new sample into the list of merged sample pairs we have so far. The input list should start with the latest sample, and the new sample pair will be the head of the result.

Processing optimised renders (profile streams)

data GraphData Source

An optimised graph rendering designed to be easily updated when a new sample arrives.

graphNames :: GraphData -> IntMap StringSource

The names of cost centres in a graph rendering.

emptyGraph :: GraphDataSource

An empty rendering.

growGraph :: GraphData -> SinkInput -> IO GraphDataSource

Integrate a new sample in an extensible graph.

renderGraph :: GraphMode -> GraphData -> IO ()Source

Render a stream in the given graph mode.

data GraphMode Source

The possible ways of displaying heap profiles.



Cost centres are stacked on top of each other without overlapping.


Each cost centre yields a separate line graph on the same scale.


nextGraphMode :: GraphMode -> GraphModeSource

A cyclic successor function for graph modes.