Added the cProfile module.

Based on lsprof (patch #1212837) by Brett Rosen and Ted Czotter.
With further editing by Michael Hudson and myself.
History in svn repo: http://codespeak.net/svn/user/arigo/hack/misc/lsprof

* Module/_lsprof.c is the internal C module, Lib/cProfile.py a wrapper.
* pstats.py updated to display cProfile's caller/callee timings if available.
* setup.py and NEWS updated.
* documentation updates in the profiler section:
   - explain the differences between the three profilers that we have now
   - profile and cProfile can use a unified documentation, like (c)Pickle
   - mention that hotshot is "for specialized usage" now
   - removed references to the "old profiler" that no longer exists
* test updates:
   - extended test_profile to cover delicate cases like recursion
   - added tests for the caller/callee displays
   - added test_cProfile, performing the same tests for cProfile
* TO-DO:
   - cProfile gives a nicer name to built-in, particularly built-in methods,
     which could be backported to profile.
   - not tested on Windows recently!
This commit is contained in:
Armin Rigo 2006-02-08 12:53:56 +00:00
parent 5eefdca654
commit a871ef2b3e
14 changed files with 1701 additions and 109 deletions

View file

@ -14,6 +14,17 @@ Hotshot is a replacement for the existing \refmodule{profile} module. As it's
written mostly in C, it should result in a much smaller performance impact
than the existing \refmodule{profile} module.
\begin{notice}[note]
The \module{hotshot} module focuses on minimizing the overhead
while profiling, at the expense of long data post-processing times.
For common usages it is recommended to use \module{cProfile} instead.
\module{hotshot} is not maintained and might be removed from the
standard library in the future.
\end{notice}
\versionchanged[the results should be more meaningful than in the
past: the timing core contained a critical bug]{2.5}
\begin{notice}[warning]
The \module{hotshot} profiler does not yet work well with threads.
It is useful to use an unthreaded script to run the profiler over