From 9ec2ef7f5652a8cebbca9eb663118d38eaa14692 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Mon, 11 May 2015 17:51:43 +0200 Subject: [PATCH] allow switching profiler mode --- lib/travis/api/app.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 42c19182..4b9a7015 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -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