|
| 1 | +# Instant-event tracks |
| 2 | + |
| 3 | +Instant events are observations at a timestamp. Tracks displays them separately from stack intervals and numeric counters. They have **no measured duration or sample weight**. An event's name, category and details do not become frame identity, create a call stack, or affect stack/counter totals. |
| 4 | + |
| 5 | +Choose **Tracks** to inspect compatible clocks. Instant-only recordings are valid and do not require a synthetic stack profile. Equal-time events remain separate in source order; unlike numeric counter updates, they are not deduplicated into a last value. |
| 6 | + |
| 7 | +## Native metadata |
| 8 | + |
| 9 | +A native file can contain group-level `instantTracks` independently of `profiles` and `counterTracks`: |
| 10 | + |
| 11 | +```json |
| 12 | +{ |
| 13 | + "$schema": "https://www.speedscope.app/file-format-schema.json", |
| 14 | + "name": "Request markers", |
| 15 | + "shared": {"frames": []}, |
| 16 | + "profiles": [], |
| 17 | + "instantTracks": [{ |
| 18 | + "id": "request-marks", |
| 19 | + "name": "Request markers", |
| 20 | + "clock": "trace-event:wall", |
| 21 | + "timeUnit": "microseconds", |
| 22 | + "start": 1000, |
| 23 | + "scope": "thread", |
| 24 | + "processId": "42", |
| 25 | + "threadId": "7", |
| 26 | + "times": [0, 10, 10], |
| 27 | + "events": [ |
| 28 | + {"name": "received", "category": "request"}, |
| 29 | + {"name": "cache miss", "details": "Request id: abc"}, |
| 30 | + {"name": "retry scheduled"} |
| 31 | + ] |
| 32 | + }] |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +`id` is unique within the recording; `name` labels the lane. `clock` is a recording-local clock, not evidence that separate recordings are synchronized. `start` is the finite raw source timestamp of local zero, in the explicit time unit. `times` contains finite, nonnegative, nondecreasing offsets from that origin. Supported units are nanoseconds, microseconds, milliseconds and seconds. Equal times preserve all corresponding events. Empty lanes are valid metadata but have no observed points to display. |
| 37 | + |
| 38 | +`scope` is explicitly `thread`, `process` or `global`. Optional process/thread IDs provide context. Each timestamp has exactly one `events` entry with a required name and optional category/details text. Details are plain text, including multiline text; they are not HTML, executable data, or a promise that embedded stack-looking data describes measured execution. Unknown event-object fields are not retained by model validation. |
| 39 | + |
| 40 | +Native object/chunked exports, worker snapshots and source-map/profile-action group changes preserve instant tracks. Internal timestamps use `Float64Array`; worker transfer deduplicates backing buffers and hydration validates ownership without copying the numeric array. Event metadata is copied and frozen when native/worker data becomes a completed model. Later validation/export reuses owned frozen metadata; timestamp arrays remain immutable by ownership convention and are still fully validated. |
| 41 | + |
| 42 | +## Trace Event input scope |
| 43 | + |
| 44 | +The supported point phases are `i`, historical `I`, and `R`. Scope `s: "t"` (or omitted) selects a thread lane; `s: "p"` selects a process lane, and `s: "g"` selects a global lane. Source lane identity preserves numeric versus string identifiers. Scope-irrelevant identifiers remain in details rather than artificially splitting a global/process lane into threads. |
| 45 | + |
| 46 | +Timestamps use wall `ts` in microseconds, not `tts` or the trace's display-unit hint. Generic Trace Event points share the source-local `trace-event:wall` clock. Where points accompany supported Chrome Timeline CPU profiles, they use `chrome-timeline:wall`. Only matching explicit clocks and time units align with stack/counter rows. |
| 47 | + |
| 48 | +Selected source fields (`pid`, `tid`, `id`, `id2`, `args`, `stack`, `sf`, `tts`) are preserved as bounded JSON **text** in details when present. An input such as `stack: ["a", "b", "c"]` remains inspectable metadata; it does not become invented duration or a weighted sampled profile. Malformed imported point timestamps/scopes/labels or unsupported details fail explicitly. Resource exclusions in mixed recordings follow the separate whole-set policy below. |
| 49 | + |
| 50 | +Recognized historical `CpuProfile` payloads retain their existing sampled-CPU routing, even when a producer uses an instant phase. V8 `JitCodeAdded`/`JitCodeMoved` records are excluded from ordinary markers; this feature does not newly decode standalone JIT records. Asynchronous begin/end spans, flow/causal links, arbitrary metadata attached to existing call occurrences and manual annotation creation remain separate work. |
| 51 | + |
| 52 | +Primary scope/phase evidence: [Chromium Catapult's pinned instant importer](https://github.com/catapult-project/catapult/blob/6fd8bbe723677254ff1130a1a416988b8b3e285e/tracing/tracing/extras/importer/trace_event_importer.html#L657), including its historical CPU/JIT distinctions. The fork renders explicit points rather than manufacturing a positive-duration slice. |
| 53 | + |
| 54 | +## Overview and inspection |
| 55 | + |
| 56 | +Instant lanes use bounded glyphs at source observation times. Dense ranges group |
| 57 | +points into time buckets, retaining at most 4,096 representative glyphs across |
| 58 | +visible instant lanes. Counts make omitted/coincident events explicit; they are |
| 59 | +not counts of measured calls or an invented duration. The display does not |
| 60 | +connect points into a continuous activity interval. |
| 61 | + |
| 62 | +Use **Inspect events** on a lane to read the original events in the selected |
| 63 | +viewport. The list is paged at 100 events, retains equal-time entries in order, |
| 64 | +and expands details for one event at a time. Details are selectable plain text. |
| 65 | +Inspection reads original arrays rather than treating overview representatives |
| 66 | +as the complete data. Shared clock and navigation behavior is described in |
| 67 | +[MULTI_TRACK.md](MULTI_TRACK.md). |
| 68 | +Clock choices are paged 64 at a time; changing clock pages selects that page's |
| 69 | +first group. Replacing the source clears stale event details and clock paging. |
| 70 | + |
| 71 | +The inspector shows source origin and local offset separately. A computed source |
| 72 | +timestamp is explicitly labeled as potentially rounded, and is omitted if its |
| 73 | +sum is nonfinite. Overview readouts distinguish exact source-time coincidences |
| 74 | +from different offsets that collide at shared floating-point display precision. |
| 75 | + |
| 76 | +## Resource exclusions in mixed recordings |
| 77 | + |
| 78 | +Trace recordings that already contain stack profiles or counters keep that data |
| 79 | +when instant events exceed a supported resource budget. The importer excludes |
| 80 | +the **entire** instant-event set and attaches a persistent notice with the count |
| 81 | +of recognized instant events and the reason. It never returns a partial marker |
| 82 | +array or represents the retained subset as complete. |
| 83 | + |
| 84 | +Mixed-recording preflight can count more than 250,000 recognized instant events |
| 85 | +and exclude them before building their metadata. **Excluded marker records are |
| 86 | +not fully validated.** The same whole-set policy applies when track, metadata or |
| 87 | +details budgets are exceeded. Stack/counter validation is unchanged; malformed |
| 88 | +marker data being imported still fails. A pure instant-only recording over a |
| 89 | +resource limit fails rather than becoming an empty successful import. |
| 90 | + |
| 91 | +The streaming duration reader normalizes instant metadata as each record arrives |
| 92 | +instead of retaining a second raw marker/argument array. On the first marker |
| 93 | +failure it releases collected lane data and continues counting recognized |
| 94 | +points. Errors are resolved after the stack/counter group is known, preserving |
| 95 | +the same mixed/pure policy and late CPU-format fallback. Only the first bounded |
| 96 | +source event is also retained for the existing Hermes discriminator. Existing |
| 97 | +input-byte, per-record pending-byte, event-count, JSON-depth and cancellation |
| 98 | +guards still apply. Stack/counter raw records retain their existing sorting |
| 99 | +budget; normalized marker state uses the separate point/metadata budgets below. |
| 100 | +Generic full-array import keeps its count-first shortcut for oversized mixed |
| 101 | +marker sets, but still materializes that original input array. |
| 102 | + |
| 103 | +The notice survives native export and worker transport as optional group-level |
| 104 | +metadata, for example: |
| 105 | + |
| 106 | +```json |
| 107 | +"instantEventOmission": {"count": 309230, "reason": "point-limit"} |
| 108 | +``` |
| 109 | + |
| 110 | +The reason is one of `point-limit`, `track-limit`, `metadata-limit` or |
| 111 | +`details-limit`; the count must be a positive safe integer. No retained instant |
| 112 | +tracks accompany an omission summary. The summary preserves the fidelity |
| 113 | +warning when a mixed recording is exported; it cannot reconstruct omitted data. |
| 114 | +Native model data and worker payloads are validated strictly, including summary |
| 115 | +counts/reasons and contradictory retained-track/omission fields. |
| 116 | +Native `instantTracks` are never automatically omitted: malformed or over-limit |
| 117 | +model data fails validation even when the native file also contains stacks. |
| 118 | + |
| 119 | +## Resource and export policy |
| 120 | + |
| 121 | +- At most 256 lanes and 250,000 points in total. |
| 122 | +- At most 512 characters per label, 16,384 details characters per point, and 4,194,304 metadata characters in total. The total includes lane IDs/names/clocks/context plus event names/categories/details; shared labels count per observation. Labels are nonempty, trimmed and contain no control characters. Details can contain ordinary multiline text. |
| 123 | +- At most 2,000,000 bytes of unique retained timestamp backing buffers. Aliases count once; a tiny view into an oversized buffer is rejected. |
| 124 | +- Trace Event details are checked before serialization, with nesting depth at most eight and at most 4,096 visited values. Custom serializers, getters, cycles and nonfinite numeric details are unsupported. |
| 125 | + |
| 126 | +Caps apply together. Metadata character counts use JavaScript UTF-16 string lengths. Timestamp/model arrays, parsed input, metadata objects and the exported artifact still occupy memory; these are resource limits, not a whole-process or out-of-core guarantee. Generic gzip/zlib fallback retains its [separate expansion limit](IMPORT_FORMATS.md#generic-gzipzlib-decompression). |
| 127 | + |
| 128 | +Worker hydration and chunked Blob export yield periodically, support cancellation and report instant-specific export progress. Blob export writes timestamp and event entries in pieces, preserving owned metadata without constructing a full JavaScript number array. The synchronous object-export API deliberately materializes JSON-compatible arrays. |
0 commit comments