spdl.pipeline.ThreadStats

class ThreadStats(pid: int, name: str, num_threads: int, minflt: int | None, majflt: int | None, utime: float | None, stime: float | None, voluntary_ctxt_switches: int | None, nonvoluntary_ctxt_switches: int | None, run_time: float | None, run_delay: float | None)[source]

Counters of the threads of one process that share a name, over the interval.

Threads are grouped by their OS name, which SPDL sets for its own threads. On Python < 3.14, other threads keep the executable’s name (e.g. python3.12) unless named explicitly. Counters of threads that exited during the interval are counted only in the process’s totals.

Added in version 0.9.0.

Attributes

pid

Process ID.

name

The threads' OS name (comm).

num_threads

Number of live threads with this name.

minflt

Minor page faults.

majflt

Major page faults.

utime

CPU time in user mode, in seconds.

stime

CPU time in kernel mode, in seconds.

voluntary_ctxt_switches

Voluntary context switches.

nonvoluntary_ctxt_switches

Involuntary context switches (preemptions).

run_time

Time on a CPU, in seconds (schedstat).

run_delay

Time runnable but waiting for a CPU, in seconds (schedstat).

majflt: int | None

Major page faults.

minflt: int | None

Minor page faults.

name: str

The threads’ OS name (comm).

nonvoluntary_ctxt_switches: int | None

Involuntary context switches (preemptions).

num_threads: int

Number of live threads with this name.

pid: int

Process ID.

run_delay: float | None

Time runnable but waiting for a CPU, in seconds (schedstat). High values mean the threads compete for CPUs, for example because of a CPU quota.

run_time: float | None

Time on a CPU, in seconds (schedstat).

stime: float | None

CPU time in kernel mode, in seconds.

utime: float | None

CPU time in user mode, in seconds.

voluntary_ctxt_switches: int | None

Voluntary context switches.