Class: OneApm::Collector::StatsEngine::GCProfiler::RailsBenchProfiler

Inherits:
Object
  • Object
show all
Defined in:
lib/one_apm/collector/stats_engine/gc_profiler.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/one_apm/collector/stats_engine/gc_profiler.rb', line 66

def self.enabled?
  ::GC.respond_to?(:time) && ::GC.respond_to?(:collections)
end

Instance Method Details

#call_countObject



74
75
76
# File 'lib/one_apm/collector/stats_engine/gc_profiler.rb', line 74

def call_count
  ::GC.collections
end

#call_time_sObject



70
71
72
# File 'lib/one_apm/collector/stats_engine/gc_profiler.rb', line 70

def call_time_s
  ::GC.time.to_f / 1_000_000 # this value is reported in us, so convert to s
end

#resetObject



78
79
80
# File 'lib/one_apm/collector/stats_engine/gc_profiler.rb', line 78

def reset
  ::GC.clear_stats
end