2014-02-13 23:43:08 -05:00
|
|
|
class Admin::DiagnosticsController < Admin::AdminController
|
|
|
|
layout false
|
|
|
|
skip_before_filter :check_xhr
|
|
|
|
|
|
|
|
def memory_stats
|
|
|
|
|
2014-02-14 00:10:26 -05:00
|
|
|
begin
|
|
|
|
# ruby 2.1
|
|
|
|
GC.start(full_mark: true)
|
|
|
|
rescue
|
|
|
|
GC.start
|
|
|
|
end
|
|
|
|
|
2014-02-13 23:43:08 -05:00
|
|
|
stats = GC.stat.map{|k,v| "#{k}: #{v}"}
|
|
|
|
counts = ObjectSpace.count_objects.map{|k,v| "#{k}: #{v}"}
|
|
|
|
|
|
|
|
render text: "GC STATS:\n#{stats.join("\n")} \n\nObjects:\n#{counts.join("\n")}",
|
|
|
|
content_type: Mime::TEXT
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|