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

Commit c6bf1d8

Browse files
committed
Merge pull request #1093 from ualbertalib/gc_stats
Quick and dirty dump of GC statistics to the header
2 parents defab89 + 5ef8809 commit c6bf1d8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/controllers/application_controller.rb

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ApplicationController < ActionController::Base
1313
protect_from_forgery with: :exception
1414

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

1718
before_filter :force_account_link,
1819
if: -> { @current_user && @current_user.link_pending? }
@@ -39,6 +40,13 @@ def profile
3940
end
4041
end
4142

43+
def gc_stats
44+
before = GC.stat.to_s
45+
yield
46+
after = GC.stat.to_s
47+
response.header['X-GC-STATS-BEFORE'] = before
48+
response.header['X-GC-STATS-AFTER'] = after
49+
end
4250

4351
def after_sign_in_path_for(resource)
4452
if current_user.admin?

0 commit comments

Comments
 (0)