Skip to content
This repository has been archived by the owner on Aug 24, 2020. It is now read-only.

Does profiling work well with asyncio? #26

Open
nchammas opened this issue Jun 17, 2015 · 15 comments
Open

Does profiling work well with asyncio? #26

nchammas opened this issue Jun 17, 2015 · 15 comments

Comments

@nchammas
Copy link

I noticed that the README mentions support for greenlets. How about Python 3.4+'s asyncio?

Should we just use --timer=greenlet for all the varieties of asynchronous programming that Python supports (greenlets, threading, multiprocessing, asyncio, etc.)?

@sublee
Copy link
Contributor

sublee commented Jul 20, 2015

No, you shouldn't use --timer=greenlet. I didn't care about asyncio application but I should have done it. For now, probably we can't profile asyncio application with profiling. I'll try to find a solution.

Thanks to report.

@sublee
Copy link
Contributor

sublee commented Oct 21, 2015

I'm working on this issue.

Checkout https://github.com/sublee/profiling/tree/eventloop-aware and try like:

$ profiling yourapp.py --eventloop-aware=asyncio

I need to hear some feedback.

@nchammas
Copy link
Author

Hi @sublee! Thanks for revisiting this issue.

I won't be able to test this anytime soon, but I'll try to test it out at some point.

@thehesiod
Copy link

@sublee awesome! Exactly what I was looking for. Seems to work! Thanks!

As a tip for others. Syntax is:
$ profiling live-profile --eventloop-aware=asyncio ~/dev/weather/services/arrayds/app/web/app.py -- YOUR_SCRIPT_ARGS

@Alexis-benoist
Copy link

@sublee I can't clone your version of the code doing pip install git+https://github.com/sublee/profiling/tree/eventloop-aware doesn't clone the code.

Collecting git+https://github.com/sublee/profiling/tree/eventloop-aware
  Cloning https://github.com/sublee/profiling/tree/eventloop-aware to    /var/folders/rs/75jmmsys1dl016fnw1gsq0r00000gn/T/pip-89loyzv3-build
fatal: repository 'https://github.com/sublee/profiling/tree/eventloop-aware/' not found
  Complete output from command git clone -q https://github.com/sublee/profiling/tree/eventloop-aware /var/folders/rs/75jmmsys1dl016fnw1gsq0r00000gn/T/pip-89loyzv3-build:

@sublee
Copy link
Contributor

sublee commented Jul 21, 2016

@Alexis-benoist Your URL is not correct. Try to install with $ pip install git+https://github.com/what-studio/profiling.git@eventloop-aware.

@zet4
Copy link

zet4 commented Oct 17, 2016

Any update on this? Could really use a profiling tool for asyncio.

@thehesiod
Copy link

I've been using http://www.pyvmmonitor.com/ with pretty good success

@zet4
Copy link

zet4 commented Oct 17, 2016

@thehesiod thanks for suggestion but I just tried it in my application and without any success.

@advance512
Copy link

+1 for this.

@lambdalisue
Copy link

Brilliant! Note that I needed to comment out asyncio.Task._wakeup and asyncio.Task._step in https://github.com/what-studio/profiling/blob/eventloop-aware/profiling/adapting.py#L30 to ignore method_descriptor object has no attribute '__code__' exception in Python 3.6

@xNinjaKittyx
Copy link

xNinjaKittyx commented Apr 4, 2018

Hello, I ran into the same issue as above in Python 3.6. It would be nice to have this pulled into the code...

Edit: I'm not sure if i should report this as another bug, but if you use uvloop with profiling, you run into this error:

File ".../profiling/viewer.py", line 685, in keypress
    if not parent_node.is_root():
AttributeError: 'NoneType' object has no attribute 'is_root'

@MJ111
Copy link
Contributor

MJ111 commented Oct 8, 2018

@sublee
https://github.com/sublee/profiling/tree/eventloop-aware this asyncio feature is merged to this repo master branch, right?
I'm confused cause I think it's working well now with asyncio.

@sublee
Copy link
Contributor

sublee commented Oct 8, 2018

@MJ111 No, the branch has not been merged into master yet. Does master work well with asyncio now?

@MJ111
Copy link
Contributor

MJ111 commented Oct 8, 2018

@sublee I think so. I thought it’s merged already because there’s ‘asyncio.py’ in ‘profiling/remote’ folder. I might be wrong.

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

No branches or pull requests

9 participants