//#region src/debug/perf-track.d.ts /** * Per-system timing helper. Wraps `performance.measure` with the * Chrome 129+ `detail.devtools` extension so spans land on a named * track in the Performance panel grouped under `three-flatland`. * * Convention: * - **Track group**: `three-flatland` (the library — parent of every * instrumented subsystem). * - **Track**: the subsystem the span belongs to (`Devtools`, * `Lighting`, `Sprites`, `SDF`, …). One track per logical pipeline. * - **Entry name**: a `category:detail` slug used to group like-spans * within a track (`bus:data`, `flush`, `pass:occlusion`). * * No-op when devtools isn't bundled (gated via the devtools build * gate). Older Chromes silently ignore the `detail` * payload and the spans show up on the default Timings track. */ /** Track names used across the codebase. Add new ones here as you go. */ declare const PERF_TRACK: { readonly Devtools: "devtools"; readonly Lighting: "lighting"; readonly Sprites: "sprites"; readonly SDF: "sdf"; readonly Schedule: "schedule"; readonly Animation: "animation"; readonly Batch: "batch"; }; type PerfTrackName = (typeof PERF_TRACK)[keyof typeof PERF_TRACK]; /** * Chrome devtools palette tokens accepted by the `detail.devtools` * extension. Keep these to the documented set — invalid values trigger * a console warning in DevTools. */ type PerfColor = 'primary' | 'primary-light' | 'primary-dark' | 'secondary' | 'secondary-light' | 'secondary-dark' | 'tertiary' | 'tertiary-light' | 'tertiary-dark' | 'warning' | 'error'; /** * Default color per track so the Performance panel is colour-coded and * scannable at a glance — each logical pipeline reads as its own hue. */ declare const TRACK_COLOR: Record; /** * Optional track-entry annotations. `tooltipText` shows on hover; * `properties` render as a key/value table in the entry's details * drawer. See Chrome's "Extensibility API for the Performance panel". */ interface PerfDetailOptions { /** Palette token; defaults to the track's {@link TRACK_COLOR}. */ color?: PerfColor; /** Hover text for the entry. */ tooltipText?: string; /** Key/value rows shown in the entry's details drawer. */ properties?: [string, string][]; } /** * Emit a span on `track`. Color defaults to the track's hue; pass * `opts` for a custom color, hover tooltip, or a properties table. Safe * to call from hot paths — capability check + try/catch keeps it from * ever throwing. */ declare function perfMeasure(track: PerfTrackName, name: string, start: number, end: number, opts?: PerfDetailOptions): void; /** * Convenience: open a perf-measure scope and return a function that * closes it. Pattern: * * ```ts * const end = perfStart('Devtools', 'flush') * doWork() * end() * ``` * * Allocates the closure once per call — fine for occasional use; for * tight per-frame paths, prefer `perfMeasure` with manual timestamps * to avoid the closure cost. * * Part of the colored-perf-tracks instrumentation (#115): `perfMeasure` * is wired into `DevtoolsProvider`; broader pipeline coverage (and most * `perfStart` call sites) is tracked there. */ declare function perfStart(track: PerfTrackName, name: string, opts?: PerfDetailOptions): () => void; //#endregion export { PERF_TRACK, PerfColor, PerfDetailOptions, PerfTrackName, TRACK_COLOR, perfMeasure, perfStart }; //# sourceMappingURL=perf-track.d.ts.map