Cost Centre MAIN

Stefan Wehr stefan.wehr at
Thu Sep 23 03:49:26 EDT 2010

2010/9/21 Simon Marlow <marlowsd at>:
> On 19/09/2010 13:11, Stefan Wehr wrote:
>> Hi all,
>> I'm profiling a Haskell program and now getting that the program
>> spents 56% of its individual time in the cost centre MAIN (note the
>> capital letters).
>> I searched the documentation for this cost centre, with no success. In
>> all profiling results so far, the individual time spent in MAIN was
>> always 0%.
> The profiler constructs a tree of cost centres representing the lexical call
> structure of your program.  The root of this tree is the special cost centre
> "MAIN", which will collect any costs that are not otherwise attributed to
> any other cost centre.
> Usually if you get lots of costs attributed to "MAIN", then you don't have
> any cost centres; you should either compile with -auto-all, or add explicit
> cost centres yourself with {-# SCC "..." #-}.

I compiled the program with -auto-all and -caf-all, but also with
-threaded. The -threaded flag makes the difference, if I remove this
flag, cost centre MAIN is back at 0%. The program in question uses STM
and quite a lot of threads. Maybe transaction and synchronization
costs are summarized under MAIN?! Any comments?



More information about the Glasgow-haskell-users mailing list