On this page
pstats.FunctionProfile
Up: pstats | Next: pstats.SortKey
Rel: pstats.SortKey, pstats.Stats, pstats.StatsProfile
Ref: docs.python.org — pstats.FunctionProfile
Tags: #public #python3 #stdlib #pstats
Import
import pstats
from pstats import FunctionProfile
Signature & Overview
pstats.FunctionProfile(ncalls: str, tottime: float, percall_tottime: float, cumtime: float, percall_cumtime: float, file_name: str, line_number: int) -> None
FunctionProfile(ncalls: str, tottime: float, percall_tottime: float, cumtime: float, percall_cumtime: float, file_name: str, line_number: int)
Usage
import cProfile, pstats
with cProfile.Profile() as pr:
_ = sum(range(500))
prof = pstats.Stats(pr).get_stats_profile()
assert isinstance(prof, pstats.StatsProfile)
Gotchas
- Structured per-function stats dataclass (
ncalls,tottime,cumtime,file_name,line_number).
REPL Inspect
from pstats import FunctionProfile
help(FunctionProfile)
Linked from
Related notes
- tuts/python3/stdlib_module/pstats/SortKey Linked here; links to this page; shared tags: #pstats, #stdlib
- tuts/python3/stdlib_module/pstats/Stats Linked here; links to this page; shared tags: #pstats, #stdlib
- tuts/python3/stdlib_module/pstats/StatsProfile Linked here; links to this page; shared tags: #pstats, #stdlib
- tuts/python3/stdlib_module/pstats Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib