I am trying to profile some Haskell code using the GHC profiling tools. The cost center I am most interested in, however, is dominated currently by a bunch of initialization code that I don't really care about.
My code looks roughly, like this:
main = do
x <- lotsOfInitialization
print $ {-# SCC "myCostCenter" #-} interestingPart x
In my actual code, the lotsOfInitialization
part is taking ~98% of the time and so it's difficult to see with any granularity what is happening inside interestingPart
.
I thought that only annotating in one place (and not using -fprof-auto
) would be enough, but the report I'm getting still shows all the function calls.
I also tried a strictness annotation on x
, but that didn't seem to change anything.
Is there some way to tell GHC to ignore the initialization code, or to only focus on the parts I want?