Module resource_tracking

Module resource_tracking 

Source
Expand description

Process-level resource tracking: per-group memory allocation and CPU usage accounting.

This module provides the primitives for attributing memory allocations and CPU time to user-defined “resource groups”:

§Memory usage

For memory usage to be tracked, TrackingAllocator must be installed as the global allocator for the process. When installed, every allocation is attributed to the currently entered resource group, defaulting to a catch-all “root” group when no user-defined group is entered.

§CPU usage

CPU time is attributed to the currently entered resource group when that group is exited, based on the thread CPU time consumed while the group was entered. CPU usage tracking is only available on Linux; on other platforms it is a no-op.

Structs§

ResourceGroupRegistry
A registry of resource groups and the statistics for each of them.
ResourceGroupToken
A token associated with a specific resource group.
ResourceStats
Statistics for an resource group.
ResourceStatsSnapshot
Snapshot of allocation statistics for a group.
ResourceTrackingGuard
A guard representing an resource group which has been entered.
Tracked
An object wrapper that tracks allocations and attributes them to a specific group.
TrackingAllocator
A global allocator that tracks allocations on a per-group basis.

Traits§

Track
Attaches resource groups to a Future.