Message 346509 - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Content
I have a context manager used for timing sections of code or whole functions (when used as a decorator).  It's aware of the Trio async/await scheduler and is able to exclude periods of time where the task is not executing.  The context manager itself is not async.

Synopsis of decorator case:

  @PerfTimer('query')
  async def query_or_throw(self, q):
      return _parse_result(await self._send_query(q))

I'd like to just use the existing ContextDecorator to define the PerfTimer context manager, and have it wrap coroutine functions properly.  New API is not required.