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.

Author John Belmonte
Recipients John Belmonte, asvetlov, xtreak, yselivanov
Date 2019-06-25.11:14:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561461251.92.0.654565639786.issue37398@roundup.psfhosted.org>
In-reply-to
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.
History
Date User Action Args
2019-06-25 11:14:11John Belmontesetrecipients: + John Belmonte, asvetlov, yselivanov, xtreak
2019-06-25 11:14:11John Belmontesetmessageid: <1561461251.92.0.654565639786.issue37398@roundup.psfhosted.org>
2019-06-25 11:14:11John Belmontelinkissue37398 messages
2019-06-25 11:14:11John Belmontecreate