Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

module · Ruby 4.1

GC::Profiler

9 class methods

The GC profiler provides access to information on GC runs including time, length and object space size.

Example:

Example
GC::Profiler.enable

require 'rdoc/rdoc'

GC::Profiler.report

pp GC::Profiler.raw_data

GC::Profiler.disable

GC::Profiler.raw_data returns one Hash per GC run, including CPU time fields such as :GC_TIME and wall-clock fields such as :GC_WALL_TIME, :GC_PAUSE_TIME, :GC_STOP_TIME, and :GC_STW_TIME. :GC_WALL_TIME is the wall-clock counterpart to :GC_TIME, while :GC_PAUSE_TIME measures how long user execution was blocked by the GC entry.

See also GC.count, GC.malloc_allocated_size and GC.malloc_allocations

Class methods 9