[Haskell-cafe] Performance counters

Thomas DuBuisson 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
    addLeaf              Network.Pastry.Data.LeafSet
       822           1   0.0    0.0     0.0    0.0
       addLeaf           Network.Pastry.Data.LeafSet
       687         243   0.0    0.0     0.1    0.1
      addLeaf            Network.Pastry.Data.LeafSet
       734      619933   0.1    0.0    60.5   94.6
     addLeaf             Network.Pastry.Data.LeafSet
       609        4013   0.0    0.0     0.5    0.6
       addLeaf           Network.Pastry.Data.LeafSet
       644        3600   0.0    0.0     0.3    0.6
     addLeaf             Network.Pastry.Data.LeafSet
       784        2666   0.0    0.0     0.3    0.4
      addLeaf            Network.Pastry.Data.LeafSet
       566           6   0.0    0.0     0.0    0.0
  addLeaf                Network.Pastry.Data.LeafSet
       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.

Thomas

On Mon, May 4, 2009 at 1:35 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
>
> Don Stewart wrote:
>>
>> andrewcoppin:
>>
>>>
>>> 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
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list