Module: Perfgate::Instrumentation::Gc

Defined in:
lib/perfgate/instrumentation/gc.rb

Overview

Garbage-collection activity during a Perfgate.measure block (spec section 13.5). gc_count matches the run-result schema in section 14.1; gc_minor_count/gc_major_count are additional diagnostic deltas the schema doesn't name explicitly but section 13.5 asks us to capture. GC metrics are diagnostic only and never fail a run.

Class Method Summary collapse

Class Method Details

.finish(started_at) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/perfgate/instrumentation/gc.rb', line 21

def finish(started_at)
  {
    "gc_count" => GC.stat(:count) - started_at[:count],
    "gc_minor_count" => GC.stat(:minor_gc_count) - started_at[:minor_count],
    "gc_major_count" => GC.stat(:major_gc_count) - started_at[:major_count]
  }
end

.startObject



13
14
15
16
17
18
19
# File 'lib/perfgate/instrumentation/gc.rb', line 13

def start
  {
    count: GC.stat(:count),
    minor_count: GC.stat(:minor_gc_count),
    major_count: GC.stat(:major_gc_count)
  }
end