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' }
Instance Method Summary collapse
Instance Method Details
#measure(state, timings, gauges) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/trashed/instruments/ruby_gc.rb', line 26 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 |