I'm trying to profile my program. So I compile it with -prof
and -auto-all
flags and run with -P
to get detailed profiling report:
$ ghc --make -prof -auto-all Test.hs
$ ./Test +RTS -P
Here is a piece of profiling report:
COST CENTRE MODULE no. entries %time %alloc
main Main 266 1 0.0 0.0
run Main 273 21845 99.3 99.7
sz Main 274 21844 0.0 0.0
size Main 268 21845 0.7 0.3
It seems that run
consumes all time and memory. It calls a lot of functions from various libraries, and I'm quite sure that most time is spent in one of them, but I can't figure in which one.
How can I get more detailed report? I hope that putting lots of SCC
annotations manually is not the only way.
Update. For now I "solved" the problem by copying sources of libraries to my program directory. This allows GHC to treat them as part of program, not as external libraries.