On this page
  1. pstats.StatsProfile
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

pstats.StatsProfile

Prev: pstats.Stats | Up: pstats
Rel: pstats.FunctionProfile, pstats.SortKey, pstats.Stats
Ref: docs.python.org — pstats.StatsProfile
Tags: #public #python3 #stdlib #pstats


Import

import pstats
from pstats import StatsProfile

Signature & Overview

pstats.StatsProfile(total_tt: float, func_profiles: dict[str, pstats.FunctionProfile]) -> None

Class for keeping track of an item in inventory.

Usage

import cProfile, pstats

with cProfile.Profile() as pr:
    _ = sum(range(100))
sp = pstats.Stats(pr).get_stats_profile()
assert sp.total_tt >= 0.0 and isinstance(sp.func_profiles, dict)

Gotchas

REPL Inspect

from pstats import StatsProfile
help(StatsProfile)

Linked from

Related notes