Class: Barnes::Instruments::Ruby18GC
- Inherits:
-
Object
- Object
- Barnes::Instruments::Ruby18GC
- Defined in:
- lib/barnes/instruments/ree_gc.rb
Instance Method Summary collapse
-
#initialize ⇒ Ruby18GC
constructor
A new instance of Ruby18GC.
- #instrument!(state, counters, gauges) ⇒ Object
- #start!(state) ⇒ Object
Constructor Details
#initialize ⇒ Ruby18GC
Returns a new instance of Ruby18GC.
27 28 29 |
# File 'lib/barnes/instruments/ree_gc.rb', line 27 def initialize GC.enable_stats end |
Instance Method Details
#instrument!(state, counters, gauges) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/barnes/instruments/ree_gc.rb', line 35 def instrument!(state, counters, gauges) last = state[:ruby18_gc] cur = state[:ruby18_gc] = current counters.update \ :'GC.count' => cur[:gc_count] - before[:gc_count], :'GC.time' => cur[:gc_time] - before[:gc_time], :'GC.memory' => cur[:gc_memory] - before[:gc_memory], :'GC.allocated_objects' => cur[:objects] - before[:objects] gauges[:'Objects.live'] = ObjectSpace.live_objects gauges[:'GC.growth'] = GC.growth end |
#start!(state) ⇒ Object
31 32 33 |
# File 'lib/barnes/instruments/ree_gc.rb', line 31 def start!(state) state[:ruby18_gc] = current end |