def initialize(event_listener=nil)
@profiles = {}
@buffer = {}
@last_poll = nil
@lock = Mutex.new
@running = false
@profile_agent_code = false
@worker_loop = NewRelic::Agent::WorkerLoop.new
@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