Python Call Graph generates pics very similar to those in maxy's answer. It also shows total time for each function, for some reason it's not reflected in the example graphs.
I've written a browser-based visualization tool, profile_eye, which operates on the output of gprof2dot.
gprof2dot is great at grokking many profiling-tool outputs, and does a great job at graph-element placement. The final rendering is a static graphic, which is often very cluttered.
Using d3.js it's possible to remove much of that clutter, through relative fading of unfocused elements, tooltips, and a fisheye distortion.
A friend and I have written a Python profile viewer called SnakeViz that runs in a web browser. If you are already successfully using RunSnakeRun SnakeViz may not add that much value, but SnakeViz is much easier to install.
Edit: SnakeViz supports Python 2 and 3 and works on all major systems.
发布评论
评论(12)
我只知道 RunSnakeRun。
前段时间也有一些关于 PyDev (Eclipse) 中集成分析器的讨论,但我不知道它是否会出现。
更新:不幸的是,RunSnakeRun 似乎不再维护,并且它不支持 Python 3。
I'm only aware of RunSnakeRun.
There was also some talk some time ago about an integrated profiler in PyDev (Eclipse), but I don't know if that will ever see the light of day.
Update: Unfortunately it seems that RunSnakeRun is no longer maintained, and it does not support Python 3.
我使用 gprof2dot.py。结果看起来像这样。我使用这些命令:
您需要 graphviz 和 gprof2dot.py 已安装。您可能喜欢便捷的 shell 脚本。
I use gprof2dot.py. The result looks like this. I use those commands:
You need graphviz and gprof2dot.py installed. You might like a convenience shell script.
Spyder 还为 cProfile 提供了一个非常漂亮的 GUI:
Spyder also provides a pretty nice gui for cProfile:
尝试蛇形维兹。非常容易安装(通过 pip)并且它基于浏览器。
https://jiffyclub.github.io/snakeviz/
Try out Snakeviz. Very easy to install (via pip) and it's browser based.
https://jiffyclub.github.io/snakeviz/
此人创建了一个图形配置文件,如此处所述。也许你可以用它作为你自己工作的起点。
This person created a graphical profile, described here. Maybe you could use that as a starting point for your own work.
Visual Studio 的 Python 工具包含一个做得非常好的图形分析器:http://www .youtube.com/watch?v=VCx7rlPyEzE&hd=1
http://pytools.codeplex.com /
Python Tools for Visual Studio contains a very well done graphical profiler: http://www.youtube.com/watch?v=VCx7rlPyEzE&hd=1
http://pytools.codeplex.com/
KCacheGrind 包括一个名为 QCacheGrind 的版本,它可以在 Mac OS 上运行 X 和Windows 上。
KCacheGrind includes a version called QCacheGrind which does run on Mac OS X and on Windows.
Python 调用图 生成的图片与 maxy 的回答。它还显示每个函数的总时间,由于某种原因,它没有反映在示例图中。
Python Call Graph generates pics very similar to those in maxy's answer. It also shows total time for each function, for some reason it's not reflected in the example graphs.
我编写了一个基于浏览器的可视化工具 profile_eye,它对 < 的输出进行操作a href="https://github.com/jrfonseca/gprof2dot" rel="nofollow">gprof2dot。
gprof2dot 非常擅长处理许多分析工具的输出,并且在图形元素放置方面做得很好。最终的渲染是静态图形,通常非常混乱。
使用 d3.js 可以通过未聚焦元素、工具提示和 鱼眼失真。
如需比较,请参阅 profile_eye 的可视化 /jrfonseca/gprof2dot" rel="nofollow">gprof2dot 使用的规范示例。特别是对于 Python,请参阅cProfile 输出示例。
I've written a browser-based visualization tool, profile_eye, which operates on the output of gprof2dot.
gprof2dot is great at grokking many profiling-tool outputs, and does a great job at graph-element placement. The final rendering is a static graphic, which is often very cluttered.
Using d3.js it's possible to remove much of that clutter, through relative fading of unfocused elements, tooltips, and a fisheye distortion.
For comparison, see profile_eye's visualization of the canonical example used by gprof2dot. For Python in particular, see a cProfile output example.
考虑pyflame + Flamegraph
Pyflame:Python+flamegraph的跟踪分析器
https://github。 com/uber/pyflame
您可以使用 pyflame 追踪正在运行的 python 进程。
Consider pyflame + flamegraph
Pyflame: A Ptracing Profiler For Python + flamegraph
https://github.com/uber/pyflame
You can trace towards a running python process using pyflame.
我使用过 plop 并发现它非常轻量。快速了解性能。
I have used plop and found it to be very light-weight. Gives a quick insight into the perf.
我和一个朋友编写了一个名为 SnakeViz 的 Python 配置文件查看器,它在 Web 浏览器中运行。如果您已经成功使用 RunSnakeRun SnakeViz 可能不会增加那么多价值,但 SnakeViz 更容易安装。
编辑:SnakeViz 支持 Python 2 和 3,并且适用于所有主要系统。
A friend and I have written a Python profile viewer called SnakeViz that runs in a web browser. If you are already successfully using RunSnakeRun SnakeViz may not add that much value, but SnakeViz is much easier to install.
Edit: SnakeViz supports Python 2 and 3 and works on all major systems.