vibeqc.PerfTracker¶
- class vibeqc.PerfTracker(phases=<factory>, scf_iters=<factory>, memory_snapshots=<factory>, threads=1, t_start=<factory>, native_phases=<factory>, native_dropped_calls=0, _native_token=None)[source]¶
Bases:
objectAccumulator for per-phase wall/CPU timings, per-iteration SCF rows, and memory snapshots over the course of a calculation.
Constructed inside
perf_log()and passed implicitly to everyPerfScopeopened in the same async-context (usescontextvars.ContextVar, so perf trackers do NOT leak across threads or asyncio tasks). Call sites that want to read the live tracker – to add a custom snapshot, for instance – useactive_tracker().Public attributes:
phases– mapphase_name -> _PhaseStat;wall_son each entry is the cumulative wall time across all calls.scf_iters– list of per-iteration dicts (energy / dE / grad / DIIS / wall_s); populated by SCF entry points wired into the progress logger.memory_snapshots– list of{label, rss_mb, t_s}taken at SCF transitions.threads– snapshot of the OpenMP thread count at tracker construction (used to compute parallelism = cpu_s / (wall_s x threads) per phase).t_start– perf_counter timestamp; phase rows report wall-time deltas relative to this anchor.
- Parameters:
- __init__(phases=<factory>, scf_iters=<factory>, memory_snapshots=<factory>, threads=1, t_start=<factory>, native_phases=<factory>, native_dropped_calls=0, _native_token=None)¶
Methods
__init__([phases, scf_iters, ...])add_scf_iter(**fields)Record one SCF iteration.
add_scope(name, wall_s, cpu_s)snapshot_memory(label)Take a labeled RSS snapshot.
snapshot_native(*[, _finish])Drain completed native calls; safe to render an intermediate report.
Attributes
- snapshot_native(*, _finish=False)[source]¶
Drain completed native calls; safe to render an intermediate report.
The native buffer holds 256 calls between snapshots. Loss is counted. Abrupt process termination cannot run context cleanup, so checkpoint the report after completed calls when profiling a bounded calculation.
- Parameters:
_finish (bool)
- Return type:
None
- add_scf_iter(**fields)[source]¶
Record one SCF iteration. Recognized keys:
iter,energy,dE,grad,diis. Extra keys are kept verbatim in the row.- Parameters:
fields (Any)
- Return type:
None