diff --git a/Gemfile b/Gemfile index cb6f7a8f96..346d8c9d51 100644 --- a/Gemfile +++ b/Gemfile @@ -85,6 +85,7 @@ end group :test do gem 'webmock' + gem 'perftools.rb' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 9afad20d05..39afc2ac50 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4f96a09070..3f3435eda5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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