@@ -10,29 +10,6 @@ The Python Profilers
1010.. module :: profile
1111 :synopsis: Python source profiler.
1212
13- .. index :: single: InfoSeek Corporation
14-
15- Copyright © 1994, by InfoSeek Corporation, all rights reserved.
16-
17- Written by James Roskind. [# ]_
18-
19- Permission to use, copy, modify, and distribute this Python software and its
20- associated documentation for any purpose (subject to the restriction in the
21- following sentence) without fee is hereby granted, provided that the above
22- copyright notice appears in all copies, and that both that copyright notice and
23- this permission notice appear in supporting documentation, and that the name of
24- InfoSeek not be used in advertising or publicity pertaining to distribution of
25- the software without specific, written prior permission. This permission is
26- explicitly restricted to the copying and modification of the software to remain
27- in Python, compiled Python, or other languages (such as C) wherein the modified
28- or derived code is exclusively imported into a Python module.
29-
30- INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
31- INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
32- SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
33- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
34- WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
35- OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3613
3714.. _profiler-introduction :
3815
@@ -43,33 +20,38 @@ Introduction to the profilers
4320 single: deterministic profiling
4421 single: profiling, deterministic
4522
46- A :dfn: `profiler ` is a program that describes the run time performance
47- of a program, providing a variety of statistics. This documentation
48- describes the profiler functionality provided in the modules
49- :mod: `cProfile `, :mod: `profile ` and :mod: `pstats `. This profiler
50- provides :dfn: `deterministic profiling ` of Python programs. It also
51- provides a series of report generation tools to allow users to rapidly
52- examine the results of a profile operation.
23+ A :dfn: `profiler ` is a program that describes the run time performance of a
24+ program, providing a variety of statistics. This documentation describes the
25+ profiler functionality provided in the modules :mod: `cProfile `, :mod: `profile `
26+ and :mod: `pstats `. This profiler provides :dfn: `deterministic profiling ` of
27+ Python programs. It also provides a series of report generation tools to allow
28+ users to rapidly examine the results of a profile operation.
5329
5430The Python standard library provides two different profilers:
5531
56- #. :mod: `cProfile ` is recommended for most users; it's a C extension
57- with reasonable overhead
58- that makes it suitable for profiling long-running programs.
59- Based on :mod: `lsprof `,
60- contributed by Brett Rosen and Ted Czotter.
32+ 1. :mod: `cProfile ` is recommended for most users; it's a C extension with
33+ reasonable overhead that makes it suitable for profiling long-running
34+ programs. Based on :mod: `lsprof `, contributed by Brett Rosen and Ted
35+ Czotter.
6136
62- #. :mod: `profile `, a pure Python module whose interface is imitated by
63- :mod: `cProfile `. Adds significant overhead to profiled programs.
64- If you're trying to extend
65- the profiler in some way, the task might be easier with this module.
66- Copyright © 1994, by InfoSeek Corporation.
37+ 2. :mod: `profile `, a pure Python module whose interface is imitated by
38+ :mod: `cProfile `. Adds significant overhead to profiled programs. If you're
39+ trying to extend the profiler in some way, the task might be easier with this
40+ module. Copyright © 1994, by InfoSeek Corporation.
6741
6842The :mod: `profile ` and :mod: `cProfile ` modules export the same interface, so
6943they are mostly interchangeable; :mod: `cProfile ` has a much lower overhead but
70- is newer and might not be available on all systems.
71- :mod: `cProfile ` is really a compatibility layer on top of the internal
72- :mod: `_lsprof ` module.
44+ is newer and might not be available on all systems. :mod: `cProfile ` is really a
45+ compatibility layer on top of the internal :mod: `_lsprof ` module.
46+
47+ .. note ::
48+
49+ The profiler modules are designed to provide an execution profile for a given
50+ program, not for benchmarking purposes (for that, there is :mod: `timeit ` for
51+ resonably accurate results). This particularly applies to benchmarking
52+ Python code against C code: the profilers introduce overhead for Python code,
53+ but not for C-level functions, and so the C code would seem faster than any
54+ Python one.
7355
7456
7557.. _profile-instant :
@@ -608,8 +590,26 @@ The resulting profiler will then call :func:`your_time_func`.
608590 best results with a custom timer, it might be necessary to hard-code it in the C
609591 source of the internal :mod: `_lsprof ` module.
610592
611- .. rubric :: Footnotes
612593
613- .. [# ] Updated and converted to LaTeX by Guido van Rossum. Further updated by Armin
614- Rigo to integrate the documentation for the new :mod: `cProfile ` module of Python
615- 2.5.
594+ Copyright and License Notices
595+ =============================
596+
597+ Copyright © 1994, by InfoSeek Corporation, all rights reserved.
598+
599+ Permission to use, copy, modify, and distribute this Python software and its
600+ associated documentation for any purpose (subject to the restriction in the
601+ following sentence) without fee is hereby granted, provided that the above
602+ copyright notice appears in all copies, and that both that copyright notice and
603+ this permission notice appear in supporting documentation, and that the name of
604+ InfoSeek not be used in advertising or publicity pertaining to distribution of
605+ the software without specific, written prior permission. This permission is
606+ explicitly restricted to the copying and modification of the software to remain
607+ in Python, compiled Python, or other languages (such as C) wherein the modified
608+ or derived code is exclusively imported into a Python module.
609+
610+ INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
611+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
612+ SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
613+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
614+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
615+ OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0 commit comments