Module: Remnant::GC::Profiler::ClassMethods

Included in:
Remnant::GC::Profiler
Defined in:
lib/remnant/gc/profiler.rb

Instance Method Summary collapse

Instance Method Details

#clear_statsObject



30
31
32
33
# File 'lib/remnant/gc/profiler.rb', line 30

def clear_stats
  @raw_data = nil
  ::GC::Profiler.clear
end

#collectionsObject



18
19
20
# File 'lib/remnant/gc/profiler.rb', line 18

def collections
  raw_data.size
end

#disable_statsObject



26
27
28
# File 'lib/remnant/gc/profiler.rb', line 26

def disable_stats
  ::GC::Profiler.disable
end

#enable_statsObject



22
23
24
# File 'lib/remnant/gc/profiler.rb', line 22

def enable_stats
  ::GC::Profiler.enable
end

#enabled?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/remnant/gc/profiler.rb', line 5

def enabled?
  ::GC::Profiler.enabled?
end

#raw_dataObject



14
15
16
# File 'lib/remnant/gc/profiler.rb', line 14

def raw_data
  @raw_data ||= ::GC::Profiler.raw_data || []
end

#timeObject



9
10
11
12
# File 'lib/remnant/gc/profiler.rb', line 9

def time
  # returns time in seconds so convert to ms
  @time ||= raw_data.map {|data| data[:GC_TIME]}.sum * 1000
end