A profiler is a program that describes the run time performance of a program, providing a variety of statistics. This documentation describes the profiler functionality provided in the modules profile and pstats. This profiler provides deterministic profiling of any Python programs. It also provides a series of report generation tools to allow users to rapidly examine the results of a profile operation.
The Python standard library provides three different profilers:
The profile and cProfile modules export the same interface, so they are mostly interchangeables; cProfile has a much lower overhead but is not so far as well-tested and might not be available on all systems. cProfile is really a compatibility layer on top of the internal _lsprof module. The hotshot module is reserved to specialized usages.
See About this document... for information on suggesting changes.