GNU Info

Info Node: (python2.1-lib.info)Deterministic Profiling

(python2.1-lib.info)Deterministic Profiling


Next: Reference Manual Prev: Instant Users Manual Up: Python Profiler
Enter node , (file) or (file)node

What Is Deterministic Profiling?
================================

"Deterministic profiling" is meant to reflect the fact that all
_function call_, _function return_, and _exception_ events are
monitored, and precise timings are made for the intervals between these
events (during which time the user's code is executing).  In contrast,
"statistical profiling" (which is not done by this module) randomly
samples the effective instruction pointer, and deduces where time is
being spent.  The latter technique traditionally involves less overhead
(as the code does not need to be instrumented), but provides only
relative indications of where time is being spent.

In Python, since there is an interpreter active during execution, the
presence of instrumented code is not required to do deterministic
profiling.  Python automatically provides a "hook" (optional callback)
for each event.  In addition, the interpreted nature of Python tends to
add so much overhead to execution, that deterministic profiling tends
to only add small processing overhead in typical applications.  The
result is that deterministic profiling is not that expensive, yet
provides extensive run time statistics about the execution of a Python
program.

Call count statistics can be used to identify bugs in code (surprising
counts), and to identify possible inline-expansion points (high call
counts).  Internal time statistics can be used to identify "hot loops"
that should be carefully optimized.  Cumulative time statistics should
be used to identify high level errors in the selection of algorithms.
Note that the unusual handling of cumulative times in this profiler
allows statistics for recursive implementations of algorithms to be
directly compared to iterative implementations.


automatically generated by info2www version 1.2.2.9