README
Mwrap SourceLocation
MwrapRack

Methods

::[] ::clear ::dump ::each ::quiet ::reset ::total_bytes_allocated ::total_bytes_freed

module Mwrap

require 'mwrap'

Mwrap has a dual function as both a Ruby C extension and LD_PRELOAD wrapper. As a Ruby C extension, it exposes a limited Ruby API. To be effective at gathering status, mwrap must be loaded as a LD_PRELOAD (using the mwrap(1) executable makes it easy)

ENVIRONMENT

The "MWRAP" environment variable contains a comma-delimited list of key:value options for automatically dumping at program exit.

If both 'dump_fd' and 'dump_path' are specified, dump_path takes precedence.

Public Class Methods

Mwrap[location] -> Mwrap::SourceLocation source

Returns the associated Mwrap::SourceLocation given the location String. location is either a Ruby source location path:line (e.g. "/path/to/foo.rb:5") or a hexadecimal memory address with square-braces part yielded by Mwrap.dump (e.g. "[0xdeadbeef]")

Mwrap.reset -> nil source

Resets the the total tables by zero-ing all counters. This resets all statistics. This is not an atomic operation as other threads (outside of GVL) may increment counters.

Mwrap.dump([[io] [, min]] -> nil source

Dumps the current totals to io which must be an IO object (StringIO and similar are not supported). Total sizes smaller than or equal to min are skipped.

The output is space-delimited by 3 columns:

total_size call_count location

Mwrap.each([min]) do |location,total,allocations,frees,age_total,max_lifespan|
...
end source

Yields each entry of the of the table to a caller-supplied block. min may be specified to filter out lines with total bytes equal-to-or-smaller-than the supplied minimum.

Mwrap.quiet do |depth|
# expensive sort/calculate/emitting results of Mwrap.each
# affecting statistics of the rest of the app
end source

Stops allocation tracking inside the block. This is useful for monitoring code which calls other Mwrap (or ObjectSpace/GC) functions which unavoidably allocate memory.

This feature was added in mwrap 2.0.0+

Mwrap.reset -> nil source

Resets the the total tables by zero-ing all counters. This resets all statistics. This is not an atomic operation as other threads (outside of GVL) may increment counters.

total_bytes_allocated () source

total bytes allocated as tracked by mwrap

total_bytes_freed () source

total bytes freed as tracked by mwrap


Pages Classes Methods
mail archives: https://80x24.org/mwrap-public/
	nntps://news.public-inbox.org/inbox.comp.lang.ruby.mwrap 
	imaps://;AUTH=ANONYMOUS@80x24.org/inbox.comp.lang.ruby.mwrap.0 
public: mwrap-public@80x24.org
source code: git clone https://80x24.org/mwrap.git