Add script/rubyprof to generate cachegrind callgraphs
This commit is contained in:
parent
015e9570cd
commit
56c38f87b2
1
Gemfile
1
Gemfile
|
@ -28,6 +28,7 @@ gem 'test-unit' if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
|
||||||
gem 'rspec-mocks'
|
gem 'rspec-mocks'
|
||||||
|
|
||||||
if ENV['BENCHMARK']
|
if ENV['BENCHMARK']
|
||||||
|
gem 'ruby-prof'
|
||||||
gem 'rbtrace'
|
gem 'rbtrace'
|
||||||
gem 'stackprof'
|
gem 'stackprof'
|
||||||
gem 'benchmark-ips'
|
gem 'benchmark-ips'
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
export BENCHMARK=1
|
||||||
|
|
||||||
|
TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site', 'full_rebuild' => true})"
|
||||||
|
|
||||||
|
RUBY=$(cat <<RUBY
|
||||||
|
require 'ruby-prof'
|
||||||
|
result = RubyProf.profile{ ${TEST_SCRIPT} }
|
||||||
|
printer = RubyProf::CallTreePrinter.new(result)
|
||||||
|
filename = "tmp/ruby_prof_#{rand 10000}"
|
||||||
|
puts "Writing profile to #{filename}"
|
||||||
|
file = File.open(filename, "w")
|
||||||
|
printer.print(file, {})
|
||||||
|
file.close
|
||||||
|
RUBY
|
||||||
|
)
|
||||||
|
|
||||||
|
bundle exec ruby -r ./lib/jekyll -e "${RUBY}"
|
Loading…
Reference in New Issue