cProfile.Profile.dump_stats()
cProfile.Profile.dump_stats() is a Python method in the CProfile Module category. Writes profiling data to a file (can be analyzed with pstats). The syntax is Profile.dump_stats(filename). Returns: None. A typical example: prof.dump_stats("profile.stats"). A close sibling is cProfile.run(), which runs a Python statement under the profiler and prints statistics. A close sibling is cProfile.runctx(), which runs a command with explicit globals/locals under the profiler. A close sibling is cProfile.Profile.enable(), which starts collecting profiling data. More about this category: Performance profiler — run, runctx, Profile, enable, disable, dump_stats. Related CProfile Module entries: cProfile.run(), cProfile.runctx(), cProfile.Profile.enable(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try cProfile.Profile.dump_stats() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.