Is there any way to do line-by-line profiling in Python? The profiling
results can tell me how much time is spent in all functions, but within a
given function I can't get any idea of how much time was spent on each line.
For example, in the example below, I can see that graphWidth.py is taking
all the time, but there are many lines of code in graphWidth.py that aren't
function calls, and I have no way of knowing which lines are the
bottlenecks. I'm using hotspot currently, by the way.
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.215 0.215 0.221 0.221 graphWidth.py:6(graphWidth)
27 0.001 0.000 0.003 0.000 oldnumeric.py:472(all)
26 0.002 0.000 0.002 0.000 oldnumeric.py:410(sum)
26 0.001 0.000 0.002 0.000 oldnumeric.py:163(_wrapit)
26 0.001 0.000 0.001 0.000 oldnumeric.py:283(argmin)
26 0.000 0.000 0.000 0.000 numeric.py:111(asarray)
0 0.000 0.000 profile:0(profiler)
Thanks,
--
David Grant
|