From 288d22d8a7ff1f9a441d2b8058382e807873d7d5 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Tue, 13 Jan 2015 10:18:16 -0500 Subject: [PATCH] 3021: Add web-inspectable profiling mode. * Run Workbench with environment variable ENABLE_PROFILING=yes. Timing figures should appear at the top left of each page. Click to get more detail. * Visit {workbench-uri}?pp=flamegraph to see a profiling graph instead of the requested page itself. * More: https://github.com/MiniProfiler/rack-mini-profiler --- apps/workbench/Gemfile | 4 +++- apps/workbench/Gemfile.lock | 15 +++++++++++++-- .../config/initializers/rack_mini_profile.rb | 5 +++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 apps/workbench/config/initializers/rack_mini_profile.rb diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile index 3a226489d9..eb383800f2 100644 --- a/apps/workbench/Gemfile +++ b/apps/workbench/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' gem 'rails', '~> 4.1.0' -gem 'arvados', '>= 0.1.20141114230720' +gem 'arvados', '>= 0.1.20150111195521' gem 'sqlite3' @@ -29,6 +29,8 @@ end group :development do gem 'byebug' gem 'ruby-debug-passenger' + gem 'rack-mini-profiler', require: false + gem 'flamegraph', require: false end group :test, :diagnostics do diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock index 4132189ad4..c72f2564f1 100644 --- a/apps/workbench/Gemfile.lock +++ b/apps/workbench/Gemfile.lock @@ -40,7 +40,7 @@ GEM andand (1.3.3) angularjs-rails (1.3.8) arel (5.0.1.20140414130214) - arvados (0.1.20141114230720) + arvados (0.1.20150111195521) activesupport (>= 3.2.13) andand (~> 1.3, >= 1.3.3) google-api-client (~> 0.6.3, >= 0.6.3) @@ -94,7 +94,12 @@ GEM extlib (0.9.16) faraday (0.8.9) multipart-post (~> 1.2.0) + fast_stack (0.1.0) + rake + rake-compiler ffi (1.9.6) + flamegraph (0.1.0) + fast_stack google-api-client (0.6.4) addressable (>= 2.3.2) autoparse (>= 0.3.3) @@ -160,6 +165,8 @@ GEM multi_json (~> 1.0) websocket-driver (>= 0.2.0) rack (1.5.2) + rack-mini-profiler (0.9.2) + rack (>= 1.1.3) rack-test (0.6.3) rack (>= 1.0) rails (4.1.9) @@ -179,6 +186,8 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) + rake-compiler (0.9.5) + rake raphael-rails (2.1.2) ref (1.0.5) ruby-debug-passenger (0.2.0) @@ -249,7 +258,7 @@ DEPENDENCIES RedCloth andand angularjs-rails - arvados (>= 0.1.20141114230720) + arvados (>= 0.1.20150111195521) bootstrap-sass (~> 3.1.0) bootstrap-tab-history-rails bootstrap-x-editable-rails @@ -257,6 +266,7 @@ DEPENDENCIES capybara coffee-rails deep_merge + flamegraph headless httpclient (~> 2.5) jquery-rails @@ -270,6 +280,7 @@ DEPENDENCIES passenger piwik_analytics poltergeist + rack-mini-profiler rails (~> 4.1.0) rails-perftest raphael-rails diff --git a/apps/workbench/config/initializers/rack_mini_profile.rb b/apps/workbench/config/initializers/rack_mini_profile.rb new file mode 100644 index 0000000000..a55473443f --- /dev/null +++ b/apps/workbench/config/initializers/rack_mini_profile.rb @@ -0,0 +1,5 @@ +if not Rails.env.production? and ENV['ENABLE_PROFILING'] + require 'rack-mini-profiler' + require 'flamegraph' + Rack::MiniProfilerRails.initialize! Rails.application +end -- 2.30.2