Skip to main content

Module profiling

Module profiling 

Source
Expand description

Bounded observations of named scopes in the real code on this thread.

Resource publication, the app framework and apps mark their scopes with Phase::start or measure; a test wraps an interaction in observe and reads every scope that ran, aggregated by name. Scopes may nest, so their durations are not additive. Without an active observation a scope reads no clock: one thread-local read.

A running app observes the same scopes across one key’s journey, from the key to the frame answering it (begin_live, take_live): the window’s INPUT-FRAME record (ui_core::input_frame) names the work a keystroke did, in production builds.

Structs§

Phase
A named scope, recorded when it drops inside an active observation.
Sample
Repeated scopes aggregate by name, with exact counts and bounded memory. These nested durations must not be added to their enclosing scope.

Functions§

begin_live
Start observing this thread’s scopes, across events and frames, until take_live: a running app’s record of one key’s journey, or of one slow event. An observation already active (a test’s, another record’s) is left as it is. Answers whether this call started one, so only its starter takes it.
measure
Run operation as the scope phase.
observe
Run the real operation and return every scope it ran, by name.
take_live
Every scope that ran since begin_live, by name, ending the observation. Past [MAX_PHASES] names the rest are left out.
unobserved
Run operation with the active observation, if any, set aside: its scopes are not recorded, and the observation resumes afterwards.