[LRUG] how to use ruby-prof

Taryn East teast at globalpersonals.co.uk
Fri Aug 14 01:57:51 PDT 2009


Hi all,
A bit of feedback I got from my talk was that people were still unsure of
exactly how/where to use RubyProf in their code.

I didn't cover it much because there are some great examples of this on the
ruby-prof homepage here: http://ruby-prof.rubyforge.org/
It pretty much covers all cases.
One issue I did have with the examples was with RubyProf::Test  - it is
meant to run each test case ten times to give you better average results...
but it doesn't re-run your setup method each time... which renderes it
practically useless if you do anything significant in setup... and given we
use shoulda - that means every test case :(

I hand-hacked up a solution which I cover in a blogpost here:
http://rubyglasses.blogspot.com/2009/08/faking-startup-and-shutdown-with.html

It doesn't do multiple runs over the tests, but does allow you to run
RubyProf over your whole test-suite.
Be aware that it'll generate a *huge* callgrind file that may take forever
to a) print and b) load up in kcachegrind.

If there are any other questiosn - feel free to ask :)

Cheers,
Taryn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20090814/1d1f9b23/attachment-0003.html>


More information about the Chat mailing list