Class: Skylight::Core::VM::GC Private

Inherits:
Object
  • Object
show all
Defined in:
lib/skylight/core/vm/gc.rb,
lib/skylight/core/vm/gc.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initializeGC

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of GC.


33
34
35
# File 'lib/skylight/core/vm/gc.rb', line 33

def initialize
  @total = 0
end

Instance Method Details

#enableObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


37
38
39
# File 'lib/skylight/core/vm/gc.rb', line 37

def enable
  ::GC::Profiler.enable
end

#total_timeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


41
42
43
44
45
46
47
48
49
50
# File 'lib/skylight/core/vm/gc.rb', line 41

def total_time
  # Reported in seconds
  run = (::GC::Profiler.total_time * 1_000_000).to_i

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

  @total += run
end