Skip to content

stopwatch

xsdata.codegen.stopwatch

stopwatch(name)

Simple context manager that logs elapsed times.

Source code in xsdata/codegen/stopwatch.py
 7
 8
 9
10
11
12
13
@contextmanager
def stopwatch(name: str):
    """Simple context manager that logs elapsed times."""
    start_time = perf_counter_ns()
    yield
    stop_time = perf_counter_ns()
    stopwatches[name].append(stop_time - start_time)