mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
Add profile:stackprof rake task.
This commit is contained in:
@@ -7,3 +7,4 @@ pkg
|
|||||||
.ruby-version
|
.ruby-version
|
||||||
*.bundle
|
*.bundle
|
||||||
/tmp
|
/tmp
|
||||||
|
Gemfile.lock
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ namespace :profile do
|
|||||||
ruby "./performance/profile.rb"
|
ruby "./performance/profile.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task :stackprof do
|
||||||
|
ruby "./performance/stackprof.rb"
|
||||||
|
end
|
||||||
|
|
||||||
desc "Run KCacheGrind"
|
desc "Run KCacheGrind"
|
||||||
task :grind => :run do
|
task :grind => :run do
|
||||||
system "qcachegrind /tmp/liquid.rubyprof_calltreeprinter.txt"
|
system "qcachegrind /tmp/liquid.rubyprof_calltreeprinter.txt"
|
||||||
|
|||||||
@@ -26,4 +26,7 @@ Gem::Specification.new do |s|
|
|||||||
s.require_path = "lib"
|
s.require_path = "lib"
|
||||||
|
|
||||||
s.add_development_dependency 'rake-compiler'
|
s.add_development_dependency 'rake-compiler'
|
||||||
|
s.add_development_dependency 'stackprof'
|
||||||
|
s.add_development_dependency 'rake'
|
||||||
|
s.add_development_dependency 'activesupport'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user