Class: MemoryTracker::Stores::GcstatLogfileStore
- Defined in:
- lib/memory_tracker/stores/gcstat_logfile_store.rb
Constant Summary collapse
- COLUMNS =
[ :count, :heap_final_num, :heap_free_num, :heap_length, :heap_live_num, :heap_used, :rss, :total_allocated_object, :total_freed_object, :vsize ]
Instance Method Summary collapse
-
#initialize(opts) ⇒ GcstatLogfileStore
constructor
A new instance of GcstatLogfileStore.
- #push(request) ⇒ Object
- #stats ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(opts) ⇒ GcstatLogfileStore
Returns a new instance of GcstatLogfileStore.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/memory_tracker/stores/gcstat_logfile_store.rb', line 8 def initialize(opts) logger_class = opts.fetch(:logger_class, 'Logger') filename = opts.fetch(:filename, "#{Rails.root}/log/memtracker_gcstat.log") @logger = logger_class.constantize.new(filename) if @logger.respond_to?(:formatter) @logger.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end end @num_lines = 0 end |
Instance Method Details
#push(request) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/memory_tracker/stores/gcstat_logfile_store.rb', line 22 def push(request) @request = request write_header if @num_lines % 1000 == 0 write_request_log @num_lines += 1 end |
#stats ⇒ Object
30 31 |
# File 'lib/memory_tracker/stores/gcstat_logfile_store.rb', line 30 def stats end |