Skip to main content

Module usage

Module usage 

Source
Expand description

What a spawned process used, read from its zombie before it is reaped (decision 18A, see archive/PROJECT.md, How Python tasks are started: the fork server).

The workspace forbids unsafe, and no safe call returns a child’s rusage; but between its exit and its reaping a process is a zombie whose /proc/<pid>/stat still holds its CPU time (with the children it reaped) and its faults. Its memory is gone, so the peak RSS isn’t known, and its status has its leader thread’s context switches only, so those aren’t reported either. The agent waits for the exit without reaping (waitid with WNOWAIT), reads them, then reaps. A forked process’s usage comes from its shim instead (the parent’s rusage, all of it).

Structs§

Ended
How a process ended, besides its exit status: what it used and whether it dumped core.

Functions§

clock_ticks
The clock ticks per second of /proc’s times.
exited
Waits until child pid has exited, without reaping it (waitid with WNOWAIT, on the blocking pool: one parked thread per running process), so its zombie can be read first.
zombie_usage
The usage of zombie pid from proc_root (/proc): CPU time with its reaped children’s, in microseconds of ticks per second, and major faults (its own and its reaped children’s); no peak RSS and no context switches. None if it can’t be read or isn’t a zombie (a process still running would give a partial answer).