Yhc/Heap profiling

From HaskellWiki
< Yhc
Revision as of 23:43, 15 January 2006 by NeilMitchell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Lag, drag, void, use

nhc98 had two pass compilation for this, lets try and do better :)

Assuming you have the lower level operations to detect when a node is collected, when it is used and when it is created:

node' = {node, time CreationTime, time FirstUse, time LastUse}

when a node' is created, it gets its creation time.

when a node' is used first, its FirstUse time gets set

when a note' is used ever, every single time, its gets its LastUse set.

When a node' is collected, its stats can be calculated: lag = firstuse-creation drag = now-lastuse void = if null creationtime then now-creation else 0 use = lastuse-firstuse

I guess the user will want to know which type of nodes, created by which function, are in any state at any discrete time point. This can be done with a set of accumulators, so effectively the graph is built in memory, then when a node' is collected it can be added to this list.

int graph[code][time]; where code is a list of all possible (function,type of node) pairs, and time is a list of discrete time steps.

This will require one pass running, does it miss anything? It doesn't say who holds onto the node, but it does the rest?