# File lib/new_relic/agent/busy_calculator.rb, line 78 def harvest_busy busy = 0 t0 = time_now @lock.synchronize do busy = accumulator @accumulator = 0 # Walk through the stack and capture all times up to # now for entrypoints @entrypoint_stack.size.times do |frame| busy += (t0 - @entrypoint_stack[frame]).to_f @entrypoint_stack[frame] = t0 end end busy = 0.0 if busy < 0.0 # don't go below 0% time_window = (t0 - harvest_start).to_f time_window = 1.0 if time_window == 0.0 # protect against divide by zero busy = busy / time_window if Agent.config[:report_instance_busy] NewRelic::Agent.record_metric('Instance/Busy', busy) end @harvest_start = t0 end