Skip to content

FunctionStats

Inspect result.root_run.functions for costs aggregated from each function's visible source lines. Sampling observations do not imply invocation counts.

dataclass linescope.model.FunctionStats[source]

Index function costs derived from visible line measurements.

samples sums observations of the function's own lines, excluding nested definitions. Sample counts never imply function execution counts.

Attributes

source_id : str

Identifier of the snapshot containing the function.

qualified_name : str

Lexical function or method name, including enclosing scopes.

first_line : int

One-based line where the function definition begins.

total_time_ns : int | None

Sum of known visible line costs, excluding nested definitions.

calls : int | None

Exact invocation count, or None when unsupported by the collector.

samples : int | None

Collected sampling observations, or None when unsupported; never exact hits.

line_count : int | None, default=None

Source lines from the definition through the last body statement, including blank lines, comments, and nested definitions. Exclude decorators and trailing comments; None means the span is unavailable.


See Also

LineStats

Aggregate a visible source line without inventing unsupported hit counts.

ProfileRun

Represent a profiling scope and any separately executed child notebooks.

SymbolDefinition

Identify a statically resolved project definition.