# File lib/new_relic/agent/threading/backtrace_service.rb, line 26
        def initialize(event_listener=nil)
          @profiles = {}
          @buffer = {}
          @last_poll = nil

          # synchronizes access to @profiles and @buffer above
          @lock = Mutex.new

          @running = false
          @profile_agent_code = false
          @worker_loop = NewRelic::Agent::WorkerLoop.new

          # Memoize overhead % to avoid getting stale OR looked up every poll
          @overhead_percent_threshold = NewRelic::Agent.config['xray_session.max_profile_overhead''xray_session.max_profile_overhead']
          NewRelic::Agent.config.register_callback('xray_session.max_profile_overhead''xray_session.max_profile_overhead') do |new_value|
            @overhead_percent_threshold = new_value
          end

          if event_listener
            event_listener.subscribe(:transaction_finished, &method(:on_transaction_finished))
          end
        end