# progress_handler

Python API: `modelconverter.utils.progress_handler`

Progress reporting for the on-device benchmarking loops.

A benchmark runs either for a fixed duration or for a fixed number of repetitions. This module builds the progress bar for
whichever mode is selected, along with the loop guard and the per-iteration update the benchmark backends drive it with.

## Functions

### create_progress_handler

```python
def create_progress_handler(benchmark_time: int, repetitions: int) -> tuple[Progress, Callable[[], None], Callable[[], bool]]:
```

Create a progress bar for time- or repetition-based benchmarks.

Parameters

 * `benchmark_time` (`int`): Duration in seconds to benchmark for. A positive value selects the time-based mode.
 * `repetitions` (`int`): Number of repetitions to benchmark for. Used when `benchmark_time` is not positive.

Returns

 * `tuple[Progress, Callable[[], None], Callable[[], bool]]`: A tuple of the Rich `Progress` instance (context-manage it with
   `with progress:`), an `on_tick()` callable to be called once per iteration to update the bar, and a `should_continue()` loop
   guard for the time and repetition modes.
