Add script/rubyprof to generate cachegrind callgraphs

This commit is contained in:
Florian Weingarten
2015-05-10 02:30:43 +00:00
parent 015e9570cd
commit 56c38f87b2
2 changed files with 19 additions and 0 deletions

18
script/rubyprof Executable file
View File

@@ -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}"