Skip to content

Instantly share code, notes, and snippets.

@crazymykl
Last active March 1, 2017 20:41
Show Gist options
  • Save crazymykl/6d4e94cb676031a157e9 to your computer and use it in GitHub Desktop.
Save crazymykl/6d4e94cb676031a157e9 to your computer and use it in GitHub Desktop.
Ruby-prof wrapper script
def profile(**options)
fail "U WOT M8" unless block_given?
result = RubyProf.profile { yield }
Tempfile.open %w[vmm .cachegrind] do |tmp|
RubyProf::CallTreePrinter.new(result).print(tmp, **options)
spawn 'qcachegrind', tmp.path
end
end
@crazymykl
Copy link
Author

As a prerequisite:
brew install qcachegrind --with-graphviz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment