Module: Fiber::Profiler

Defined in:
lib/fiber/profiler/version.rb,
lib/fiber/profiler/fork_handler.rb,
ext/fiber/profiler/profiler.c,
lib/fiber/profiler/capture.rb,
lib/fiber/profiler.rb

Overview

Released under the MIT License. Copyright, 2026, by Samuel Williams.

Defined Under Namespace

Classes: Capture

Constant Summary collapse

VERSION =
"0.6.0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#fiber_profiler_captureObject

Thread-local storage for the active profiler capture.



11
12
13
# File 'lib/fiber/profiler/capture.rb', line 11

def fiber_profiler_capture
  @fiber_profiler_capture
end

Class Method Details

.captureObject

Execute the given block with the default profiler, if any.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fiber/profiler.rb', line 23

def self.capture
	if capture = self.default
		begin
			capture.start
			
			yield
		ensure
			capture.stop
		end
	else
		yield
	end
end

.defaultObject

The default profiler to use, if any.

Use the ‘FIBER_PROFILER_CAPTURE=true` environment variable to enable profiling.



16
17
18
# File 'lib/fiber/profiler.rb', line 16

def self.default
	Capture.default
end