MCPcopy Index your code
hub / github.com/nodejs/node / Timeline

Class Timeline

deps/v8/tools/system-analyzer/timeline.mjs:8–253  ·  view source on GitHub ↗

@template T

Source from the content-addressed store, hash-verified

6
7/** @template T */
8class Timeline {
9 /** Class T */
10 _model;
11 /** @type {T[]} */
12 _values;
13 // Current selection, subset of #values:
14 /** @type {?Timeline<T>} */
15 _selection;
16 _breakdown;
17
18 constructor(model, values = [], startTime = null, endTime = null) {
19 this._model = model;
20 this._values = values;
21 /** @type {number} */
22 this.startTime = startTime;
23 /** @type {number} */
24 this.endTime = endTime;
25 if (values.length > 0) {
26 if (startTime === null) this.startTime = values[0].time;
27 if (endTime === null) this.endTime = values[values.length - 1].time;
28 } else {
29 if (startTime === null) this.startTime = 0;
30 if (endTime === null) this.endTime = 0;
31 }
32 }
33
34 get model() {
35 return this._model;
36 }
37
38 get all() {
39 return this._values;
40 }
41
42 get selection() {
43 return this._selection;
44 }
45
46 /** @returns {Timeline<T>} */
47 get selectionOrSelf() {
48 return this._selection ?? this;
49 }
50
51 /** @param {Timeline<T>} value */
52 set selection(value) {
53 this._selection = value;
54 }
55
56 selectTimeRange(startTime, endTime) {
57 const items = this.range(startTime, endTime);
58 this._selection = new Timeline(this._model, items, startTime, endTime);
59 }
60
61 clearSelection() {
62 this._selection = undefined;
63 }
64
65 getChunks(windowSizeMs) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…