allow switching profiler mode

This commit is contained in:
Konstantin Haase 2015-05-11 17:51:43 +02:00
parent b0f142a94b
commit 9ec2ef7f56

View File

@ -80,10 +80,12 @@ module Travis::Api
def initialize
@app = Rack::Builder.app do
if ENV['STACKPROF']
if stackprof = ENV['STACKPROF']
require 'stackprof'
puts "Setting up stack profiling."
use StackProf::Middleware, enabled: true, save_every: 1, mode: :object
modes = ['wall', 'cpu', 'object', 'custom']
mode = modes.include?(stackprof) ? stackprof.to_sym : :cpu
Travis.logger.info "Setting up profiler: #{mode}"
use StackProf::Middleware, enabled: true, save_every: 1, mode: mode
end
extend StackInstrumentation