Question about profiling in GHC...

Kirsten Chevalier krc at
Mon Oct 27 10:45:15 EST 2003

On Mon, Oct 27, 2003 at 12:00:04PM -0500, glasgow-haskell-users-request at wrote:
>            When I compile my program without "-prof -auto-all" option (no
>    profiling  support), its  execution  time is about 140s (compiled with
>    -O2).  When  compiled  with  profiling  support, the time spent by the
>    program  is  about  180s  (I  used my  own timer to measure this).  Of
>    course, the additional 40s is caused by the profiling annotation code.
>    However, the profiler says (in the ".prof" file produced at the end of
>    execution)  that  the time spent is about 85s. I suppose that the time
>    measured  by  the profiler is only for evaluation of the main function
>    of my program (I have compiled all modules with "-prof-all"). But what
>    kind  of  computation  is performed in the rest 95s (180s - 85s) ?????
>    Garbage collection ???

Yes, it's probably garbage collection. To be sure, you can run your program
with the "-t" RTS option, which will create a file in the current working
directory named "foo.stat" if the executable is named "foo". The resulting
file will contain the total amount of time spent, the mutator time, and the
GC time. (I recently ran into this problem myself...)

Kirsten Chevalier * krc at * Often in error, never in doubt
"But just because we're conditioned to view some things as disgusting and
immoral doesn't mean that some things aren't, in actual point of fact,
disgusting and immoral. Human sacrifice, for instance. Or cannibalism. Or Ann
Coulter." -- Dan Savage 

More information about the Glasgow-haskell-users mailing list