bencher.sweep_timings

Lightweight timing instrumentation for bencher sweep phases.

Classes

SweepTimings

Timing data for a single run_sweep() call.

Functions

phase_timer()

Context manager that yields a callable returning elapsed milliseconds.

Module Contents

class bencher.sweep_timings.SweepTimings

Timing data for a single run_sweep() call.

Each field records the wall-clock duration in milliseconds of a major phase inside Bench.run_sweep() or Bench.calculate_benchmark_results().

cache_check_ms: float = 0.0
sample_cache_init_ms: float = 0.0
dataset_setup_ms: float = 0.0
job_submission_ms: float = 0.0
job_execution_ms: float = 0.0
history_merge_ms: float = 0.0
post_setup_ms: float = 0.0
render_ms: float = 0.0
report_save_ms: float = 0.0
total_ms: float = 0.0
compute_total() float

Compute total_ms as the sum of all phase timing fields.

summary() dict[str, float]

Return all phase timings as a dict.

bencher.sweep_timings.phase_timer()

Context manager that yields a callable returning elapsed milliseconds.

Usage:

with phase_timer() as elapsed:
    do_work()
timings.some_phase_ms = elapsed()