Profiling question

Malcolm Wallace
Mon, 6 Jan 2003 12:55:35 +0000

Kirsten Chevalier <> writes:

> I'd like to be able to determine the percentage of allocated objects of
> a particular type at specific points in a program's execution. I know
> that I can use heap profiling to create a graph of memory usage broken
> down by type, but is there any way to record this information at
> particular points in the program (i.e., between two statements in a
> do-expression)?

If you were using nhc98, then you could use the following:

    import NonStdProfile

    f ... = do ...
               profile "point A" actionA
               profile "point B" actionB

The non-standard operation
    profile :: String -> a -> a
places a labelled marker line on the profile graph at the time instant
when the value is demanded.

I don't know whether ghc has anything similar?