allow switching profiler mode
This commit is contained in:
parent
b0f142a94b
commit
9ec2ef7f56
|
@ -80,10 +80,12 @@ module Travis::Api
|
||||||
def initialize
|
def initialize
|
||||||
@app = Rack::Builder.app do
|
@app = Rack::Builder.app do
|
||||||
|
|
||||||
if ENV['STACKPROF']
|
if stackprof = ENV['STACKPROF']
|
||||||
require 'stackprof'
|
require 'stackprof'
|
||||||
puts "Setting up stack profiling."
|
modes = ['wall', 'cpu', 'object', 'custom']
|
||||||
use StackProf::Middleware, enabled: true, save_every: 1, mode: :object
|
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
|
end
|
||||||
|
|
||||||
extend StackInstrumentation
|
extend StackInstrumentation
|
||||||
|
|
Loading…
Reference in New Issue
Block a user