user976175
user976175

Reputation: 41

GHC/Haskell profiling: function consumes time without being called

I have compiled a Haskell program with GHC with enabled profiling.

$ ./server +RTS -M6m -p -RTS

I get a profile like:

                                                   individual    inherited
COST CENTRE      MODULE           no.    entries  %time %alloc   %time %alloc

poke_a4u64       Generator      2859       56436   0.0    0.0     0.4    0.4
 storeParameter  Generator      2860           0   0.4    0.4     0.4    0.4
  ppCurrent      Generator      2866       56436   0.0    0.0     0.0    0.0
  ppFeedback     Generator      2861       56436   0.0    0.0     0.0    0.0

It looks like storeParameter is never called, but consumes time and memory. Since storeParameter calls ppCurrent, I guess that storeParameter is called 56436 times, like ppCurrent. Why is not shown?

Upvotes: 4

Views: 371

Answers (2)

augustss
augustss

Reputation: 23004

It's a bug in the ghc profiling. I don't know of a workaround, but Simon M has promised improvements in the next release.

Upvotes: 5

ivanm
ivanm

Reputation: 3927

I've found the entries column to lie in my own code: e.g. main getting called 6 times!

So I wouldn't worry too much about it.

Upvotes: 0

Related Questions