Profiling the interpreter from within
Skip Montanaro
skip at pobox.com
Thu Oct 4 22:11:59 EDT 2001
gb> The extension, I hallucinate, would turn on statistical profiling
gb> using the same interrupt mechanism used to get the times reported by
gb> gprof. It works by setting a timer to go off 100 times per
gb> second. On each interrupt it examines the return address and
gb> increments a counter in an array indicating a "hit" on that address
gb> (actually range of addresses). By adding up the counts for the range
gb> of addresses included in a function you can get an estimate of the
gb> time spent in that function.
In theory, that would work okay, however, since the python interpreter is so
much slower than real hardware, I think you'd have to have much longer runs
to make the statistical sampling very accurate.
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list