Class: GCStatInstrumenter

Inherits:
Object
  • Object
show all
Defined in:
lib/gc_stat_instrumenter.rb

Class Method Summary collapse

Class Method Details

.instrumentObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gc_stat_instrumenter.rb', line 4

def self.instrument
  start_gc_stat = GC.stat
  yield
  end_gc_stat = GC.stat

  {
    gc: {
      time: (end_gc_stat[:time] - start_gc_stat[:time]) / 1000.0,
      major_count: end_gc_stat[:major_gc_count] - start_gc_stat[:major_gc_count],
      minor_count: end_gc_stat[:minor_gc_count] - start_gc_stat[:minor_gc_count],
    },
  }
end