开发者

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开发者_Go百科    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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜