#
10. The Python Profiler

Copyright © 1994, by InfoSeek Corporation, all rights reserved.

Written by James Roskind.10.1

Permission to use, copy, modify, and distribute this Python software and its associated documentation for any purpose (subject to the restriction in the following sentence) without fee is hereby granted, provided that the above copyright notice appears in all copies, and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of InfoSeek not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. This permission is explicitly restricted to the copying and modification of the software to remain in Python, compiled Python, or other languages (such as C) wherein the modified or derived code is exclusively imported into a Python module.

INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

The profiler was written after only programming in Python for 3 weeks. As a result, it is probably clumsy code, but I don't know for sure yet 'cause I'm a beginner :-). I did work hard to make the code run fast, so that profiling would be a reasonable thing to do. I tried not to repeat code fragments, but I'm sure I did some stuff in really awkward ways at times. Please send suggestions for improvements to: jar@netscape.com. I won't promise any support. ...but I'd appreciate the feedback.

#### Footnotes

... Roskind.10.1
  Updated and converted to LATEX by Guido van Rossum. The references to the old profiler are left in the text, although it no longer exists.

Subsections

- 10.1 Introduction to the profiler
- 10.2 How Is This Profiler Different From The Old Profiler?
- 10.3 Instant Users Manual
- 10.4 What Is Deterministic Profiling?
- 10.5 Reference Manual
  - 10.5.1 The `Stats` Class
- 10.6 Limitations
- 10.7 Calibration
- 10.8 Extensions -- Deriving Better Profilers
- 10.9 `hotshot` -- High performance logging profiler
  - 10.9.1 Profile Objects
  - 10.9.2 Using hotshot data
  - 10.9.3 Example Usage
- 10.10 `timeit` -- Measure execution time of small code snippets
  - 10.10.1 Command Line Interface
  - 10.10.2 Examples