【发布时间】:2011-08-23 06:37:30
【问题描述】:
我正在使用 Python 的 (v2.4) profile 模块来分析 numpy 脚本,以下条目似乎占了执行时间的大部分:
ncalls tottime percall cumtime percall filename:lineno(function)
256/1 0.000 0.000 7.710 7.710 <string>:1(?)
不幸的是,它的外观让 Google 很难。
我该如何弄清楚这到底是什么?
edit 探查器从 shell 运行如下:python -m profile -s cumulative script.py
【问题讨论】:
-
您是否使用
profile.run()来运行分析器?然后<string>:1引用您传递给此函数的语句字符串的第一行。如果您以不同的方式调用探查器,请指定。 -
@Sven Marnach:很好,我已将此信息添加到问题中。
-
假设您询问是因为您想要更高的性能,try this。
标签: python profiling profiler profile