Class: Lens::GC

Inherits:
Object
  • Object
show all
Defined in:
lib/lens/gc.rb,
lib/lens/gc.rb

Instance Method Summary collapse

Constructor Details

#initializeGC

Returns a new instance of GC.



4
5
6
# File 'lib/lens/gc.rb', line 4

def initialize
  @total = 0
end

Instance Method Details

#enableObject



8
9
10
# File 'lib/lens/gc.rb', line 8

def enable
  ::GC::Profiler.enable
end

#total_timeObject



12
13
14
15
16
17
18
19
20
# File 'lib/lens/gc.rb', line 12

def total_time
  run = ::GC::Profiler.total_time

  if run > 0
    ::GC::Profiler.clear
  end

  @total += run
end