Wildly inaccurate profiling results

Simon Marlow simonmar at microsoft.com
Tue Oct 21 12:21:37 EDT 2003


 
> I have a program, compiled with cost-center profiling on, 
> that takes about 5
> minutes, 30 seconds to run (measured with a stopwatch), but 
> the resulting .prof
> file reports the total time as 34 seconds. I know that this 
> number doesn't
> include overhead due to profiling, but surely the overhead 
> can't be that much!
> (Also, the program runs about as long when run without -P.)  
> I'm using a copy
> of GHC built from sources checked out around July 1. I'd 
> include the program,
> but it's very large and I'm not sure how to minimize it and 
> preserve the same
> behavior. Any ideas as to what the problem might be?

I think the profiler only measures CPU time, so if the program is
waiting for I/O or sleeping a lot of the time, that won't be included in
the profile.

Also, the overhead due to heap rofiling can sometimes be a lot, because
it includes the time to scan the heap and collect the census data.
Retainer profiling (+RTS -hr) is also especially expensive.  You should
see the profiling overheads drop considerably when not doing heap
profiling, though.

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list