python - 有没有办法用探查器结果注释 Python 源代码?

标签 python profiler

我目前正在使用cProfile and pstats分析一些 Python 代码。

有没有办法在源代码中注释每行所花费的时间?理想情况下,这将是源代码的彩色 (HTML) 版本,其中昂贵的行以红色或其他方式突出显示。

最佳答案

是的,看看line profilerprofilehooks

我认为使用您自己的代码将输出呈现为 html 非常简单。

对于图表,请查看 gprof2dot

关于python - 有没有办法用探查器结果注释 Python 源代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5466700/

相关文章:

python - 编辑字典。在 json 文件中

ios - 想知道如何知道仪器时间分析器中的符号,并且仅在 Xcode 中显示地址

c++ - 如何在 qt 5.3.0 中使用 qml 分析器?

c# - 访问类的重对象成员的正确方法

c++函数地址在附加的探查器库中与主题代码库中不同

c# - .Net Framework 上的 clr.dll 是什么,它有什么作用?

python - 如何正确分组列?

python - Python IDE - 为树莓派创建 GUI 应用程序

python - 类型错误 : Cannot create a consistent method resolution in django

python - 导入错误: cannot import name 'ServiceBusClient' from 'azure.servicebus'