Plop: Low-overhead profiling for Python(tech.dropbox.com)
tech.dropbox.com
Plop: Low-overhead profiling for Python
http://tech.dropbox.com/?p=272
3 comments
How does this compare (overhead, usefulness) to profile, cProfile, or hotshot?
Low overhead and a great visual.
Doing this:
>python -m plop.viewer --datadir=/tmp/profile.out
Causes this:
>ImportError: No module named pstats_loader
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/callen/.virtualenvs/scar/lib/python2.7/site-packages/plop/viewer.py", line 12, in <module> from plop.pstats_loader import load_pstats
I can't find it in
>https://github.com/bdarnell/plop/tree/master/plop
either.
Commenting out line 12 in viewer.py appears to get it past that error. I don't enjoy hacking up library code installed by pip in my virtualenvs.
>python -m plop.viewer --datadir=/tmp/profile.out
Causes this:
>ImportError: No module named pstats_loader
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/callen/.virtualenvs/scar/lib/python2.7/site-packages/plop/viewer.py", line 12, in <module> from plop.pstats_loader import load_pstats
I can't find it in
>https://github.com/bdarnell/plop/tree/master/plop
either.
Commenting out line 12 in viewer.py appears to get it past that error. I don't enjoy hacking up library code installed by pip in my virtualenvs.
Whoops. I deleted some dead code just before release but missed this import because I still had the old .pyc file lying around. I'm uploading a fixed build now.
I hate that! We recursively delete .pyc files on django runservers in local development and before unit test runs in our CI environment because we got sick of being bit by exactly this error.
We've started running our runservers with pythondontwritebytecode=1 - I haven't noticed enough of a performance impact to change it back and it saves us remembering to delete pyc files before deploys.
[deleted]
Glad to be of service. Cheers. :)
Edit: Update worked. I did a pip install --upgrade plop, the spurious line is gone from my virtualenv.
Have a wonderful day, thanks for sharing this.
Edit: Update worked. I did a pip install --upgrade plop, the spurious line is gone from my virtualenv.
Have a wonderful day, thanks for sharing this.