Re: [Haskell-cafe] Performance counters
Magnus Therning wrote: Andrew Coppin wrote: Stuff like how many times does this function get called? How what's the maximum depth it recurses to? That kind of thing. It won't help you, but wouldn't it be the kind of thing that'd fit in the GHC runtime? Do you also require that the counters are available to the program itself? (This is starting to sound like something Don mentioned in his talk in London...) [I'm getting *really* tired of my ISP thinking that 30% of the traffic from Haskell-cafe is spam. If only there was a way to whitelist it or something... repeatedly clicking this is not spam doesn't seem to get the message across.] Um... hmm, that's a good question. Basically I've written a program that does adaptive sampling, and I want to see how much it's recursing. There are two parameters you can adjust: the minimum step size, and the maximum error tollerance. I'd like to know which of the two limits the program is reaching. (In other words, does the error eventually fall below the threshold, or does the step size become too small first?) I guess *ideally* I'd like the end user to be able to find this out from the running program... but I guess to do that there really is no other way than to sprinkle monads or unsafe I/O around the place. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Performance counters
2009/5/5 Andrew Coppin andrewcop...@btinternet.com: Magnus Therning wrote: Andrew Coppin wrote: Stuff like how many times does this function get called? How what's the maximum depth it recurses to? That kind of thing. It won't help you, but wouldn't it be the kind of thing that'd fit in the GHC runtime? Do you also require that the counters are available to the program itself? (This is starting to sound like something Don mentioned in his talk in London...) [I'm getting *really* tired of my ISP thinking that 30% of the traffic from Haskell-cafe is spam. If only there was a way to whitelist it or something... repeatedly clicking this is not spam doesn't seem to get the message across.] Um... hmm, that's a good question. Basically I've written a program that does adaptive sampling, and I want to see how much it's recursing. There are two parameters you can adjust: the minimum step size, and the maximum error tollerance. I'd like to know which of the two limits the program is reaching. (In other words, does the error eventually fall below the threshold, or does the step size become too small first?) I guess *ideally* I'd like the end user to be able to find this out from the running program... but I guess to do that there really is no other way than to sprinkle monads or unsafe I/O around the place. Hi, Since your recursive function has to test if the recursion should be ended or continued, when it ends, you know the reason. So why not just wrap your result inside something like: data Result a = ThresholdReached a | StepSizeTooSmall a ? Also, passing an accumulator to the function to record the number of steps should be straightforward. Cheers, Thu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Performance counters
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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Performance counters
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. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Performance counters
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Performance counters
Andrew Coppin 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. It won't help you, but wouldn't it be the kind of thing that'd fit in the GHC runtime? Do you also require that the counters are available to the program itself? (This is starting to sound like something Don mentioned in his talk in London...) /M -- Magnus Therning(OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Performance counters
While not entirely handy, do the .prof files not contain enough information on entries into a function? [...@mavlo Test]$ grep addLeaf PingNet.prof addLeaf Network.Pastry.Data.LeafSet 822 1 0.00.0 0.00.0 addLeaf Network.Pastry.Data.LeafSet 687 243 0.00.0 0.10.1 addLeafNetwork.Pastry.Data.LeafSet 734 619933 0.10.060.5 94.6 addLeaf Network.Pastry.Data.LeafSet 6094013 0.00.0 0.50.6 addLeaf Network.Pastry.Data.LeafSet 6443600 0.00.0 0.30.6 addLeaf Network.Pastry.Data.LeafSet 7842666 0.00.0 0.30.4 addLeafNetwork.Pastry.Data.LeafSet 566 6 0.00.0 0.00.0 addLeafNetwork.Pastry.Data.LeafSet 569 0 0.00.0 0.00.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 andrewcop...@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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe