profiling
profiling copied to clipboard
Does profiling work well with asyncio?
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.)?
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.
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.
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.
@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
@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:
@Alexis-benoist Your URL is not correct. Try to install with $ pip install git+https://github.com/what-studio/profiling.git@eventloop-aware
.
Any update on this? Could really use a profiling tool for asyncio.
I've been using http://www.pyvmmonitor.com/ with pretty good success
@thehesiod thanks for suggestion but I just tried it in my application and without any success.
+1 for this.
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
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'
@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.
@MJ111 No, the branch has not been merged into master
yet. Does master
work well with asyncio now?
@sublee I think so. I thought it’s merged already because there’s ‘asyncio.py’ in ‘profiling/remote’ folder. I might be wrong.