Alternera.Plugin.Provisional.HeapPeak.Collector (alternera_plugin_sdk v0.9.0)

Copy Markdown View Source

The one process the node's metered steps report their garbage collections to (Plugin.Provisional.HeapPeak). It owns one trace session for as long as it lives and is that session's tracer: putting a process under a meter turns the session's :garbage_collection trace on for that process, and stopping the meter turns it off, each a few microseconds. A session per meter cost about 15 ms a step to take down (:trace.session_destroy/1, measured with 5,300 modules loaded).

It keeps, per meter, the process watched, the largest size a collection reported and a monitor of the meter's owner: a meter whose owner goes is dropped and its process's trace turned off. A watched process that goes keeps its meter, since the peak of a process killed at its limit is read after it died.

Restarted, it has a new session and no meters: a meter started before reads 0, and its process, traced on a session that is gone, sends nothing.

Summary

Functions

Returns a specification to start this module under a supervisor.

Hands the meter ref a size of its process, in bytes.

Ends the meter ref: the largest size it saw, in bytes, and the process it watched; :none for a meter that watched nothing.

Puts pid under the meter ref of owner, returning once its collections are traced.

How many meters are watching a process now.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

now(ref, bytes)

@spec now(reference(), non_neg_integer()) :: :ok

Hands the meter ref a size of its process, in bytes.

stop(ref)

@spec stop(reference()) :: {non_neg_integer(), pid()} | :none

Ends the meter ref: the largest size it saw, in bytes, and the process it watched; :none for a meter that watched nothing.

watch(ref, owner, pid)

@spec watch(reference(), pid(), pid()) :: :ok

Puts pid under the meter ref of owner, returning once its collections are traced.

watching()

@spec watching() :: non_neg_integer()

How many meters are watching a process now.