Python的配置文件模块:< string>:1(?) [英] Python's profile module: <string>:1(?)
问题描述
我正在使用Python的(v2.4)profile
模块来分析numpy
脚本,并且以下条目似乎占了执行时间的大部分:
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(?)
不幸的是,它的出现使Google难以使用.
Unfortunately, its appearance makes it hard to Google.
我该如何找出确切的含义?
How do I go about figuring out what this is exactly?
编辑:分析器从外壳运行,如下所示:python -m profile -s cumulative script.py
edit The profiler is run from the shell as follows: python -m profile -s cumulative script.py
推荐答案
忽略此行.它是如何实现探查器的工件.它并没有告诉您任何有用的信息.查看它的"tottime"值:0.000. "tottime"是执行< string>: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.
这篇关于Python的配置文件模块:< string>:1(?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!