Python class
CPUMetricsCollector
CPUMetricsCollectorβ
class max.diagnostics.cpu.CPUMetricsCollector(pids)
Bases: object
Collects aggregate CPU time across a set of PIDs.
Call start() before the workload, stop() after, then
dump_stats() to obtain the CPUMetrics summary.
dump_stats()β
dump_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
start()andstop()were not called, or if elapsed time is non-positive. -
Return type:
start()β
start()
Records the start clock and per-PID CPU times.
Processes that no longer exist record None and are skipped in
dump_stats().
-
Return type:
-
None
stop()β
stop()
Records the stop clock and per-PID CPU times.
Processes that no longer exist record None and are skipped in
dump_stats().
-
Return type:
-
None
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!