class AppDynamics::BackgroundMetrics::GCTime

Public Class Methods

new(config, sample_rate) click to toggle source
# File lib/app_dynamics/background_metrics.rb, line 36
def initialize(config, sample_rate)
  @gc = config.gc
  @sample_rate = sample_rate
end

Public Instance Methods

instrument!(state, counters, gauges) click to toggle source
# File lib/app_dynamics/background_metrics.rb, line 46
def instrument!(state, counters, gauges)
  last = state[:gc_time]
  cur = state[:gc_time] = @gc.total_time / 1_000
  val = cur - last

  counters[:'GC.time'] = val * (1/@sample_rate)
end
start!(state) click to toggle source
# File lib/app_dynamics/background_metrics.rb, line 41
def start!(state)
  # In milliseconds
  state[:gc_time] = @gc.total_time / 1_000
end