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