class

ProfileSummary

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

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ˉ=1Ni=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)
>>> for summary in prof.key_averages()[:3]:
...     print(summary)

Methods (6)

dunder

__init__

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

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

prop

count

int
count: int
source

Number of times this operation was called.

prop

total_time_us

float
total_time_us: float
source

Total time in microseconds across all calls.

prop

avg_time_us

float
avg_time_us: float
source

Average time in microseconds per call.

prop

total_flops

int
total_flops: int
source

Total FLOPs across all calls.

dunder

__repr__

str
__repr__()
source

Return a developer-facing string representation of the instance.