home *** CD-ROM | disk | FTP | other *** search
- <TITLE>Limitations -- Python library reference</TITLE>
- Next: <A HREF="../c/calibration" TYPE="Next">Calibration</A>
- Prev: <A HREF="../r/reference_manual" TYPE="Prev">Reference Manual</A>
- Up: <A HREF="../t/the_python_profiler" TYPE="Up">The Python Profiler</A>
- Top: <A HREF="../t/top" TYPE="Top">Top</A>
- <H1>9.6. Limitations</H1>
- There are two fundamental limitations on this profiler. The first is
- that it relies on the Python interpreter to dispatch <DFN>call</DFN>,
- <DFN>return</DFN>, and <DFN>exception</DFN> events. Compiled C code does not
- get interpreted, and hence is ``invisible'' to the profiler. All time
- spent in C code (including builtin functions) will be charged to the
- Python function that invoked the C code. If the C code calls out
- to some native Python code, then those calls will be profiled
- properly.
- <P>
- The second limitation has to do with accuracy of timing information.
- There is a fundamental problem with deterministic profilers involving
- accuracy. The most obvious restriction is that the underlying ``clock''
- is only ticking at a rate (typically) of about .001 seconds. Hence no
- measurements will be more accurate that that underlying clock. If
- enough measurements are taken, then the ``error'' will tend to average
- out. Unfortunately, removing this first error induces a second source
- of error...
- <P>
- The second problem is that it ``takes a while'' from when an event is
- dispatched until the profiler's call to get the time actually
- <I>gets</I> the state of the clock. Similarly, there is a certain lag
- when exiting the profiler event handler from the time that the clock's
- value was obtained (and then squirreled away), until the user's code
- is once again executing. As a result, functions that are called many
- times, or call many functions, will typically accumulate this error.
- The error that accumulates in this fashion is typically less than the
- accuracy of the clock (i.e., less than one clock tick), but it
- <I>can</I> accumulate and become very significant. This profiler
- provides a means of calibrating itself for a given platform so that
- this error can be probabilistically (i.e., on the average) removed.
- After the profiler is calibrated, it will be more accurate (in a least
- square sense), but it will sometimes produce negative numbers (when
- call counts are exceptionally low, and the gods of probability work
- against you :-). ) Do <I>NOT</I> be alarmed by negative numbers in
- the profile. They should <I>only</I> appear if you have calibrated
- your profiler, and the results are actually better than without
- calibration.
- <P>
-