To: partain@dcs.gla.ac.uk
cc: areid@dcs.gla.ac.uk, andy@dcs.gla.ac.uk
Subject: Heap profiling programs
Date: Thu, 09 Dec 93 17:33:09 +0000
From: Alastair Reid <areid@dcs.gla.ac.uk>


I've hacked up a couple of programs which it might be worth putting in
the next ghc distribution.  They are:

graph:	

  Draws a continuous graph of any one column of the statistics
  produced using the "+RTS -Sstderr" option.

  I'm not convinced this is astonishingly useful since I'm yet to
  learn anything useful from (manually) examining these statistics.
  (Although I do vaguely remember asking Patrick if the heap profiler
  could do stack profiles too.)

  A typical usage is:

    slife 2 Unis/gardenofeden +RTS -Sstderr -H1M -RTS |& graph 2

  which draws a graph of the third column (ie column 2!) of the
  stats.

  (btw is there a neater way of connecting stderr to graph's stdin?)

hpView2:	

  Draws a continuous graph of the statistics reported by the "+RTS -h"
  option.

  Since I understand what the figures mean, this seems to be the more
  useful program.

  A typical usage is:

    mkfifo slife.hp
    hpView2 slife.hp Main:mkQuad &
    slife 2 Unis/gardenofeden +RTS -h -i0.1 -RTS 
    rm slife.hp

  which draws a graph of the total heap usage and the usage for Main:mkQuad.


Minor problems:

The code is a gross hack... but it works.  (Maybe distribute in rot13
format so that you don't get accidentally get exposed to obscene code
:-))

The code uses a variant of Andy's picoXlibrary (which he was talking
about releasing but maybe isn't ready to do yet.)

Also, there are lots of obvious extensions etc which could be made but
haven't yet...  (The major one is being able to set the initial
scale-factor for displaying the graphs or being able to graph several
stats at once without having to tee.)


Hope you find them interesting.

Alastair

ps Code is in ~areid/hask/Life and should be readable/executable.
