home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / l / limitation
Encoding:
Text File  |  1996-11-14  |  2.5 KB  |  45 lines

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