Make "runghc -f path-to-ghc Main.hs" work
[ghc-hetmet.git] / utils / heap-view / README
1 @HpView.lhs@ is a very primitive heap profile viewer written in
2 Haskell.  It feeds off the same files as hp2ps.  It needs a lot of
3 tidying up and would be far more useful as a continuous display.
4 (It's in this directory `cos there happens to be a heap profile here
5 and I couldn't be bothered setting up a new directory, Makefile, etc.)
6
7 @Graph.lhs@ is a continuous heap viewer that "parses" the output of
8 the +RTS -Sstderr option.  Typical usage:
9
10    slife 1 r4 +RTS -Sstderr |& graph 2
11
12 (You might also try 
13
14    cat data | graph 2
15
16  to see it in action on some sample data.
17 )
18
19 Things to watch:
20
21   1) Scaling varies from column to column - consult the source.
22
23   2) The horizontal scale is not time - it is garbage collections.
24
25   3) The graph is of the (n+1)st column of the -Sstderr output. 
26
27      The data is not always incredibly useful: For example, when using
28      the (default) Appel 2-space garbage collector, the 3rd column
29      displays the amount of "live" data in the minor space.  A program
30      with a constant data usage will appear to have a sawtooth usage
31      as minor data gradually transfers to the major space and then,
32      suddenly, all gets transferred back at major collections.
33      Decreasing heap size decreases the size of the minor collections
34      and increases major collections exaggerating the sawtooth.
35
36   4) The program is not as robust as it might be.
37
38
39 @HpView2.lhs@ is the result of a casual coupling of @Graph.lhs@ and
40 @HpView.lhs@ which draws continuous graphs of the heap consisting of:
41 total usage and usage by one particular cost centre.  For example:
42
43     mkfifo slife.hp
44     hpView2 slife.hp Main:mkQuad &
45     slife 2 Unis/gardenofeden +RTS -h -i0.1 -RTS 
46     rm slife.hp
47
48 draws a graph of total usage and usage by the function @mkQuad@.  
49
50 (You might also try 
51
52         hpView2 slife.old-hp Main:mkQuad
53
54  to see it in action on some older data)
55
56 The business with named pipes (mkfifo) is a little unfortunate - it
57 would be nicer if the Haskell runtime system could output to stderr
58 (say) which I could pipe into hpView which could just graph it's stdin
59 (like graph does).  It's probably worth wrapping the whole thing up in
60 a little shell-script.
61
62