Message346509
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. |
|
Date |
User |
Action |
Args |
2019-06-25 11:14:11 | John Belmonte | set | recipients:
+ John Belmonte, asvetlov, yselivanov, xtreak |
2019-06-25 11:14:11 | John Belmonte | set | messageid: <1561461251.92.0.654565639786.issue37398@roundup.psfhosted.org> |
2019-06-25 11:14:11 | John Belmonte | link | issue37398 messages |
2019-06-25 11:14:11 | John Belmonte | create | |
|