mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FEATURE: memory stats route for diagnostics in admin
This commit is contained in:
14
app/controllers/admin/diagnostics_controller.rb
Normal file
14
app/controllers/admin/diagnostics_controller.rb
Normal file
@ -0,0 +1,14 @@
|
||||
class Admin::DiagnosticsController < Admin::AdminController
|
||||
layout false
|
||||
skip_before_filter :check_xhr
|
||||
|
||||
def memory_stats
|
||||
|
||||
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
|
Reference in New Issue
Block a user