Class: Trashed::Instruments::RubyGC
- Inherits:
-
Object
- Object
- Trashed::Instruments::RubyGC
- Defined in:
- lib/trashed/instruments/ruby_gc.rb
Constant Summary collapse
- MEASUREMENTS =
{ :count => :'GC.count', :major_gc_count => :'GC.major_count', :minor_gc_count => :'GC.minor_gc_count', :total_allocated_object => :'GC.allocated_objects', :total_freed_object => :'GC.freed_objects' }
Instance Method Summary collapse
Instance Method Details
#measure(state, timings, gauges) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/trashed/instruments/ruby_gc.rb', line 16 def measure(state, timings, gauges) gc = GC.stat before = state[:ruby_gc] MEASUREMENTS.each do |stat, metric| timings[metric] = gc[stat] - before[stat] if gc.include? stat end gauges.concat gc.map { |k, v| [ :"GC.#{k}", v ] } end |
#start(state, timings, gauges) ⇒ Object
4 5 6 |
# File 'lib/trashed/instruments/ruby_gc.rb', line 4 def start(state, timings, gauges) state[:ruby_gc] = GC.stat end |