Python class
CPUMetricsCollector
CPUMetricsCollectorβ
class max.diagnostics.cpu.CPUMetricsCollector(pids)
Bases: object
Collects aggregate CPU time across a set of PIDs.
Use as a context manager around the workload, then call get_stats()
to obtain the CPUMetrics summary.
collector = CPUMetricsCollector(pids)
with collector:
run_workload()
metrics = collector.get_stats()get_stats()β
get_stats()
Computes and returns CPU metrics aggregated across the tracked PIDs.
-
Returns:
-
The aggregated user and system CPU times along with their utilization percentages over the elapsed wall-clock interval.
-
Raises:
-
RuntimeError β If the context manager was not used, or if elapsed time is non-positive.
-
Return type:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!