what does "execfile" mean within profiler output and why does it not have a attached line number

John Machin sjmachin at lexicon.net
Sat Apr 4 20:43:08 EDT 2009


On Apr 5, 9:56 am, Rahul <nos... at nospam.invalid> wrote:
> "profile" tells me that most of my runtime was spent in just one part (1.28
> sec cumulatively out of 1.29 secs. But what is "execfile"? I don't see this
> as a function call with my python code. Also what's the 0 in the snippet:  
> ":0(execfile)"? Isn't there supposed to be a line-number?
>
> Looking up "execfile" in the python manual leads me to "exec": "This
> statement supports dynamic execution of Python code."
>
> But that seems pretty generic; how can I now try figuring out which part of
> my python file is the bottleneck?
>
> Sorry, I'm a newbiee to profiling.
>
> ######################################################################
>        51651 function calls (37762 primitive calls) in 1.290 CPU seconds
>  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
> [snip]
>     1    0.010    0.010    1.280    1.280 :0(execfile)
> [snip]
> ##########################################################

That means no more than "the profiler executed all of your code
once, it took 0.01 seconds inside the execfile itself, 0.01 seconds
per execution, total time spent by the execfile *and* what it called
was 1.28 seconds ("cum" == "cumulative"), again 1.28 secs per
execution"

So ignore that and look at the figures for the app functions/methods.



More information about the Python-list mailing list