MCPcopy
hub / github.com/NVIDIA/Isaac-GR00T / timed

Function timed

tests/test_support/runtime.py:710–724  ·  view source on GitHub ↗

Context manager that prints the wall-clock duration of a labelled phase. Usage:: with timed("model load"): model = load_model(...)

(label: str)

Source from the content-addressed store, hash-verified

708
709@contextlib.contextmanager
710def timed(label: str):
711 """Context manager that prints the wall-clock duration of a labelled phase.
712
713 Usage::
714
715 with timed("model load"):
716 model = load_model(...)
717 """
718 print(f"[timing] {label} — starting", flush=True)
719 t0 = time.perf_counter()
720 try:
721 yield
722 finally:
723 elapsed = time.perf_counter() - t0
724 print(f"[timing] {label} — done in {elapsed:.1f}s", flush=True)

Calls

no outgoing calls