Skip to main content

resource_usage

Function resource_usage 

Source
pub fn resource_usage(pid: u32) -> Option<ResourceUsage>
Expand description

Memory and cumulative CPU time of the process holding pid, read now.

None when there is no such process, it has exited (a zombie awaiting its reap counts as exited), it cannot be read (for example, another user’s process on macOS), or the platform has no source (see RESOURCE_USAGE_SUPPORTED). Never a reading of zeros in place of one of those.

Like any pid-based read, this describes whatever process holds pid now; a caller that needs it to be a particular process should confirm that process’s start_time around the call.