Testing perftoos.rb

$ gem install perftools.rb
# now run the tests
$ CPUPROFILE=profiled RUBYOPT="-r`gem which perftools | tail -1`" the_command_to_run_tests
# now create the pdf with results
$ pprof.rb --pdf profiled > profiled.pdf

Possible errors

sh: dot: command not found
sh: ps2pdf: command not found

Fix on OSX by installing graphviz and ghostscript:

brew install graphviz
brew install ghostscript