Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Last active December 16, 2015 00:19
Show Gist options
  • Save kenmazaika/5346966 to your computer and use it in GitHub Desktop.
Save kenmazaika/5346966 to your computer and use it in GitHub Desktop.

Ruby Profiling with Perftools.rb

TL;DR of Symbioz.

Notes: I only had luck with Ruby 1.9.3, not Ruby2, but I didn't dig into the Ruby2 problems too deeply. YMMV.

Installation on a Mac:

gem install perftools.rb
brew install ghostscript
brew install graphviz

Profiling

# Generate Profiled Data
CPUPROFILE=/tmp/output.prof \
CPUPROFILE_REALTIME=1  \
CPUPROFILE_FREQUENCY=1000 \
RUBYOPT="-r`gem which perftools | tail -1`"  rake

# Generate Pretty Graph
pprof.rb --pdf /tmp/output.prof > /tmp/output.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment