module ThreadLocalProfiler

Manages the active profiler so it can be stopped after a fork.

Definitions

def start

Start profiling on the current thread.

Implementation

def start
	result = super
	Thread.current.fiber_profiler_capture = self if result
	result
end

def stop

Stop profiling and clear the current thread's reference.

Implementation

def stop
	super
ensure
	if Thread.current.fiber_profiler_capture.equal?(self)
		Thread.current.fiber_profiler_capture = nil
	end
end