Execution time of lines within a function

monkeyboy fsenkel at lynx.neu.edu
Mon Dec 4 11:24:16 EST 2006


Thanks Neil,

I looked at that, but maybe I don't understand the output. I was hoping
to see the cummulative time for the function and then the time
associated with each statement (line) within the function.

In the hotshot output below, I can see the function being called 100
times, which is correct, but the rest seems at too low a level for me
to understand which statements are causing the slow execution.

Any suggestions?

hw6r3.py:276(main)                   hw6r3.py:73(findw)(100) 26700.865
                                     hw6r3.py:126(findphi)(100)
6153.585
                                     hw6r3.py:173(findu)(100) 1823.852
                                     hw6r3.py:197(findv)(100) 2392.977
                                     numeric.py:31(zeros_like)(3)
0.072
                                     numeric.py:286(array_str)(1)
0.677
                                     rpc.py:545(__getattr__)(13)
0.197
                                     rpc.py:589(__call__)(12)   51.334
rpc.py:319(putmessage)               <string>:1(fileno)(12)    0.039
                                     rpc.py:149(debug)(12)    0.126
rpc.py:236(asyncreturn)              rpc.py:149(debug)(24)    0.126
                                     rpc.py:242(decoderesponse)(12)
0.015
                                     rpc.py:277(getresponse)(12)
48.166


Regards,

Frank

Neil Cerutti wrote:
> On 2006-12-04, monkeyboy <fsenkel at lynx.neu.edu> wrote:
> > I have a function that hotshot says is very slow. I can get the
> > aggregate execution time, but is there a way to get the
> > execution time of each line so I can find the bottleneck?
>
> Try 'print_callees' on the stats object for your bottleneck. That
> may help.
> 
> -- 
> Neil Cerutti




More information about the Python-list mailing list