spdl.pipeline.SystemStats¶
- class SystemStats(timestamp: float, interval: float, root_pid: int, processes: list[~spdl.pipeline._sys_monitor.ProcessStats], threads: list[~spdl.pipeline._sys_monitor.ThreadStats], cgroup: ~spdl.pipeline._sys_monitor.CgroupStats | None, host_pressure: dict[str, ~spdl.pipeline._sys_monitor.PressureStats | None] = <factory>, sample_time: float = 0.0, backend: str = 'python')[source]¶
One sample of
SystemMonitor.Added in version 0.9.0.
Methods
summary([top_threads])Aggregate the sample into one compact, JSON-serializable record.
to_dict()Convert to a JSON-serializable dictionary with every process and thread group.
Attributes
which reader collected the sample.
Seconds spent collecting this sample.
Wall-clock time of the sample (seconds since the epoch).
Seconds since the previous sample.
The process whose family is monitored.
The root process and its descendants.
Threads of the processes, grouped by process and name.
The monitoring process's cgroup, or
Noneif it cannot be read.Host-wide PSI (
/proc/pressure) for"cpu","memory"and"io".- cgroup: CgroupStats | None¶
The monitoring process’s cgroup, or
Noneif it cannot be read.
- host_pressure: dict[str, PressureStats | None]¶
Host-wide PSI (
/proc/pressure) for"cpu","memory"and"io".
- processes: list[ProcessStats]¶
The root process and its descendants.
- summary(top_threads: int = 8) dict[str, object]¶
Aggregate the sample into one compact, JSON-serializable record.
Counters are summed over the processes;
minflt_per_processgives the spread of minor faults over the processes other than the root, which shows a split between workers;top_threadsthread groups are merged by name, without a trailing index, across processes and ranked by CPU time. The cgroup and host pressure are included as they are. The record is about 2 KB, independent of the number of processes and threads.rss_anonsums each process’s resident anonymous memory, which counts pages that forked processes still share once per process. The cgroup’smemory_anonis the deduplicated total.- Parameters:
top_threads – The number of thread groups to include.
- threads: list[ThreadStats]¶
Threads of the processes, grouped by process and name. Empty with
threads=False.