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

Robert Kern robert.kern at gmail.com
Tue Apr 7 05:19:47 CEST 2009


On 2009-04-06 19:09, Rahul wrote:
> Robert Kern<robert.kern at gmail.com>  wrote in
> news:mailman.3316.1238893185.11746.python-list at python.org:
>
>> To quickly find your hotspots, start by sorting by 'time' (that would
>> be displayed as the 'tottime' column in the human-readable output).
>> That tells you how much time is spent in each function itself,
>> excluding the time it spends calling out to other functions. For
>> example, per the docs under "Instant User� Ts Manual" (which you might
>> want to spend a little more time with):
>>
>>     p.sort_stats('time').print_stats(10)
>
> Thanks Robert. I was executing the profiler on the commandline like so:
>
> python -m profile ~/bin/visualize.py *.nc
>
> Is there any way to pass further options of the form sort etc. via this
> invocation. The manual did not specify usage of this form.

$ python -m profile --help
Usage: profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...

Options:
   -h, --help            show this help message and exit
   -o OUTFILE, --outfile=OUTFILE
                         Save stats to <outfile>
   -s SORT, --sort=SORT  Sort order when printing to stdout, based on
                         pstats.Stats class

Additionally, you can run pstats on the outfile for an interactive viewer:

$ python -m pstats visualize.prof

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list