python - 分析 CherryPy : convert results to graphic format

标签 python profiling cherrypy

我尝试分析我的 CherryPy Web 服务器,结果我有一些 .prof 文件。我可以使用 this post 中描述的网络浏览器以文本格式阅读它们。 。但我需要将结果导出到调用树中以使用 KCacheGrind 或 Gprof2Dot 等进行分析。

但是 Gprof2Dot 给了我一个错误:

profile_results>gprof2dot.py -f prof out.prof | dot -Tpng -o out.png

error: unexpected end of file

KCacheGrind 不知道 .prof 文件...

有什么方法可以以图形格式获取调用树吗?

谢谢。

最佳答案

您需要使用 pstats。

gprof2dot -f pstats out.prof | dot -Tpng -o out.png

CherryPy 使用 python cProfile/profile。

Here is the reference on the docs

关于python - 分析 CherryPy : convert results to graphic format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22961681/

相关文章:

python - 将 Atom Hydrogen 连接到 Pipenv Shell 中的内核

python - 如何在 Spyder 3.6 中安装 GraphViz

python - MirroredStrategy 和 CentralStorageStrategy 的区别

c++ - 为什么 vsperfmon 告诉我被调用函数的包含时间比根函数的包含时间长?

Python - flask 默认路由可能吗?

python - 在 CherryPy 中,是否可以为文件夹名称添加别名?

python - Cherrypy 服务器运行 python 脚本

python - 在 Pandas 中,将 tz_localize 用于忽略 DST 的时间序列的最佳方法是什么?

optimization - 你如何测试VBA代码的运行时间?

python - 以编程方式访问 cProfile 数据