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)


80
81
82
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 80

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

Instance Method Details

#call_countObject



90
91
92
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 90

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.



86
87
88
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 86

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

#resetObject



94
95
96
97
# File 'lib/new_relic/agent/stats_engine/gc_profiler.rb', line 94

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