
I have a large package and want to profile all functions of a single module of that package. I tried to prepend the pragma {-# OPTIONS_GHC -prof -auto-all #-} to the mentioned module, but GHC rejects this, because the profiler options are not allowed in the OPTIONS pragma. According to http://www.haskell.org/pipermail/glasgow-haskell-users/2006-December/011701.... this is a known issue. I could certainly add GHC-Options: -prof -auto-all to the package Cabal description, but I expect this would add cost centres to all functions in all modules of the package. I could add SCC pragmas to all top-level functions in the profiled module, but this is cumbersome. Thus my question: Is there a straightforward way to add cost centres to all functions of a single module in a Cabal package?

On 26 March 2011 21:02, Henning Thielemann
to the mentioned module, but GHC rejects this, because the profiler options are not allowed in the OPTIONS pragma. According to
According to http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/flag-reference.html -prof is static but -auto-all is dynamic. Thus I would expect that you could put -prof in Cabal's Ghc-Options field and -auto-all in the module OPTIONS pragma, which should give you the effect you desire. I'm not sure if it's considered good style to use the -prof flag explicitly, as there is a Cabal configure flag that will have the same effect but is potentially portable to other compilers. However, I'm not sure if GHC will error out if it sees -auto-all in pragma without being supplied -prof as well. so you should probably experiment. Cheers, Max
participants (2)
-
Henning Thielemann
-
Max Bolingbroke