Python 的配置文件模块::1(?)
我正在使用 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(?)
不幸的是,它的出现使得谷歌搜索变得困难。
我该如何弄清楚这到底是什么?
编辑 探查器从 shell 运行,如下所示:python -m profile -scumulative script.py
I am using Python's (v2.4) profile
module to profile a numpy
script, and the following entry appears to account for the bulk of the execution time:
ncalls tottime percall cumtime percall filename:lineno(function)
256/1 0.000 0.000 7.710 7.710 <string>:1(?)
Unfortunately, its appearance makes it hard to Google.
How do I go about figuring out what this is exactly?
edit The profiler is run from the shell as follows: python -m profile -s cumulative script.py
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忽略这一行。它是探查器实现方式的产物。它没有告诉你任何有用的东西。查看它的“tottime”值:0.000。 “tottime”是执行“:1(?)”所花费的时间量,不包括执行其子级所花费的时间。所以,没有时间花在这里。 “cumtime”和“percall”很大,因为它们包括花在孩子身上的时间。请参阅http://docs.python.org/library/profile.html#cProfile。运行以获取更多详细信息。
Ignore this line. It is an artifact of how the profiler is implemented. It is not telling you anything useful. Look at the "tottime" value for it: 0.000. "tottime" is the amount of time spent executing "<string>:1(?)" excluding time spent executing children of it. So, no time is spent here. "cumtime" and "percall" are large because they include time spent in children. See http://docs.python.org/library/profile.html#cProfile.run for more details.