Generate Ruby Profiling Charts With Perftools
Ilya Grigorik has written an interesting article called Profiling Ruby with Google's Perftools about using a port of Google's Perftools (perftools.rb) to build graphs showing the results of profiling sessions on your Ruby code. As with all of Ilya's great posts, it's punchy and to the point.
Ilya starts by explaining what Perftools is and shows how to use its regular profiling features from Ruby, which are impressive enough, but then moves on to showing how to generate graphic profiling charts that graphically demonstrate where your application is spending most of its time. Aman Gupta, the developer of Perftools.rb, has produced such graphs for RubyGems, Merb, Rails, and EventMachine, which you might find interesting. Unsurprisingly, Rails and Merb apps seem to spend most of their time at the IO stage.
June 22, 2009 at 6:48 pm
Just for ease of reference, here's a link to a ruby 1.9 output using gprof [since Aman's perftools doesn't work with 1.9 yet, it could be interesting].
June 22, 2009 at 6:49 pm
http://github.com/hogelog/ruby-1.9.1-p0/tree/ee0f53e2559af9b564176f000ec4cd35e01ec06a/sample/_gprof_out