Skip to content
class

ProfileSummary

ProfileSummary(name: str, events: list[OpEvent])

Aggregated timing summary for a single op name across many calls.

Produced by Profiler.key_averages, which buckets the recorded OpEvent list by op name and exposes total time, average time, call count, and cumulative FLOP estimate. This is the natural object for a "top-k by self-time" performance report.

Parameters

namestr
Op name shared by all events in the summary.
eventslist of OpEvent
Recorded events bucketed under name.

Notes

The average is computed as

tˉ=1N∑i=1Nti,\bar{t} = \frac{1}{N} \sum_{i=1}^{N} t_i,

where NN is the call count and tit_i is the per-call duration in microseconds.

Examples

>>> import lucid
>>> with lucid.profiler.profile() as prof:
...     for _ in range(10):
...         y = lucid.randn(64, 64) @ lucid.randn(64, 64)
>>> sorted((s.name, s.count) for s in prof.key_averages())
[('matmul', 10), ('randn', 20)]

Used by 1

Constructors

1
dunder

__init__

→None
__init__(name: str, events: list[OpEvent])

Initialise the instance. See the class docstring for parameter semantics.

Properties

4
prop

avg_time_us

→float
avg_time_us: float

Average time in microseconds per call.

prop

count

→int
count: int

Number of times this operation was called.

prop

total_flops

→int
total_flops: int

Total FLOPs across all calls.

prop

total_time_us

→float
total_time_us: float

Total time in microseconds across all calls.

Dunder methods

1
dunder

__repr__

→str
__repr__()

Return a developer-facing string representation of the instance.