NPE
NPE

Reputation: 500227

Python's profile module: <string>:1(?)

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

Upvotes: 25

Views: 7802

Answers (1)

Jean-Paul Calderone
Jean-Paul Calderone

Reputation: 48325

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.

Upvotes: 26

Related Questions