[Haskell-cafe] Performance counters
thomas.dubuisson at gmail.com
Mon May 4 17:32:19 EDT 2009
While not entirely handy, do the .prof files not contain enough
information on entries into a function?
[tom at Mavlo Test]$ grep addLeaf PingNet.prof
822 1 0.0 0.0 0.0 0.0
687 243 0.0 0.0 0.1 0.1
734 619933 0.1 0.0 60.5 94.6
609 4013 0.0 0.0 0.5 0.6
644 3600 0.0 0.0 0.3 0.6
784 2666 0.0 0.0 0.3 0.4
566 6 0.0 0.0 0.0 0.0
569 0 0.0 0.0 0.0 0.0
In this manner I know addLeaf was entered 72000+ times. Though it
won't give you any information about recursion depth (which is often
optimized out so you see fewer entries than there are logical calls to
the function). I'm not proposing people want to do this manually, but
asking if pulling the information out of the .prof files with some
tool would give much of the information you desire?
Or perhaps you desire this information within the program like Magnus mentioned.
On Mon, May 4, 2009 at 1:35 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> Don Stewart wrote:
>>> OK, so I'm pretty sure I'm not the first person to run into this...
>>> I've got a fairly large, complex program. It seems to work fine. But now I want to add some counters to measure various things.
>>> Trouble is, to do that, I'd have to "infect" the entire program with boilerplate code to propogate these counters. At best I could wrap it up in a monad, but it's still annoying to have to make 90% of the code in the program monadic just to carry these performance counters around.
>>> Does anybody know of a better solution? I could use the dreaded unsafePerformIO to prod some IORefs, but now you have to start sprinkling NOINLINE pragmas around and hope you know what you're doing... Scary! o_O
>> What kind of counters? Do you just want to measure how often things are
>> evaluated? Use -fhpc (which inserts 'ticks' for you).
>> Otherwise, you'll need some kind of manual tick system.
> Stuff like "how many times does this function get called? How what's the maximum depth it recurses to?" That kind of thing.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe