[Haskell-cafe] Interpreting profiling results

Gregory Collins greg at gregorycollins.net
Mon Feb 8 12:15:30 EST 2010

Daniel Fischer <daniel.is.fischer at web.de> writes:

>> The profiling run on Linux looks like this:
>>                                           individual    inherited
>>     COST CENTRE    MODULE  no.  entries  %time %alloc   %time %alloc
>>     MAIN           MAIN      1         0  95.7    0.2   100.0  100.0
>>     ...
> Insert lots of {-# SCC "foo" #-} pragmas (you did pass -auto-all on the 
> command line when compiling?). You can't interpret a profile where almost 
> everything is attributed to MAIN or main.

The -auto-all flag is on. The actual "main" function only takes up 3.5%
of the inherited time, and the program is only spending 2.4% of its time
doing GC.

Main itself is pretty trivial -- it creates an MVar, runs the server in
a forkIO (to get the accept() loop out of the main thread, as suggested
by http://haskell.org/haskellwiki/Simple_Servers), and blocks on the
mvar until the accept loop is terminated.

I'm just curious as to what the meaning of the MAIN cost centre is -- is
it just a catch-all bucket? Are we measuring time spent in the runtime

Gregory Collins <greg at gregorycollins.net>

More information about the Haskell-Cafe mailing list