Class: Barnes::Instruments::RubyGC
- Inherits:
-
Object
- Object
- Barnes::Instruments::RubyGC
- Defined in:
- lib/barnes/instruments/ruby_gc.rb
Constant Summary collapse
- COUNTERS =
Both sets are delta-computed (cur - last), but they land in different reporting buckets. COUNTERS go to ‘counters` (accumulated totals the receiver can sum). GAUGE_COUNTERS go to `gauges` so each sample is a standalone per-interval value. Keeping them separate also excludes them from the raw-value gauge loop below.
{ :count => :'GC.count', :major_gc_count => :'GC.major_count', :minor_gc_count => :'GC.minor_gc_count' }
- GAUGE_COUNTERS =
{ :total_allocated_objects => :'GC.total_allocated_objects', :total_freed_objects => :'GC.total_freed_objects' }
Instance Method Summary collapse
Instance Method Details
#instrument!(state, counters, gauges) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/barnes/instruments/ruby_gc.rb', line 23 def instrument!(state, counters, gauges) last = state[:ruby_gc] cur = state[:ruby_gc] = GC.stat COUNTERS.each do |stat, metric| counters[metric] = cur[stat] - last[stat] if cur.include? stat end GAUGE_COUNTERS.each do |stat, metric| gauges[metric] = cur[stat] - last[stat] if cur.include? stat end cur.each do |k, v| unless GAUGE_COUNTERS.include? k gauges[:"GC.#{k}"] = v end end end |
#start!(state) ⇒ Object
19 20 21 |
# File 'lib/barnes/instruments/ruby_gc.rb', line 19 def start!(state) state[:ruby_gc] = GC.stat end |