Skip to main content

Module resource

Module resource 

Source
Expand description

Process-level resource reads (ADR-103 Stage 1).

Cumulative CPU time and peak RSS via getrusage(2), plus current RSS from platform APIs, used by the daemon’s phase-span logging (background-task start/completion/cancellation) and the comm.health resource self-report. libc is already a workspace dependency (used elsewhere in this crate for flock/kill), so this reuses it rather than adding a new one, per ADR-103 Stage 1’s preference for a small std/libc-based read over a dedicated sysinfo-style crate.

Structs§

ProcessResourceUsage
A point-in-time snapshot of this process’s cumulative resource usage.

Functions§

cpu_delta_us
CPU time consumed strictly between two ProcessResourceUsage snapshots, in microseconds.
current_rss_bytes
Current resident bytes for this process, or None if the platform cannot supply the reading. This independent read is not on the CPU snapshot path.
process_resource_usage
Read cumulative CPU and peak RSS with one getrusage call. Returns None when getrusage is unavailable or fails.