Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asyncio background tasks are added to total wall clock time #292

Open
lchristina26 opened this issue Feb 15, 2024 · 0 comments
Open

Asyncio background tasks are added to total wall clock time #292

lchristina26 opened this issue Feb 15, 2024 · 0 comments

Comments

@lchristina26
Copy link

When running profiler, it will show a request as the cumulative of all tasks - even ones run in the background. When looking at actual latency of the request, it will accurately represent the time. This is using the profiler as:

profiler = Profiler(async_mode="enabled")
profiler.start()
...
profiler.stop()
...

The output will look like:

Duration: 0.640     CPU time: 0.649
|- 0.320 task_1 (foreground)
    - ...
|- 0.320 task_2 (background task)

Actual measured latency: 0.321
Wall clock time should not include the background task total time since we are not awaiting it. I understand that pyinstrument follows the async context, but it doesn't seem like it is properly measuring the event loop itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant