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

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

REPL Inspect

from pstats import FunctionProfile
help(FunctionProfile)

Linked from

Related notes