Adding perftools.rb

perftools.rb can profile your code. The spec_helper contains comments
about how to activate it.
This commit is contained in:
Maikel Linke
2014-07-03 14:30:36 +10:00
parent 35bcebc823
commit e0119a3f1f
3 changed files with 24 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ end
group :test do
gem 'webmock'
gem 'perftools.rb'
end
group :development do

View File

@@ -341,6 +341,7 @@ GEM
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
mime-types
perftools.rb (2.0.1)
pg (0.13.2)
poltergeist (1.5.0)
capybara (~> 2.1)
@@ -531,6 +532,7 @@ DEPENDENCIES
newrelic_rpm
oj
paperclip
perftools.rb
pg
poltergeist
pry-debugger

View File

@@ -104,4 +104,25 @@ RSpec.configure do |config|
config.include Paperclip::Shoulda::Matchers
config.include JsonSpec::Helpers
# Profiling
#
# This code shouldn't be run in normal circumstances. But if you want to know
# which parts of your code take most time, then you can activate the lines
# below. Keep in mind that it will slow down the execution time heaps.
#
# The PerfTools will write a binary file to the specified path which can then
# be examined by:
#
# bundle exec pprof.rb --text /tmp/rspec_profile
#
#require 'perftools'
#config.before :suite do
# PerfTools::CpuProfiler.start("/tmp/rspec_profile")
#end
#
#config.after :suite do
# PerfTools::CpuProfiler.stop
#end
end