[Haskell-cafe] Performance counters
andrewcoppin at btinternet.com
Mon May 4 16:35:05 EDT 2009
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.
More information about the Haskell-Cafe