Class: Autotuner::GCContext

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

Constant Summary collapse

HAS_STAT_HEAP =
GC.respond_to?(:stat_heap)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGCContext

Returns a new instance of GCContext.



13
14
15
16
17
18
19
20
# File 'lib/autotuner/gc_context.rb', line 13

def initialize
  @stat = GC.stat
  @latest_gc_info = GC.latest_gc_info

  if HAS_STAT_HEAP
    @stat_heap = GC.stat_heap
  end
end

Instance Attribute Details

#latest_gc_infoObject (readonly)

Returns the value of attribute latest_gc_info.



7
8
9
# File 'lib/autotuner/gc_context.rb', line 7

def latest_gc_info
  @latest_gc_info
end

#statObject (readonly)

Returns the value of attribute stat.



7
8
9
# File 'lib/autotuner/gc_context.rb', line 7

def stat
  @stat
end

#stat_heapObject (readonly)

Returns the value of attribute stat_heap.



10
11
12
# File 'lib/autotuner/gc_context.rb', line 10

def stat_heap
  @stat_heap
end

Instance Method Details

#updateObject



22
23
24
25
26
27
28
29
# File 'lib/autotuner/gc_context.rb', line 22

def update
  GC.stat(@stat)
  GC.latest_gc_info(@latest_gc_info)

  if HAS_STAT_HEAP
    GC.stat_heap(nil, @stat_heap)
  end
end