PerfTimer - code timer with Trio async support

PerfTimer seems like yet another code execution timer-- but wait! The package also includes TrioPerfTimer, which is aware of the Trio scheduler and able to deduct periods when a task is blocked. So you can measure the CPU time of any section of code including async calls.

If you’re not looking for a fancy context-manager timer thing, the package also has a trio_perf_counter() primitive, which follows the semantics of the stdlib time perf counters but in the context of a Trio task. Use it to build your own instrumentation stuff!

1 Like