Last active
March 1, 2017 20:41
-
-
Save crazymykl/6d4e94cb676031a157e9 to your computer and use it in GitHub Desktop.
Ruby-prof wrapper script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As a prerequisite:
brew install qcachegrind --with-graphviz