def record_gc_runs_metric(snapshot, txn_count)
if snapshot.gc_total_time || snapshot.gc_runs
if snapshot.gc_total_time
gc_time = snapshot.gc_total_time - @last_snapshot.gc_total_time.to_f
end
if snapshot.gc_runs
gc_runs = snapshot.gc_runs - @last_snapshot.gc_runs
end
wall_clock_time = snapshot.taken_at - @last_snapshot.taken_at
NewRelic::Agent.agent.stats_engine.tl_record_unscoped_metrics(GC_RUNS_METRIC) do |stats|
stats.call_count += txn_count
stats.total_call_time += gc_runs if gc_runs
stats.total_exclusive_time += gc_time if gc_time
stats.max_call_time = (gc_time.nil? ? 0 : 1)
stats.sum_of_squares += wall_clock_time
end
end
end