Class: NewRelic::Agent::StatsEngine::GCProfiler::Ruby19

Inherits:
Profiler
  • Object
show all
Defined in:
lib/new_relic/agent/stats_engine/gc_profiler.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Profiler

#capture, #initialize

Constructor Details

This class inherits a constructor from NewRelic::Agent::StatsEngine::GCProfiler::Profiler

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 78

def self.enabled?
  defined?(::GC::Profiler) && ::GC::Profiler.enabled?
end

Instance Method Details

#call_countObject



88
89
90
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 88

def call_count
  ::GC.count
end

#call_timeObject

microseconds spent in GC 1.9 total_time returns seconds. Don’t trust the docs. It’s seconds.



84
85
86
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 84

def call_time
  ::GC::Profiler.total_time * 1_000_000.0 # convert seconds to microseconds
end

#resetObject



92
93
94
95
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 92

def reset
  ::GC::Profiler.clear
  @last_timestamp = 0
end