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 cProfile, profile and pstats. This profiler provides
deterministic profiling of 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 two different profilers: The profile and
cProfile modules export the same interface, so they are mostly
interchangeable; cProfile has a much lower overhead but is newer
and might not be available on all systems. cProfile is really a
compatibility layer on top of the internal _lsprof module. The
profiler modules are designed to provide an execution profile
for a given program, not for benchmarking purposes (for that,
there is timeit for reasonably accurate results). This
particularly applies to benchmarking Python code against C code:
the profilers introduce overhead f