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_increment, :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 |
# 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) @num_lines = 0 end |
Instance Method Details
#push(request) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/memory_tracker/stores/gcstat_logfile_store.rb', line 16 def push(request) @request = request write_header if @num_lines % 1000 == 0 write_request_log @num_lines += 1 end |
#stats ⇒ Object
24 25 |
# File 'lib/memory_tracker/stores/gcstat_logfile_store.rb', line 24 def stats end |