有 Python 的可视化分析器吗?

发布于 2024-09-12 10:48:57 字数 1539 浏览 2 评论 0 原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

沒落の蓅哖 2024-09-19 10:48:58

我只知道 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.

巾帼英雄 2024-09-19 10:48:58

我使用 gprof2dot.py。结果看起来像这样。我使用这些命令:

  python -m cProfile -o profile.dat my_program.py
  gprof2dot.py -f pstats profile.dat | dot -Tpng -o profile.png

您需要 graphvizgprof2dot.py 已安装。您可能喜欢便捷的 shell 脚本

I use gprof2dot.py. The result looks like this. I use those commands:

  python -m cProfile -o profile.dat my_program.py
  gprof2dot.py -f pstats profile.dat | dot -Tpng -o profile.png

You need graphviz and gprof2dot.py installed. You might like a convenience shell script.

白云悠悠 2024-09-19 10:48:58

Spyder 还为 cProfile 提供了一个非常漂亮的 GUI:

在此处输入图像描述

Spyder also provides a pretty nice gui for cProfile:

enter image description here

执手闯天涯 2024-09-19 10:48:58

尝试蛇形维兹。非常容易安装(通过 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/

可爱暴击 2024-09-19 10:48:58

此人创建了一个图形配置文件,如此处所述。也许你可以用它作为你自己工作的起点。

This person created a graphical profile, described here. Maybe you could use that as a starting point for your own work.

别理我 2024-09-19 10:48:58

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/

话少心凉 2024-09-19 10:48:58

KCacheGrind 包括一个名为 QCacheGrind 的版本,它可以在 Mac OS 上运行 XWindows 上

KCacheGrind includes a version called QCacheGrind which does run on Mac OS X and on Windows.

抹茶夏天i‖ 2024-09-19 10:48:58

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.

节枝 2024-09-19 10:48:58

我编写了一个基于浏览器的可视化工具 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.

十六岁半 2024-09-19 10:48:58

考虑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.

独闯女儿国 2024-09-19 10:48:58

我使用过 plop 并发现它非常轻量。快速了解性能。

I have used plop and found it to be very light-weight. Gives a quick insight into the perf.

浅浅 2024-09-19 10:48:57

我和一个朋友编写了一个名为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文