Introduce support for memory usage profiles

This commit is contained in:
Lourens Naudé
2015-05-05 23:00:28 -04:00
parent 76c24db039
commit 5a48edae6a
3 changed files with 28 additions and 0 deletions
+1
View File
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
gemspec
gem 'stackprof', platforms: :mri_21
gem 'allocation_tracer', platforms: :mri_21
group :test do
gem 'spy', '0.4.1'
+14
View File
@@ -71,6 +71,20 @@ namespace :profile do
end
namespace :memory do
desc "Run the liquid memory tracer"
task :run do
ruby "./performance/memory.rb"
end
desc "Run the liquid memory tracer with strict parsing"
task :strict do
ruby "./performance/memory.rb strict"
end
end
desc "Run example"
task :example do
ruby "-w -d -Ilib example/server/server.rb"
+13
View File
@@ -0,0 +1,13 @@
require 'allocation_tracer' rescue fail("install allocation_tracer extension/gem")
require File.dirname(__FILE__) + '/theme_runner'
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
profiler = ThemeRunner.new
require 'allocation_tracer/trace'
puts "Profiling memory usage..."
200.times do
profiler.run
end