[New-bugs-announce] [issue33221] Add stats for asyncio task usage.

Andrew Svetlov report at bugs.python.org
Tue Apr 3 18:33:22 EDT 2018

New submission from Andrew Svetlov <andrew.svetlov at gmail.com>:

I suggest adding a `Task.stats()` method.
The method should return a dict with the task usage statistics.
Dict keys:
- total_time: a time between task creation and a moment of the call (or task finishing timestamp if the task has finished). The value includes a time for `await func()` waiting.
- real_time: a cumulative time for `Task._step()` executions
- switch_count: a count of `Task._step()` calls.

It can help with tasks activity analyzing.

Yuri, what do you think about?

components: asyncio
messages: 314905
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add stats for asyncio task usage.
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list