OPTIONS_GHC -prof -auto-all

Henning Thielemann ghc at henning-thielemann.de
Sat Mar 26 22:02:52 CET 2011

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


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?

More information about the Glasgow-haskell-users mailing list