Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1093 from ualbertalib/gc_stats
Browse files Browse the repository at this point in the history
Quick and dirty dump of GC statistics to the header
  • Loading branch information
pbinkley committed May 13, 2016
2 parents defab89 + 5ef8809 commit c6bf1d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

around_filter :profile, if: -> {Rails.env.development? && params[:trace] == "1"}
around_filter :gc_stats, if: -> {params[:gc_stats] == "1"}

before_filter :force_account_link,
if: -> { @current_user && @current_user.link_pending? }
Expand All @@ -39,6 +40,13 @@ def profile
end
end

def gc_stats
before = GC.stat.to_s
yield
after = GC.stat.to_s
response.header['X-GC-STATS-BEFORE'] = before
response.header['X-GC-STATS-AFTER'] = after
end

def after_sign_in_path_for(resource)
if current_user.admin?
Expand Down

0 comments on commit c6bf1d8

Please sign in to comment.