Add profile:stackprof rake task.

This commit is contained in:
Dylan Thacker-Smith
2014-02-27 11:20:49 -05:00
parent 7ba02d2811
commit 5de1082201
5 changed files with 26 additions and 0 deletions

15
performance/stackprof.rb Normal file
View File

@@ -0,0 +1,15 @@
require 'stackprof' rescue fail("install stackprof extension/gem")
require File.dirname(__FILE__) + '/theme_runner'
profiler = ThemeRunner.new
profiler.run
results = StackProf.run(mode: :cpu, out: ENV['FILENAME']) do
100.times do
profiler.run
end
end
if results.kind_of?(File)
puts "wrote stackprof dump to #{results.path}"
else
StackProf::Report.new(results).print_text(false, 20)
end