pstats
pstats is a Python standard library module for reading and analyzing profiling results produced by Python's profilers such as cProfile and profile. It provides tools to inspect, compare, and present statistics about function calls, execution time, and call relationships. The main entry point is the Stats class, which can load data from a file created by a profiler and expose methods to reorder and display the data.
Internally, pstats stores statistics as a mapping from function identifiers to a tuple of metrics. Each entry
Common operations include stripping directory paths for readability, sorting by cumulative time or self time, printing
See also cProfile, profile, and the pstats module in the Python standard library.