trinity.perf.resource_sampler module#

Threaded resource sampler for performance tooling.

class trinity.perf.resource_sampler.ResourceSampler(interval_seconds: float, backend: SystemResourceBackend | None = None)[source]#

Bases: object

Periodically collect system resource samples in a background thread.

__init__(interval_seconds: float, backend: SystemResourceBackend | None = None) None[source]#
start() None[source]#

Start sampling in the background.

stop() list[ResourceSample][source]#

Stop sampling and return the collected samples.

samples() list[ResourceSample][source]#

Return a snapshot of all collected samples.