@paulirish/trace_engine 0.0.41 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
  2. package/generated/protocol.d.ts +79 -3
  3. package/locales/en-US.json +210 -0
  4. package/locales/en-XL.json +210 -0
  5. package/models/cpu_profile/CPUProfileDataModel.d.ts +7 -0
  6. package/models/cpu_profile/CPUProfileDataModel.js +9 -2
  7. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
  8. package/models/cpu_profile/ProfileTreeModel.d.ts +1 -1
  9. package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
  10. package/models/trace/LanternComputationData.d.ts +1 -1
  11. package/models/trace/LanternComputationData.js +8 -6
  12. package/models/trace/LanternComputationData.js.map +1 -1
  13. package/models/trace/Processor.d.ts +2 -16
  14. package/models/trace/Processor.js +6 -4
  15. package/models/trace/Processor.js.map +1 -1
  16. package/models/trace/extras/FilmStrip.d.ts +5 -5
  17. package/models/trace/extras/FilmStrip.js +2 -1
  18. package/models/trace/extras/FilmStrip.js.map +1 -1
  19. package/models/trace/extras/MainThreadActivity.d.ts +1 -1
  20. package/models/trace/extras/MainThreadActivity.js +3 -3
  21. package/models/trace/extras/MainThreadActivity.js.map +1 -1
  22. package/models/trace/extras/ThirdParties.d.ts +14 -13
  23. package/models/trace/extras/ThirdParties.js +51 -61
  24. package/models/trace/extras/ThirdParties.js.map +1 -1
  25. package/models/trace/extras/TimelineJSProfile.d.ts +1 -1
  26. package/models/trace/extras/TimelineJSProfile.js +9 -4
  27. package/models/trace/extras/TimelineJSProfile.js.map +1 -1
  28. package/models/trace/extras/TraceTree.d.ts +19 -6
  29. package/models/trace/extras/TraceTree.js +6 -3
  30. package/models/trace/extras/TraceTree.js.map +1 -1
  31. package/models/trace/extras/extras.d.ts +0 -1
  32. package/models/trace/extras/extras.js +0 -1
  33. package/models/trace/handlers/AnimationFramesHandler.js +1 -1
  34. package/models/trace/handlers/AnimationFramesHandler.js.map +1 -1
  35. package/models/trace/handlers/ExtensionTraceDataHandler.js +8 -2
  36. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
  37. package/models/trace/handlers/FlowsHandler.js.map +1 -1
  38. package/models/trace/handlers/FramesHandler.d.ts +12 -12
  39. package/models/trace/handlers/FramesHandler.js +3 -3
  40. package/models/trace/handlers/FramesHandler.js.map +1 -1
  41. package/models/trace/handlers/LayoutShiftsHandler.d.ts +2 -2
  42. package/models/trace/handlers/LayoutShiftsHandler.js +25 -16
  43. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
  44. package/models/trace/handlers/MetaHandler.d.ts +2 -2
  45. package/models/trace/handlers/MetaHandler.js +21 -21
  46. package/models/trace/handlers/MetaHandler.js.map +1 -1
  47. package/models/trace/handlers/NetworkRequestsHandler.js +37 -38
  48. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  49. package/models/trace/handlers/PageLoadMetricsHandler.d.ts +6 -6
  50. package/models/trace/handlers/PageLoadMetricsHandler.js +9 -9
  51. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
  52. package/models/trace/handlers/RendererHandler.d.ts +1 -1
  53. package/models/trace/handlers/RendererHandler.js +4 -4
  54. package/models/trace/handlers/RendererHandler.js.map +1 -1
  55. package/models/trace/handlers/SamplesHandler.d.ts +1 -1
  56. package/models/trace/handlers/SamplesHandler.js +50 -42
  57. package/models/trace/handlers/SamplesHandler.js.map +1 -1
  58. package/models/trace/handlers/ScreenshotsHandler.d.ts +6 -3
  59. package/models/trace/handlers/ScreenshotsHandler.js +22 -8
  60. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
  61. package/models/trace/handlers/ServerTimingsHandler.js +4 -4
  62. package/models/trace/handlers/ServerTimingsHandler.js.map +1 -1
  63. package/models/trace/handlers/Threads.js +3 -4
  64. package/models/trace/handlers/Threads.js.map +1 -1
  65. package/models/trace/handlers/UserInteractionsHandler.d.ts +2 -2
  66. package/models/trace/handlers/UserInteractionsHandler.js +12 -12
  67. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
  68. package/models/trace/handlers/WarningsHandler.d.ts +2 -2
  69. package/models/trace/handlers/WarningsHandler.js +2 -2
  70. package/models/trace/handlers/WarningsHandler.js.map +1 -1
  71. package/models/trace/handlers/helpers.d.ts +3 -3
  72. package/models/trace/handlers/helpers.js +16 -19
  73. package/models/trace/handlers/helpers.js.map +1 -1
  74. package/models/trace/handlers/types.d.ts +1 -1
  75. package/models/trace/handlers/types.js.map +1 -1
  76. package/models/trace/helpers/SamplesIntegrator.d.ts +1 -1
  77. package/models/trace/helpers/SamplesIntegrator.js +54 -15
  78. package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
  79. package/models/trace/helpers/Timing.d.ts +23 -23
  80. package/models/trace/helpers/Timing.js +11 -11
  81. package/models/trace/helpers/Timing.js.map +1 -1
  82. package/models/trace/helpers/Trace.d.ts +15 -14
  83. package/models/trace/helpers/Trace.js +11 -5
  84. package/models/trace/helpers/Trace.js.map +1 -1
  85. package/models/trace/helpers/TreeHelpers.d.ts +2 -2
  86. package/models/trace/helpers/TreeHelpers.js +5 -5
  87. package/models/trace/helpers/TreeHelpers.js.map +1 -1
  88. package/models/trace/insights/CLSCulprits.d.ts +46 -1
  89. package/models/trace/insights/CLSCulprits.js +85 -10
  90. package/models/trace/insights/CLSCulprits.js.map +1 -1
  91. package/models/trace/insights/Common.d.ts +11 -7
  92. package/models/trace/insights/Common.js +85 -26
  93. package/models/trace/insights/Common.js.map +1 -1
  94. package/models/trace/insights/DOMSize.d.ts +26 -1
  95. package/models/trace/insights/DOMSize.js +44 -7
  96. package/models/trace/insights/DOMSize.js.map +1 -1
  97. package/models/trace/insights/DocumentLatency.d.ts +42 -5
  98. package/models/trace/insights/DocumentLatency.js +64 -8
  99. package/models/trace/insights/DocumentLatency.js.map +1 -1
  100. package/models/trace/insights/FontDisplay.d.ts +8 -2
  101. package/models/trace/insights/FontDisplay.js +10 -4
  102. package/models/trace/insights/FontDisplay.js.map +1 -1
  103. package/models/trace/insights/ForcedReflow.d.ts +30 -0
  104. package/models/trace/insights/ForcedReflow.js +181 -0
  105. package/models/trace/insights/ForcedReflow.js.map +1 -0
  106. package/models/trace/insights/ImageDelivery.d.ts +15 -1
  107. package/models/trace/insights/ImageDelivery.js +21 -1
  108. package/models/trace/insights/ImageDelivery.js.map +1 -1
  109. package/models/trace/insights/InteractionToNextPaint.d.ts +26 -1
  110. package/models/trace/insights/InteractionToNextPaint.js +27 -1
  111. package/models/trace/insights/InteractionToNextPaint.js.map +1 -1
  112. package/models/trace/insights/LCPDiscovery.d.ts +30 -6
  113. package/models/trace/insights/LCPDiscovery.js +36 -8
  114. package/models/trace/insights/LCPDiscovery.js.map +1 -1
  115. package/models/trace/insights/LCPPhases.d.ts +36 -7
  116. package/models/trace/insights/LCPPhases.js +37 -8
  117. package/models/trace/insights/LCPPhases.js.map +1 -1
  118. package/models/trace/insights/LongCriticalNetworkTree.d.ts +22 -0
  119. package/models/trace/insights/LongCriticalNetworkTree.js +40 -0
  120. package/models/trace/insights/LongCriticalNetworkTree.js.map +1 -0
  121. package/models/trace/insights/Models.d.ts +2 -0
  122. package/models/trace/insights/Models.js +2 -0
  123. package/models/trace/insights/Models.js.map +1 -1
  124. package/models/trace/insights/RenderBlocking.d.ts +14 -1
  125. package/models/trace/insights/RenderBlocking.js +14 -1
  126. package/models/trace/insights/RenderBlocking.js.map +1 -1
  127. package/models/trace/insights/SlowCSSSelector.d.ts +27 -2
  128. package/models/trace/insights/SlowCSSSelector.js +27 -2
  129. package/models/trace/insights/SlowCSSSelector.js.map +1 -1
  130. package/models/trace/insights/ThirdParties.d.ts +13 -4
  131. package/models/trace/insights/ThirdParties.js +21 -12
  132. package/models/trace/insights/ThirdParties.js.map +1 -1
  133. package/models/trace/insights/Viewport.d.ts +2 -1
  134. package/models/trace/insights/Viewport.js +2 -1
  135. package/models/trace/insights/Viewport.js.map +1 -1
  136. package/models/trace/insights/insights-tsconfig.json +2 -0
  137. package/models/trace/insights/types.d.ts +27 -8
  138. package/models/trace/insights/types.js.map +1 -1
  139. package/models/trace/lantern/graph/BaseNode.d.ts +1 -1
  140. package/models/trace/lantern/graph/BaseNode.js +1 -1
  141. package/models/trace/lantern/graph/BaseNode.js.map +1 -1
  142. package/models/trace/lantern/graph/CPUNode.d.ts +1 -1
  143. package/models/trace/lantern/graph/CPUNode.js.map +1 -1
  144. package/models/trace/lantern/graph/NetworkNode.d.ts +1 -1
  145. package/models/trace/lantern/graph/NetworkNode.js.map +1 -1
  146. package/models/trace/lantern/metrics/FirstContentfulPaint.d.ts +1 -1
  147. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -1
  148. package/models/trace/lantern/simulation/ConnectionPool.js +1 -1
  149. package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -1
  150. package/models/trace/lantern/simulation/Simulator.d.ts +2 -2
  151. package/models/trace/lantern/simulation/Simulator.js +3 -3
  152. package/models/trace/lantern/simulation/Simulator.js.map +1 -1
  153. package/models/trace/lantern/types/Lantern.d.ts +2 -2
  154. package/models/trace/lantern/types/Lantern.js.map +1 -1
  155. package/models/trace/root-causes/LayoutShift.d.ts +1 -1
  156. package/models/trace/root-causes/LayoutShift.js +4 -4
  157. package/models/trace/root-causes/LayoutShift.js.map +1 -1
  158. package/models/trace/types/Configuration.d.ts +15 -0
  159. package/models/trace/types/Configuration.js.map +1 -1
  160. package/models/trace/types/File.d.ts +4 -4
  161. package/models/trace/types/File.js.map +1 -1
  162. package/models/trace/types/Timing.d.ts +7 -13
  163. package/models/trace/types/Timing.js +5 -2
  164. package/models/trace/types/Timing.js.map +1 -1
  165. package/models/trace/types/TraceEvents.d.ts +145 -110
  166. package/models/trace/types/TraceEvents.js +9 -7
  167. package/models/trace/types/TraceEvents.js.map +1 -1
  168. package/package.json +1 -1
  169. package/test/test-trace-engine.mjs +18 -14
  170. package/core/platform/PromiseUtilities.d.ts +0 -10
  171. package/core/platform/PromiseUtilities.js +0 -18
  172. package/core/platform/PromiseUtilities.js.map +0 -1
  173. package/core/platform/SetUtilities.d.ts +0 -2
  174. package/core/platform/SetUtilities.js +0 -23
  175. package/core/platform/SetUtilities.js.map +0 -1
  176. package/models/trace/EntriesFilter.d.ts +0 -72
  177. package/models/trace/EntriesFilter.js +0 -296
  178. package/models/trace/EntriesFilter.js.map +0 -1
  179. package/models/trace/LegacyTracingModel.js.map +0 -1
  180. package/models/trace/extras/URLForEntry.d.ts +0 -13
  181. package/models/trace/extras/URLForEntry.js +0 -44
  182. package/models/trace/extras/URLForEntry.js.map +0 -1
  183. package/models/trace/handlers/EnhancedTracesHandler.d.ts +0 -48
  184. package/models/trace/handlers/EnhancedTracesHandler.js +0 -165
  185. package/models/trace/handlers/EnhancedTracesHandler.js.map +0 -1
  186. package/models/trace/insights/CumulativeLayoutShift.d.ts +0 -34
  187. package/models/trace/insights/CumulativeLayoutShift.js +0 -209
  188. package/models/trace/insights/CumulativeLayoutShift.js.map +0 -1
  189. package/models/trace/insights/InsightRunners.d.ts +0 -6
  190. package/models/trace/insights/InsightRunners.js +0 -10
  191. package/models/trace/insights/InsightRunners.js.map +0 -1
  192. package/models/trace/insights/LargestContentfulPaint.d.ts +0 -25
  193. package/models/trace/insights/LargestContentfulPaint.js +0 -93
  194. package/models/trace/insights/LargestContentfulPaint.js.map +0 -1
  195. package/models/trace/lantern/BaseNode.d.ts +0 -91
  196. package/models/trace/lantern/BaseNode.js +0 -268
  197. package/models/trace/lantern/BaseNode.js.map +0 -1
  198. package/models/trace/lantern/CPUNode.d.ts +0 -24
  199. package/models/trace/lantern/CPUNode.js +0 -64
  200. package/models/trace/lantern/CPUNode.js.map +0 -1
  201. package/models/trace/lantern/LanternError.d.ts +0 -3
  202. package/models/trace/lantern/LanternError.js +0 -7
  203. package/models/trace/lantern/LanternError.js.map +0 -1
  204. package/models/trace/lantern/MetricsModule.d.ts +0 -11
  205. package/models/trace/lantern/MetricsModule.js +0 -14
  206. package/models/trace/lantern/MetricsModule.js.map +0 -1
  207. package/models/trace/lantern/NetworkNode.d.ts +0 -22
  208. package/models/trace/lantern/NetworkNode.js +0 -83
  209. package/models/trace/lantern/NetworkNode.js.map +0 -1
  210. package/models/trace/lantern/PageDependencyGraph.d.ts +0 -43
  211. package/models/trace/lantern/PageDependencyGraph.js +0 -509
  212. package/models/trace/lantern/PageDependencyGraph.js.map +0 -1
  213. package/models/trace/lantern/SimulationModule.d.ts +0 -17
  214. package/models/trace/lantern/SimulationModule.js +0 -13
  215. package/models/trace/lantern/SimulationModule.js.map +0 -1
  216. package/models/trace/lantern/simulation/NetworkAnalyzer.d.ts +0 -112
  217. package/models/trace/lantern/simulation/NetworkAnalyzer.js +0 -486
  218. package/models/trace/lantern/simulation/NetworkAnalyzer.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  import * as Types from '../types/types.js';
5
5
  import { milliToMicro } from './Timing.js';
6
- import { makeProfileCall, mergeEventsInOrder } from './Trace.js';
6
+ import { extractSampleTraceId, makeProfileCall, mergeEventsInOrder } from './Trace.js';
7
7
  /**
8
8
  * This is a helper that integrates CPU profiling data coming in the
9
9
  * shape of samples, with trace events. Samples indicate what the JS
@@ -27,7 +27,7 @@ import { makeProfileCall, mergeEventsInOrder } from './Trace.js';
27
27
  * the duration of the calls in the tracking stack.
28
28
  *
29
29
  * note: Although this approach has been implemented since long ago, and
30
- * is relatively efficent (adds a complexity over the trace parsing of
30
+ * is relatively efficient (adds a complexity over the trace parsing of
31
31
  * O(n) where n is the number of samples) it has proven to be faulty.
32
32
  * It might be worthwhile experimenting with improvements or with a
33
33
  * completely different approach. Improving the approach is tracked in
@@ -35,7 +35,7 @@ import { makeProfileCall, mergeEventsInOrder } from './Trace.js';
35
35
  */
36
36
  export class SamplesIntegrator {
37
37
  /**
38
- * The result of runing the samples integrator. Holds the JS calls
38
+ * The result of running the samples integrator. Holds the JS calls
39
39
  * with their approximated duration after integrating samples into the
40
40
  * trace event tree.
41
41
  */
@@ -65,6 +65,12 @@ export class SamplesIntegrator {
65
65
  * in the stack before the event came.
66
66
  */
67
67
  #lockedJsStackDepth = [];
68
+ /**
69
+ * For samples with a trace id, creates a profile call and keeps it
70
+ * in a record keyed by that id. The value is typed as an union with
71
+ * undefined to avoid nullish accesses when a key is not present.
72
+ */
73
+ #callsByTraceIds = {};
68
74
  /**
69
75
  * Used to keep track when samples should be integrated even if they
70
76
  * are not children of invocation trace events. This is useful in
@@ -202,7 +208,7 @@ export class SamplesIntegrator {
202
208
  // Because the event has ended, any frames that happened after
203
209
  // this event are terminated. Frames that are ancestors to this
204
210
  // event are extended to cover its ending.
205
- const endTime = Types.Timing.MicroSeconds(event.ts + (event.dur ?? 0));
211
+ const endTime = Types.Timing.Micro(event.ts + (event.dur ?? 0));
206
212
  this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, endTime);
207
213
  }
208
214
  /**
@@ -222,14 +228,23 @@ export class SamplesIntegrator {
222
228
  let prevNode;
223
229
  for (let i = 0; i < samples.length; i++) {
224
230
  const node = this.#profileModel.nodeByIndex(i);
225
- const timestamp = milliToMicro(Types.Timing.MilliSeconds(timestamps[i]));
231
+ const timestamp = milliToMicro(Types.Timing.Milli(timestamps[i]));
226
232
  if (!node) {
227
233
  continue;
228
234
  }
235
+ const maybeTraceId = this.#profileModel.traceIds?.[i];
229
236
  const call = makeProfileCall(node, this.#profileId, i, timestamp, this.#processId, this.#threadId);
230
- calls.push(call);
237
+ // Separate samples with trace ids so that they are only used when
238
+ // processing the owner event.
239
+ if (maybeTraceId === undefined) {
240
+ calls.push(call);
241
+ }
242
+ else {
243
+ this.#callsByTraceIds[maybeTraceId] = call;
244
+ }
231
245
  if (debugModeEnabled) {
232
- this.jsSampleEvents.push(this.#makeJSSampleEvent(call, timestamp));
246
+ const traceId = this.#profileModel.traceIds?.[i];
247
+ this.jsSampleEvents.push(this.#makeJSSampleEvent(call, timestamp, traceId));
233
248
  }
234
249
  if (node.id === this.#profileModel.gcNode?.id && prevNode) {
235
250
  // GC samples have no stack, so we just put GC node on top of the
@@ -242,7 +257,21 @@ export class SamplesIntegrator {
242
257
  }
243
258
  return calls;
244
259
  }
245
- #makeProfileCallsForStack(profileCall) {
260
+ /**
261
+ * Given a synthetic profile call, returns an array of profile calls
262
+ * representing the stack trace that profile call belongs to based on
263
+ * its nodeId. The input profile call will be at the top of the
264
+ * returned stack (last position), meaning that any other frames that
265
+ * were effectively above it are omitted.
266
+ * @param profileCall
267
+ * @param overrideTimeStamp a custom timestamp to use for the returned
268
+ * profile calls. If not defined, the timestamp of the input
269
+ * profileCall is used instead. This param is useful for example when
270
+ * creating the profile calls for a sample with a trace id, since the
271
+ * timestamp of the corresponding trace event should be used instead
272
+ * of the sample's.
273
+ */
274
+ #makeProfileCallsForStack(profileCall, overrideTimeStamp) {
246
275
  let node = this.#profileModel.nodeById(profileCall.nodeId);
247
276
  const isGarbageCollection = node?.id === this.#profileModel.gcNode?.id;
248
277
  if (isGarbageCollection) {
@@ -265,7 +294,7 @@ export class SamplesIntegrator {
265
294
  // Many of these ProfileCalls will be GC'd later when we estimate the frame
266
295
  // durations
267
296
  while (node) {
268
- callFrames[i--] = makeProfileCall(node, profileCall.profileId, profileCall.sampleIndex, profileCall.ts, this.#processId, this.#threadId);
297
+ callFrames[i--] = makeProfileCall(node, profileCall.profileId, profileCall.sampleIndex, overrideTimeStamp ?? profileCall.ts, this.#processId, this.#threadId);
269
298
  node = node.parent;
270
299
  }
271
300
  return callFrames;
@@ -274,7 +303,17 @@ export class SamplesIntegrator {
274
303
  * Update tracked stack using this event's call stack.
275
304
  */
276
305
  #extractStackTrace(event) {
277
- const stackTrace = Types.Events.isProfileCall(event) ? this.#makeProfileCallsForStack(event) : this.#currentJSStack;
306
+ let stackTrace = this.#currentJSStack;
307
+ if (Types.Events.isProfileCall(event)) {
308
+ stackTrace = this.#makeProfileCallsForStack(event);
309
+ }
310
+ const traceId = extractSampleTraceId(event);
311
+ if (traceId !== null) {
312
+ const maybeCallForTraceId = this.#callsByTraceIds[traceId];
313
+ if (maybeCallForTraceId) {
314
+ stackTrace = this.#makeProfileCallsForStack(maybeCallForTraceId, event.ts);
315
+ }
316
+ }
278
317
  SamplesIntegrator.filterStackFrames(stackTrace, this.#engineConfig);
279
318
  const endTime = event.ts + (event.dur || 0);
280
319
  const minFrames = Math.min(stackTrace.length, this.#currentJSStack.length);
@@ -302,7 +341,7 @@ export class SamplesIntegrator {
302
341
  }
303
342
  // Scoot the right edge of this callFrame to the right
304
343
  this.#currentJSStack[i].dur =
305
- Types.Timing.MicroSeconds(Math.max(this.#currentJSStack[i].dur || 0, endTime - this.#currentJSStack[i].ts));
344
+ Types.Timing.Micro(Math.max(this.#currentJSStack[i].dur || 0, endTime - this.#currentJSStack[i].ts));
306
345
  }
307
346
  // If there are call frames in the sample that differ with the stack
308
347
  // we have, update the stack, but keeping the common frames in place
@@ -359,20 +398,20 @@ export class SamplesIntegrator {
359
398
  depth = this.#currentJSStack.length;
360
399
  }
361
400
  for (let k = 0; k < this.#currentJSStack.length; ++k) {
362
- this.#currentJSStack[k].dur = Types.Timing.MicroSeconds(Math.max(time - this.#currentJSStack[k].ts, 0));
401
+ this.#currentJSStack[k].dur = Types.Timing.Micro(Math.max(time - this.#currentJSStack[k].ts, 0));
363
402
  }
364
403
  this.#currentJSStack.length = depth;
365
404
  }
366
- #makeJSSampleEvent(call, timestamp) {
405
+ #makeJSSampleEvent(call, timestamp, traceId) {
367
406
  const JSSampleEvent = {
368
407
  name: "JSSample" /* Types.Events.Name.JS_SAMPLE */,
369
408
  cat: 'devtools.timeline',
370
409
  args: {
371
- data: { stackTrace: this.#makeProfileCallsForStack(call).map(e => e.callFrame) },
410
+ data: { traceId, stackTrace: this.#makeProfileCallsForStack(call).map(e => e.callFrame) },
372
411
  },
373
412
  ph: "I" /* Types.Events.Phase.INSTANT */,
374
413
  ts: timestamp,
375
- dur: Types.Timing.MicroSeconds(0),
414
+ dur: Types.Timing.Micro(0),
376
415
  pid: this.#processId,
377
416
  tid: this.#threadId,
378
417
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SamplesIntegrator.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/helpers/SamplesIntegrator.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;;OAIG;IACH,wBAAwB,GAAwC,EAAE,CAAC;IACnE;;;;;;OAMG;IACH,eAAe,GAAwC,EAAE,CAAC;IAC1D;;OAEG;IACH,UAAU,CAAyB;IACnC;;OAEG;IACH,SAAS,CAAwB;IACjC;;;;;;;OAOG;IACH,mBAAmB,GAAa,EAAE,CAAC;IACnC;;;;;OAKG;IACH,iBAAiB,GAAG,KAAK,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAqD;IAClE;;;;;;;;OAQG;IACH,UAAU,GAAG,IAAI,GAAG,EAA8E,CAAC;IAEnG,aAAa,CAAoC;IACjD,UAAU,CAAyB;IAEnC;;;OAGG;IACH,cAAc,GAAqC,EAAE,CAAC;IAEtD,YACI,YAAgE,EAAE,SAAiC,EACnG,GAA2B,EAAE,GAA0B,EAAE,aAAiD;QAC5G,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;QACrE,IAAI,CAAC,UAAU,GAAG,SAAS,CA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CAAC;YAClB,OAAO;QACT,CAAC;QACD,IAAI,uBAAuB,GAAgB,IAAI,CAAC;QAChD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACjC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YACzE,IAAI,kBAAkB;gBAClB,CAAC,iBAAiB,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,uBAAuB,CAAC,EAAE,CAAC;gBAChG,SAAS;YACX,CAAC;YACD,MAAM,eAAe,GAAG,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACtG,IAAI,uBAAuB,IAAI,uBAAuB,KAAK,eAAe,EAAE,CAAC;gBAC3E,SAAS;YACX,CAAC;YACD,uBAAuB,GAAG,eAAe,CAAC;YAC1C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QACD,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACnB,CAAC;CACF","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../generated/protocol.js';\nimport type * as CPUProfile from '../../cpu_profile/cpu_profile.js';\nimport * as Types from '../types/types.js';\n\nimport {milliToMicro} from './Timing.js';\nimport {makeProfileCall, mergeEventsInOrder} from './Trace.js';\n\n/**\n * This is a helper that integrates CPU profiling data coming in the\n * shape of samples, with trace events. Samples indicate what the JS\n * stack trace looked at a given point in time, but they don't have\n * duration. The SamplesIntegrator task is to make an approximation\n * of what the duration of each JS call was, given the sample data and\n * given the trace events profiled during that time. At the end of its\n * execution, the SamplesIntegrator returns an array of ProfileCalls\n * (under SamplesIntegrator::buildProfileCalls()), which\n * represent JS calls, with a call frame and duration. These calls have\n * the shape of a complete trace events and can be treated as flame\n * chart entries in the timeline.\n *\n * The approach to build the profile calls consists in tracking the\n * current stack as the following events happen (in order):\n * 1. A sample was done.\n * 2. A trace event started.\n * 3. A trace event ended.\n * Depending on the event and on the data that's coming with it the\n * stack is updated by adding or removing JS calls to it and updating\n * the duration of the calls in the tracking stack.\n *\n * note: Although this approach has been implemented since long ago, and\n * is relatively efficent (adds a complexity over the trace parsing of\n * O(n) where n is the number of samples) it has proven to be faulty.\n * It might be worthwhile experimenting with improvements or with a\n * completely different approach. Improving the approach is tracked in\n * crbug.com/1417439\n */\nexport class SamplesIntegrator {\n /**\n * The result of runing the samples integrator. Holds the JS calls\n * with their approximated duration after integrating samples into the\n * trace event tree.\n */\n #constructedProfileCalls: Types.Events.SyntheticProfileCall[] = [];\n /**\n * tracks the state of the JS stack at each point in time to update\n * the profile call durations as new events arrive. This doesn't only\n * happen with new profile calls (in which case we would compare the\n * stack in them) but also with trace events (in which case we would\n * update the duration of the events we are tracking at the moment).\n */\n #currentJSStack: Types.Events.SyntheticProfileCall[] = [];\n /**\n * Process holding the CPU profile and trace events.\n */\n #processId: Types.Events.ProcessID;\n /**\n * Thread holding the CPU profile and trace events.\n */\n #threadId: Types.Events.ThreadID;\n /**\n * Tracks the depth of the JS stack at the moment a trace event starts\n * or ends. It is assumed that for the duration of a trace event, the\n * JS stack's depth cannot decrease, since JS calls that started\n * before a trace event cannot end during the trace event. So as trace\n * events arrive, we store the \"locked\" amount of JS frames that were\n * in the stack before the event came.\n */\n #lockedJsStackDepth: number[] = [];\n /**\n * Used to keep track when samples should be integrated even if they\n * are not children of invocation trace events. This is useful in\n * cases where we can be missing the start of JS invocation events if\n * we start tracing half-way through.\n */\n #fakeJSInvocation = false;\n /**\n * The parsed CPU profile, holding the tree hierarchy of JS frames and\n * the sample data.\n */\n #profileModel: CPUProfile.CPUProfileDataModel.CPUProfileDataModel;\n /**\n * Because GC nodes don't have a stack, we artificially add a stack to\n * them which corresponds to that of the previous sample. This map\n * tracks which node is used for the stack of a GC call.\n * Note that GC samples are not shown in the flamechart, however they\n * are used during the construction of for profile calls, as we can\n * infer information about the duration of the executed code when a\n * GC node is sampled.\n */\n #nodeForGC = new Map<Types.Events.SyntheticProfileCall, CPUProfile.ProfileTreeModel.ProfileNode>();\n\n #engineConfig: Types.Configuration.Configuration;\n #profileId: Types.Events.ProfileID;\n\n /**\n * Keeps track of the individual samples from the CPU Profile.\n * Only used with Debug Mode experiment enabled.\n */\n jsSampleEvents: Types.Events.SyntheticJSSample[] = [];\n\n constructor(\n profileModel: CPUProfile.CPUProfileDataModel.CPUProfileDataModel, profileId: Types.Events.ProfileID,\n pid: Types.Events.ProcessID, tid: Types.Events.ThreadID, configuration?: Types.Configuration.Configuration) {\n this.#profileModel = profileModel;\n this.#threadId = tid;\n this.#processId = pid;\n this.#engineConfig = configuration || Types.Configuration.defaults();\n this.#profileId = profileId;\n }\n\n buildProfileCalls(traceEvents: Types.Events.Event[]): Types.Events.SyntheticProfileCall[] {\n const mergedEvents = mergeEventsInOrder(traceEvents, this.callsFromProfileSamples());\n const stack = [];\n for (let i = 0; i < mergedEvents.length; i++) {\n const event = mergedEvents[i];\n // Because instant trace events have no duration, they don't provide\n // useful information for possible changes in the duration of calls\n // in the JS stack.\n if (event.ph === Types.Events.Phase.INSTANT) {\n continue;\n }\n if (stack.length === 0) {\n if (Types.Events.isProfileCall(event)) {\n this.#onProfileCall(event);\n continue;\n }\n stack.push(event);\n this.#onTraceEventStart(event);\n continue;\n }\n\n const parentEvent = stack.at(-1);\n if (parentEvent === undefined) {\n continue;\n }\n const begin = event.ts;\n const parentBegin = parentEvent.ts;\n const parentDuration = parentEvent.dur || 0;\n const parentEnd = parentBegin + parentDuration;\n\n const startsAfterParent = begin >= parentEnd;\n if (startsAfterParent) {\n this.#onTraceEventEnd(parentEvent);\n stack.pop();\n i--;\n continue;\n }\n if (Types.Events.isProfileCall(event)) {\n this.#onProfileCall(event, parentEvent);\n continue;\n }\n this.#onTraceEventStart(event);\n stack.push(event);\n }\n while (stack.length) {\n const last = stack.pop();\n if (last) {\n this.#onTraceEventEnd(last);\n }\n }\n return this.#constructedProfileCalls;\n }\n\n #onTraceEventStart(event: Types.Events.Event): void {\n // Top level events cannot be nested into JS frames so we reset\n // the stack when we find one.\n if (event.name === Types.Events.Name.RUN_MICROTASKS || event.name === Types.Events.Name.RUN_TASK) {\n this.#lockedJsStackDepth = [];\n this.#truncateJSStack(0, event.ts);\n this.#fakeJSInvocation = false;\n }\n\n if (this.#fakeJSInvocation) {\n this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, event.ts);\n this.#fakeJSInvocation = false;\n }\n this.#extractStackTrace(event);\n // Keep track of the call frames in the stack before the event\n // happened. For the duration of this event, these frames cannot\n // change (none can be terminated before this event finishes).\n //\n // Also, every frame that is opened after this event, is considered\n // to be a descendant of the event. So once the event finishes, the\n // frames that were opened after it, need to be closed (see\n // onEndEvent).\n //\n // TODO(crbug.com/1417439):\n // The assumption that every frame opened after an event is a\n // descendant of the event is incorrect. For example, a JS call that\n // parents a trace event might have been sampled after the event was\n // dispatched. In this case the JS call would be discarded if this\n // event isn't an invocation event, otherwise the call will be\n // considered a child of the event. In both cases, the result would\n // be incorrect.\n this.#lockedJsStackDepth.push(this.#currentJSStack.length);\n }\n\n #onProfileCall(event: Types.Events.SyntheticProfileCall, parent?: Types.Events.Event): void {\n if ((parent && Types.Events.isJSInvocationEvent(parent)) || this.#fakeJSInvocation) {\n this.#extractStackTrace(event);\n } else if (Types.Events.isProfileCall(event) && this.#currentJSStack.length === 0) {\n // Force JS Samples to show up even if we are not inside a JS\n // invocation event, because we can be missing the start of JS\n // invocation events if we start tracing half-way through. Pretend\n // we have a top-level JS invocation event.\n this.#fakeJSInvocation = true;\n const stackDepthBefore = this.#currentJSStack.length;\n this.#extractStackTrace(event);\n this.#lockedJsStackDepth.push(stackDepthBefore);\n }\n }\n\n #onTraceEventEnd(event: Types.Events.Event): void {\n // Because the event has ended, any frames that happened after\n // this event are terminated. Frames that are ancestors to this\n // event are extended to cover its ending.\n const endTime = Types.Timing.MicroSeconds(event.ts + (event.dur ?? 0));\n this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, endTime);\n }\n\n /**\n * Builds the initial calls with no duration from samples. Their\n * purpose is to be merged with the trace event array being parsed so\n * that they can be traversed in order with them and their duration\n * can be updated as the SampleIntegrator callbacks are invoked.\n */\n callsFromProfileSamples(): Types.Events.SyntheticProfileCall[] {\n const samples = this.#profileModel.samples;\n const timestamps = this.#profileModel.timestamps;\n const debugModeEnabled = this.#engineConfig.debugMode;\n if (!samples) {\n return [];\n }\n const calls: Types.Events.SyntheticProfileCall[] = [];\n let prevNode;\n for (let i = 0; i < samples.length; i++) {\n const node = this.#profileModel.nodeByIndex(i);\n const timestamp = milliToMicro(Types.Timing.MilliSeconds(timestamps[i]));\n if (!node) {\n continue;\n }\n const call = makeProfileCall(node, this.#profileId, i, timestamp, this.#processId, this.#threadId);\n calls.push(call);\n\n if (debugModeEnabled) {\n this.jsSampleEvents.push(this.#makeJSSampleEvent(call, timestamp));\n }\n if (node.id === this.#profileModel.gcNode?.id && prevNode) {\n // GC samples have no stack, so we just put GC node on top of the\n // last recorded sample. Cache the previous sample for future\n // reference.\n this.#nodeForGC.set(call, prevNode);\n continue;\n }\n prevNode = node;\n }\n return calls;\n }\n\n #makeProfileCallsForStack(profileCall: Types.Events.SyntheticProfileCall): Types.Events.SyntheticProfileCall[] {\n let node = this.#profileModel.nodeById(profileCall.nodeId);\n const isGarbageCollection = node?.id === this.#profileModel.gcNode?.id;\n if (isGarbageCollection) {\n // Because GC don't have a stack, we use the stack of the previous\n // sample.\n node = this.#nodeForGC.get(profileCall) || null;\n }\n if (!node) {\n return [];\n }\n // `node.depth` is 0 based, so to set the size of the array we need\n // to add 1 to its value.\n const callFrames = new Array<Types.Events.SyntheticProfileCall>(node.depth + 1 + Number(isGarbageCollection));\n // Add the stack trace in reverse order (bottom first).\n let i = callFrames.length - 1;\n if (isGarbageCollection) {\n // Place the garbage collection call frame on top of the stack.\n callFrames[i--] = profileCall;\n }\n\n // Many of these ProfileCalls will be GC'd later when we estimate the frame\n // durations\n while (node) {\n callFrames[i--] = makeProfileCall(\n node, profileCall.profileId, profileCall.sampleIndex, profileCall.ts, this.#processId, this.#threadId);\n node = node.parent;\n }\n return callFrames;\n }\n\n /**\n * Update tracked stack using this event's call stack.\n */\n #extractStackTrace(event: Types.Events.Event): void {\n const stackTrace = Types.Events.isProfileCall(event) ? this.#makeProfileCallsForStack(event) : this.#currentJSStack;\n SamplesIntegrator.filterStackFrames(stackTrace, this.#engineConfig);\n\n const endTime = event.ts + (event.dur || 0);\n const minFrames = Math.min(stackTrace.length, this.#currentJSStack.length);\n let i;\n // Merge a sample's stack frames with the stack frames we have\n // so far if we detect they are equivalent.\n // Graphically\n // This:\n // Current stack trace Sample\n // [-------A------] [A]\n // [-------B------] [B]\n // [-------C------] [C]\n // ^ t = x1 ^ t = x2\n\n // Becomes this:\n // New stack trace after merge\n // [--------A-------]\n // [--------B-------]\n // [--------C-------]\n // ^ t = x2\n for (i = this.#lockedJsStackDepth.at(-1) || 0; i < minFrames; ++i) {\n const newFrame = stackTrace[i].callFrame;\n const oldFrame = this.#currentJSStack[i].callFrame;\n if (!SamplesIntegrator.framesAreEqual(newFrame, oldFrame)) {\n break;\n }\n // Scoot the right edge of this callFrame to the right\n this.#currentJSStack[i].dur =\n Types.Timing.MicroSeconds(Math.max(this.#currentJSStack[i].dur || 0, endTime - this.#currentJSStack[i].ts));\n }\n\n // If there are call frames in the sample that differ with the stack\n // we have, update the stack, but keeping the common frames in place\n // Graphically\n // This:\n // Current stack trace Sample\n // [-------A------] [A]\n // [-------B------] [B]\n // [-------C------] [C]\n // [-------D------] [E]\n // ^ t = x1 ^ t = x2\n // Becomes this:\n // New stack trace after merge\n // [--------A-------]\n // [--------B-------]\n // [--------C-------]\n // [E]\n // ^ t = x2\n this.#truncateJSStack(i, event.ts);\n\n for (; i < stackTrace.length; ++i) {\n const call = stackTrace[i];\n if (call.nodeId === this.#profileModel.programNode?.id || call.nodeId === this.#profileModel.root?.id ||\n call.nodeId === this.#profileModel.idleNode?.id || call.nodeId === this.#profileModel.gcNode?.id) {\n // Skip (root), (program) and (idle) frames, since this are not\n // relevant for web profiling and we don't want to show them in\n // the timeline.\n continue;\n }\n this.#currentJSStack.push(call);\n this.#constructedProfileCalls.push(call);\n }\n }\n\n /**\n * When a call stack that differs from the one we are tracking has\n * been detected in the samples, the latter is \"truncated\" by\n * setting the ending time of its call frames and removing the top\n * call frames that aren't shared with the new call stack. This way,\n * we can update the tracked stack with the new call frames on top.\n * @param depth the amount of call frames from bottom to top that\n * should be kept in the tracking stack trace. AKA amount of shared\n * call frames between two stacks.\n * @param time the new end of the call frames in the stack.\n */\n #truncateJSStack(depth: number, time: Types.Timing.MicroSeconds): void {\n if (this.#lockedJsStackDepth.length) {\n const lockedDepth = this.#lockedJsStackDepth.at(-1);\n if (lockedDepth && depth < lockedDepth) {\n console.error(`Child stack is shallower (${depth}) than the parent stack (${lockedDepth}) at ${time}`);\n depth = lockedDepth;\n }\n }\n if (this.#currentJSStack.length < depth) {\n console.error(`Trying to truncate higher than the current stack size at ${time}`);\n depth = this.#currentJSStack.length;\n }\n for (let k = 0; k < this.#currentJSStack.length; ++k) {\n this.#currentJSStack[k].dur = Types.Timing.MicroSeconds(Math.max(time - this.#currentJSStack[k].ts, 0));\n }\n this.#currentJSStack.length = depth;\n }\n\n #makeJSSampleEvent(call: Types.Events.SyntheticProfileCall, timestamp: Types.Timing.MicroSeconds):\n Types.Events.SyntheticJSSample {\n const JSSampleEvent: Types.Events.SyntheticJSSample = {\n name: Types.Events.Name.JS_SAMPLE,\n cat: 'devtools.timeline',\n args: {\n data: {stackTrace: this.#makeProfileCallsForStack(call).map(e => e.callFrame)},\n },\n ph: Types.Events.Phase.INSTANT,\n ts: timestamp,\n dur: Types.Timing.MicroSeconds(0),\n pid: this.#processId,\n tid: this.#threadId,\n };\n return JSSampleEvent;\n }\n\n static framesAreEqual(frame1: Protocol.Runtime.CallFrame, frame2: Protocol.Runtime.CallFrame): boolean {\n return frame1.scriptId === frame2.scriptId && frame1.functionName === frame2.functionName &&\n frame1.lineNumber === frame2.lineNumber;\n }\n\n static showNativeName(name: string, runtimeCallStatsEnabled: boolean): boolean {\n return runtimeCallStatsEnabled && Boolean(SamplesIntegrator.nativeGroup(name));\n }\n\n static nativeGroup(nativeName: string): 'Parse'|'Compile'|null {\n if (nativeName.startsWith('Parse')) {\n return 'Parse';\n }\n if (nativeName.startsWith('Compile') || nativeName.startsWith('Recompile')) {\n return 'Compile';\n }\n return null;\n }\n\n static isNativeRuntimeFrame(frame: Protocol.Runtime.CallFrame): boolean {\n return frame.url === 'native V8Runtime';\n }\n\n static filterStackFrames(stack: Types.Events.SyntheticProfileCall[], engineConfig: Types.Configuration.Configuration):\n void {\n const showAllEvents = engineConfig.showAllEvents;\n if (showAllEvents) {\n return;\n }\n let previousNativeFrameName: string|null = null;\n let j = 0;\n for (let i = 0; i < stack.length; ++i) {\n const frame = stack[i].callFrame;\n const nativeRuntimeFrame = SamplesIntegrator.isNativeRuntimeFrame(frame);\n if (nativeRuntimeFrame &&\n !SamplesIntegrator.showNativeName(frame.functionName, engineConfig.includeRuntimeCallStats)) {\n continue;\n }\n const nativeFrameName = nativeRuntimeFrame ? SamplesIntegrator.nativeGroup(frame.functionName) : null;\n if (previousNativeFrameName && previousNativeFrameName === nativeFrameName) {\n continue;\n }\n previousNativeFrameName = nativeFrameName;\n stack[j++] = stack[i];\n }\n stack.length = j;\n }\n}\n"]}
1
+ {"version":3,"file":"SamplesIntegrator.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/helpers/SamplesIntegrator.ts"],"names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CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YACtG,IAAI,uBAAuB,IAAI,uBAAuB,KAAK,eAAe,EAAE,CAAC;gBAC3E,SAAS;YACX,CAAC;YACD,uBAAuB,GAAG,eAAe,CAAC;YAC1C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QACD,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACnB,CAAC;CACF","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Protocol from '../../../generated/protocol.js';\nimport type * as CPUProfile from '../../cpu_profile/cpu_profile.js';\nimport * as Types from '../types/types.js';\n\nimport {milliToMicro} from './Timing.js';\nimport {extractSampleTraceId, makeProfileCall, mergeEventsInOrder} from './Trace.js';\n\n/**\n * This is a helper that integrates CPU profiling data coming in the\n * shape of samples, with trace events. Samples indicate what the JS\n * stack trace looked at a given point in time, but they don't have\n * duration. The SamplesIntegrator task is to make an approximation\n * of what the duration of each JS call was, given the sample data and\n * given the trace events profiled during that time. At the end of its\n * execution, the SamplesIntegrator returns an array of ProfileCalls\n * (under SamplesIntegrator::buildProfileCalls()), which\n * represent JS calls, with a call frame and duration. These calls have\n * the shape of a complete trace events and can be treated as flame\n * chart entries in the timeline.\n *\n * The approach to build the profile calls consists in tracking the\n * current stack as the following events happen (in order):\n * 1. A sample was done.\n * 2. A trace event started.\n * 3. A trace event ended.\n * Depending on the event and on the data that's coming with it the\n * stack is updated by adding or removing JS calls to it and updating\n * the duration of the calls in the tracking stack.\n *\n * note: Although this approach has been implemented since long ago, and\n * is relatively efficient (adds a complexity over the trace parsing of\n * O(n) where n is the number of samples) it has proven to be faulty.\n * It might be worthwhile experimenting with improvements or with a\n * completely different approach. Improving the approach is tracked in\n * crbug.com/1417439\n */\nexport class SamplesIntegrator {\n /**\n * The result of running the samples integrator. Holds the JS calls\n * with their approximated duration after integrating samples into the\n * trace event tree.\n */\n #constructedProfileCalls: Types.Events.SyntheticProfileCall[] = [];\n /**\n * tracks the state of the JS stack at each point in time to update\n * the profile call durations as new events arrive. This doesn't only\n * happen with new profile calls (in which case we would compare the\n * stack in them) but also with trace events (in which case we would\n * update the duration of the events we are tracking at the moment).\n */\n #currentJSStack: Types.Events.SyntheticProfileCall[] = [];\n /**\n * Process holding the CPU profile and trace events.\n */\n #processId: Types.Events.ProcessID;\n /**\n * Thread holding the CPU profile and trace events.\n */\n #threadId: Types.Events.ThreadID;\n /**\n * Tracks the depth of the JS stack at the moment a trace event starts\n * or ends. It is assumed that for the duration of a trace event, the\n * JS stack's depth cannot decrease, since JS calls that started\n * before a trace event cannot end during the trace event. So as trace\n * events arrive, we store the \"locked\" amount of JS frames that were\n * in the stack before the event came.\n */\n #lockedJsStackDepth: number[] = [];\n /**\n * For samples with a trace id, creates a profile call and keeps it\n * in a record keyed by that id. The value is typed as an union with\n * undefined to avoid nullish accesses when a key is not present.\n */\n #callsByTraceIds: Record<number, Types.Events.SyntheticProfileCall|undefined> = {};\n /**\n * Used to keep track when samples should be integrated even if they\n * are not children of invocation trace events. This is useful in\n * cases where we can be missing the start of JS invocation events if\n * we start tracing half-way through.\n */\n #fakeJSInvocation = false;\n /**\n * The parsed CPU profile, holding the tree hierarchy of JS frames and\n * the sample data.\n */\n #profileModel: CPUProfile.CPUProfileDataModel.CPUProfileDataModel;\n /**\n * Because GC nodes don't have a stack, we artificially add a stack to\n * them which corresponds to that of the previous sample. This map\n * tracks which node is used for the stack of a GC call.\n * Note that GC samples are not shown in the flamechart, however they\n * are used during the construction of for profile calls, as we can\n * infer information about the duration of the executed code when a\n * GC node is sampled.\n */\n #nodeForGC = new Map<Types.Events.SyntheticProfileCall, CPUProfile.ProfileTreeModel.ProfileNode>();\n\n #engineConfig: Types.Configuration.Configuration;\n #profileId: Types.Events.ProfileID;\n\n /**\n * Keeps track of the individual samples from the CPU Profile.\n * Only used with Debug Mode experiment enabled.\n */\n jsSampleEvents: Types.Events.SyntheticJSSample[] = [];\n\n constructor(\n profileModel: CPUProfile.CPUProfileDataModel.CPUProfileDataModel, profileId: Types.Events.ProfileID,\n pid: Types.Events.ProcessID, tid: Types.Events.ThreadID, configuration?: Types.Configuration.Configuration) {\n this.#profileModel = profileModel;\n this.#threadId = tid;\n this.#processId = pid;\n this.#engineConfig = configuration || Types.Configuration.defaults();\n this.#profileId = profileId;\n }\n\n buildProfileCalls(traceEvents: Types.Events.Event[]): Types.Events.SyntheticProfileCall[] {\n const mergedEvents = mergeEventsInOrder(traceEvents, this.callsFromProfileSamples());\n const stack = [];\n for (let i = 0; i < mergedEvents.length; i++) {\n const event = mergedEvents[i];\n // Because instant trace events have no duration, they don't provide\n // useful information for possible changes in the duration of calls\n // in the JS stack.\n if (event.ph === Types.Events.Phase.INSTANT) {\n continue;\n }\n if (stack.length === 0) {\n if (Types.Events.isProfileCall(event)) {\n this.#onProfileCall(event);\n continue;\n }\n stack.push(event);\n this.#onTraceEventStart(event);\n continue;\n }\n\n const parentEvent = stack.at(-1);\n if (parentEvent === undefined) {\n continue;\n }\n const begin = event.ts;\n const parentBegin = parentEvent.ts;\n const parentDuration = parentEvent.dur || 0;\n const parentEnd = parentBegin + parentDuration;\n\n const startsAfterParent = begin >= parentEnd;\n if (startsAfterParent) {\n this.#onTraceEventEnd(parentEvent);\n stack.pop();\n i--;\n continue;\n }\n if (Types.Events.isProfileCall(event)) {\n this.#onProfileCall(event, parentEvent);\n continue;\n }\n this.#onTraceEventStart(event);\n stack.push(event);\n }\n while (stack.length) {\n const last = stack.pop();\n if (last) {\n this.#onTraceEventEnd(last);\n }\n }\n return this.#constructedProfileCalls;\n }\n\n #onTraceEventStart(event: Types.Events.Event): void {\n // Top level events cannot be nested into JS frames so we reset\n // the stack when we find one.\n if (event.name === Types.Events.Name.RUN_MICROTASKS || event.name === Types.Events.Name.RUN_TASK) {\n this.#lockedJsStackDepth = [];\n this.#truncateJSStack(0, event.ts);\n this.#fakeJSInvocation = false;\n }\n\n if (this.#fakeJSInvocation) {\n this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, event.ts);\n this.#fakeJSInvocation = false;\n }\n this.#extractStackTrace(event);\n // Keep track of the call frames in the stack before the event\n // happened. For the duration of this event, these frames cannot\n // change (none can be terminated before this event finishes).\n //\n // Also, every frame that is opened after this event, is considered\n // to be a descendant of the event. So once the event finishes, the\n // frames that were opened after it, need to be closed (see\n // onEndEvent).\n //\n // TODO(crbug.com/1417439):\n // The assumption that every frame opened after an event is a\n // descendant of the event is incorrect. For example, a JS call that\n // parents a trace event might have been sampled after the event was\n // dispatched. In this case the JS call would be discarded if this\n // event isn't an invocation event, otherwise the call will be\n // considered a child of the event. In both cases, the result would\n // be incorrect.\n this.#lockedJsStackDepth.push(this.#currentJSStack.length);\n }\n\n #onProfileCall(event: Types.Events.SyntheticProfileCall, parent?: Types.Events.Event): void {\n if ((parent && Types.Events.isJSInvocationEvent(parent)) || this.#fakeJSInvocation) {\n this.#extractStackTrace(event);\n } else if (Types.Events.isProfileCall(event) && this.#currentJSStack.length === 0) {\n // Force JS Samples to show up even if we are not inside a JS\n // invocation event, because we can be missing the start of JS\n // invocation events if we start tracing half-way through. Pretend\n // we have a top-level JS invocation event.\n this.#fakeJSInvocation = true;\n const stackDepthBefore = this.#currentJSStack.length;\n this.#extractStackTrace(event);\n this.#lockedJsStackDepth.push(stackDepthBefore);\n }\n }\n\n #onTraceEventEnd(event: Types.Events.Event): void {\n // Because the event has ended, any frames that happened after\n // this event are terminated. Frames that are ancestors to this\n // event are extended to cover its ending.\n const endTime = Types.Timing.Micro(event.ts + (event.dur ?? 0));\n this.#truncateJSStack(this.#lockedJsStackDepth.pop() || 0, endTime);\n }\n\n /**\n * Builds the initial calls with no duration from samples. Their\n * purpose is to be merged with the trace event array being parsed so\n * that they can be traversed in order with them and their duration\n * can be updated as the SampleIntegrator callbacks are invoked.\n */\n callsFromProfileSamples(): Types.Events.SyntheticProfileCall[] {\n const samples = this.#profileModel.samples;\n const timestamps = this.#profileModel.timestamps;\n const debugModeEnabled = this.#engineConfig.debugMode;\n if (!samples) {\n return [];\n }\n const calls: Types.Events.SyntheticProfileCall[] = [];\n let prevNode;\n for (let i = 0; i < samples.length; i++) {\n const node = this.#profileModel.nodeByIndex(i);\n const timestamp = milliToMicro(Types.Timing.Milli(timestamps[i]));\n if (!node) {\n continue;\n }\n const maybeTraceId = this.#profileModel.traceIds?.[i];\n const call = makeProfileCall(node, this.#profileId, i, timestamp, this.#processId, this.#threadId);\n // Separate samples with trace ids so that they are only used when\n // processing the owner event.\n if (maybeTraceId === undefined) {\n calls.push(call);\n } else {\n this.#callsByTraceIds[maybeTraceId] = call;\n }\n if (debugModeEnabled) {\n const traceId = this.#profileModel.traceIds?.[i];\n this.jsSampleEvents.push(this.#makeJSSampleEvent(call, timestamp, traceId));\n }\n if (node.id === this.#profileModel.gcNode?.id && prevNode) {\n // GC samples have no stack, so we just put GC node on top of the\n // last recorded sample. Cache the previous sample for future\n // reference.\n this.#nodeForGC.set(call, prevNode);\n continue;\n }\n prevNode = node;\n }\n return calls;\n }\n\n /**\n * Given a synthetic profile call, returns an array of profile calls\n * representing the stack trace that profile call belongs to based on\n * its nodeId. The input profile call will be at the top of the\n * returned stack (last position), meaning that any other frames that\n * were effectively above it are omitted.\n * @param profileCall\n * @param overrideTimeStamp a custom timestamp to use for the returned\n * profile calls. If not defined, the timestamp of the input\n * profileCall is used instead. This param is useful for example when\n * creating the profile calls for a sample with a trace id, since the\n * timestamp of the corresponding trace event should be used instead\n * of the sample's.\n */\n\n #makeProfileCallsForStack(profileCall: Types.Events.SyntheticProfileCall, overrideTimeStamp?: Types.Timing.Micro):\n Types.Events.SyntheticProfileCall[] {\n let node = this.#profileModel.nodeById(profileCall.nodeId);\n const isGarbageCollection = node?.id === this.#profileModel.gcNode?.id;\n if (isGarbageCollection) {\n // Because GC don't have a stack, we use the stack of the previous\n // sample.\n node = this.#nodeForGC.get(profileCall) || null;\n }\n if (!node) {\n return [];\n }\n // `node.depth` is 0 based, so to set the size of the array we need\n // to add 1 to its value.\n const callFrames = new Array<Types.Events.SyntheticProfileCall>(node.depth + 1 + Number(isGarbageCollection));\n // Add the stack trace in reverse order (bottom first).\n let i = callFrames.length - 1;\n if (isGarbageCollection) {\n // Place the garbage collection call frame on top of the stack.\n callFrames[i--] = profileCall;\n }\n\n // Many of these ProfileCalls will be GC'd later when we estimate the frame\n // durations\n while (node) {\n callFrames[i--] = makeProfileCall(\n node, profileCall.profileId, profileCall.sampleIndex, overrideTimeStamp ?? profileCall.ts, this.#processId,\n this.#threadId);\n node = node.parent;\n }\n return callFrames;\n }\n\n /**\n * Update tracked stack using this event's call stack.\n */\n #extractStackTrace(event: Types.Events.Event): void {\n let stackTrace = this.#currentJSStack;\n if (Types.Events.isProfileCall(event)) {\n stackTrace = this.#makeProfileCallsForStack(event);\n }\n const traceId = extractSampleTraceId(event);\n if (traceId !== null) {\n const maybeCallForTraceId = this.#callsByTraceIds[traceId];\n if (maybeCallForTraceId) {\n stackTrace = this.#makeProfileCallsForStack(maybeCallForTraceId, event.ts);\n }\n }\n\n SamplesIntegrator.filterStackFrames(stackTrace, this.#engineConfig);\n\n const endTime = event.ts + (event.dur || 0);\n const minFrames = Math.min(stackTrace.length, this.#currentJSStack.length);\n let i;\n // Merge a sample's stack frames with the stack frames we have\n // so far if we detect they are equivalent.\n // Graphically\n // This:\n // Current stack trace Sample\n // [-------A------] [A]\n // [-------B------] [B]\n // [-------C------] [C]\n // ^ t = x1 ^ t = x2\n\n // Becomes this:\n // New stack trace after merge\n // [--------A-------]\n // [--------B-------]\n // [--------C-------]\n // ^ t = x2\n for (i = this.#lockedJsStackDepth.at(-1) || 0; i < minFrames; ++i) {\n const newFrame = stackTrace[i].callFrame;\n const oldFrame = this.#currentJSStack[i].callFrame;\n if (!SamplesIntegrator.framesAreEqual(newFrame, oldFrame)) {\n break;\n }\n // Scoot the right edge of this callFrame to the right\n this.#currentJSStack[i].dur =\n Types.Timing.Micro(Math.max(this.#currentJSStack[i].dur || 0, endTime - this.#currentJSStack[i].ts));\n }\n\n // If there are call frames in the sample that differ with the stack\n // we have, update the stack, but keeping the common frames in place\n // Graphically\n // This:\n // Current stack trace Sample\n // [-------A------] [A]\n // [-------B------] [B]\n // [-------C------] [C]\n // [-------D------] [E]\n // ^ t = x1 ^ t = x2\n // Becomes this:\n // New stack trace after merge\n // [--------A-------]\n // [--------B-------]\n // [--------C-------]\n // [E]\n // ^ t = x2\n this.#truncateJSStack(i, event.ts);\n\n for (; i < stackTrace.length; ++i) {\n const call = stackTrace[i];\n if (call.nodeId === this.#profileModel.programNode?.id || call.nodeId === this.#profileModel.root?.id ||\n call.nodeId === this.#profileModel.idleNode?.id || call.nodeId === this.#profileModel.gcNode?.id) {\n // Skip (root), (program) and (idle) frames, since this are not\n // relevant for web profiling and we don't want to show them in\n // the timeline.\n continue;\n }\n this.#currentJSStack.push(call);\n this.#constructedProfileCalls.push(call);\n }\n }\n\n /**\n * When a call stack that differs from the one we are tracking has\n * been detected in the samples, the latter is \"truncated\" by\n * setting the ending time of its call frames and removing the top\n * call frames that aren't shared with the new call stack. This way,\n * we can update the tracked stack with the new call frames on top.\n * @param depth the amount of call frames from bottom to top that\n * should be kept in the tracking stack trace. AKA amount of shared\n * call frames between two stacks.\n * @param time the new end of the call frames in the stack.\n */\n #truncateJSStack(depth: number, time: Types.Timing.Micro): void {\n if (this.#lockedJsStackDepth.length) {\n const lockedDepth = this.#lockedJsStackDepth.at(-1);\n if (lockedDepth && depth < lockedDepth) {\n console.error(`Child stack is shallower (${depth}) than the parent stack (${lockedDepth}) at ${time}`);\n depth = lockedDepth;\n }\n }\n if (this.#currentJSStack.length < depth) {\n console.error(`Trying to truncate higher than the current stack size at ${time}`);\n depth = this.#currentJSStack.length;\n }\n for (let k = 0; k < this.#currentJSStack.length; ++k) {\n this.#currentJSStack[k].dur = Types.Timing.Micro(Math.max(time - this.#currentJSStack[k].ts, 0));\n }\n this.#currentJSStack.length = depth;\n }\n\n #makeJSSampleEvent(call: Types.Events.SyntheticProfileCall, timestamp: Types.Timing.Micro, traceId?: number):\n Types.Events.SyntheticJSSample {\n const JSSampleEvent: Types.Events.SyntheticJSSample = {\n name: Types.Events.Name.JS_SAMPLE,\n cat: 'devtools.timeline',\n args: {\n data: {traceId, stackTrace: this.#makeProfileCallsForStack(call).map(e => e.callFrame)},\n },\n ph: Types.Events.Phase.INSTANT,\n ts: timestamp,\n dur: Types.Timing.Micro(0),\n pid: this.#processId,\n tid: this.#threadId,\n };\n return JSSampleEvent;\n }\n\n static framesAreEqual(frame1: Protocol.Runtime.CallFrame, frame2: Protocol.Runtime.CallFrame): boolean {\n return frame1.scriptId === frame2.scriptId && frame1.functionName === frame2.functionName &&\n frame1.lineNumber === frame2.lineNumber;\n }\n\n static showNativeName(name: string, runtimeCallStatsEnabled: boolean): boolean {\n return runtimeCallStatsEnabled && Boolean(SamplesIntegrator.nativeGroup(name));\n }\n\n static nativeGroup(nativeName: string): 'Parse'|'Compile'|null {\n if (nativeName.startsWith('Parse')) {\n return 'Parse';\n }\n if (nativeName.startsWith('Compile') || nativeName.startsWith('Recompile')) {\n return 'Compile';\n }\n return null;\n }\n\n static isNativeRuntimeFrame(frame: Protocol.Runtime.CallFrame): boolean {\n return frame.url === 'native V8Runtime';\n }\n\n static filterStackFrames(stack: Types.Events.SyntheticProfileCall[], engineConfig: Types.Configuration.Configuration):\n void {\n const showAllEvents = engineConfig.showAllEvents;\n if (showAllEvents) {\n return;\n }\n let previousNativeFrameName: string|null = null;\n let j = 0;\n for (let i = 0; i < stack.length; ++i) {\n const frame = stack[i].callFrame;\n const nativeRuntimeFrame = SamplesIntegrator.isNativeRuntimeFrame(frame);\n if (nativeRuntimeFrame &&\n !SamplesIntegrator.showNativeName(frame.functionName, engineConfig.includeRuntimeCallStats)) {\n continue;\n }\n const nativeFrameName = nativeRuntimeFrame ? SamplesIntegrator.nativeGroup(frame.functionName) : null;\n if (previousNativeFrameName && previousNativeFrameName === nativeFrameName) {\n continue;\n }\n previousNativeFrameName = nativeFrameName;\n stack[j++] = stack[i];\n }\n stack.length = j;\n }\n}\n"]}
@@ -1,27 +1,27 @@
1
1
  import * as Types from '../types/types.js';
2
- export declare const milliToMicro: (value: Types.Timing.MilliSeconds) => Types.Timing.MicroSeconds;
3
- export declare const secondsToMilli: (value: Types.Timing.Seconds) => Types.Timing.MilliSeconds;
4
- export declare const secondsToMicro: (value: Types.Timing.Seconds) => Types.Timing.MicroSeconds;
5
- export declare const microToMilli: (value: Types.Timing.MicroSeconds) => Types.Timing.MilliSeconds;
6
- export declare const microToSeconds: (value: Types.Timing.MicroSeconds) => Types.Timing.Seconds;
7
- export declare function timeStampForEventAdjustedByClosestNavigation(event: Types.Events.Event, traceBounds: Types.Timing.TraceWindowMicroSeconds, navigationsByNavigationId: Map<string, Types.Events.NavigationStart>, navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>): Types.Timing.MicroSeconds;
8
- export declare function expandWindowByPercentOrToOneMillisecond(annotationWindow: Types.Timing.TraceWindowMicroSeconds, maxTraceWindow: Types.Timing.TraceWindowMicroSeconds, percentage: number): Types.Timing.TraceWindowMicroSeconds;
9
- export interface EventTimingsData<ValueType extends Types.Timing.MicroSeconds | Types.Timing.MilliSeconds | Types.Timing.Seconds> {
2
+ export declare const milliToMicro: (value: Types.Timing.Milli) => Types.Timing.Micro;
3
+ export declare const secondsToMilli: (value: Types.Timing.Seconds) => Types.Timing.Milli;
4
+ export declare const secondsToMicro: (value: Types.Timing.Seconds) => Types.Timing.Micro;
5
+ export declare const microToMilli: (value: Types.Timing.Micro) => Types.Timing.Milli;
6
+ export declare const microToSeconds: (value: Types.Timing.Micro) => Types.Timing.Seconds;
7
+ export declare function timeStampForEventAdjustedByClosestNavigation(event: Types.Events.Event, traceBounds: Types.Timing.TraceWindowMicro, navigationsByNavigationId: Map<string, Types.Events.NavigationStart>, navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>): Types.Timing.Micro;
8
+ export declare function expandWindowByPercentOrToOneMillisecond(annotationWindow: Types.Timing.TraceWindowMicro, maxTraceWindow: Types.Timing.TraceWindowMicro, percentage: number): Types.Timing.TraceWindowMicro;
9
+ export interface EventTimingsData<ValueType extends Types.Timing.Micro | Types.Timing.Milli | Types.Timing.Seconds> {
10
10
  startTime: ValueType;
11
11
  endTime: ValueType;
12
12
  duration: ValueType;
13
13
  }
14
- export declare function eventTimingsMicroSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.MicroSeconds>;
15
- export declare function eventTimingsMilliSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.MilliSeconds>;
16
- export declare function traceWindowMilliSeconds(bounds: Types.Timing.TraceWindowMicroSeconds): Types.Timing.TraceWindowMilliSeconds;
17
- export declare function traceWindowMillisecondsToMicroSeconds(bounds: Types.Timing.TraceWindowMilliSeconds): Types.Timing.TraceWindowMicroSeconds;
18
- export declare function traceWindowMicroSecondsToMilliSeconds(bounds: Types.Timing.TraceWindowMicroSeconds): Types.Timing.TraceWindowMilliSeconds;
19
- export declare function traceWindowFromMilliSeconds(min: Types.Timing.MilliSeconds, max: Types.Timing.MilliSeconds): Types.Timing.TraceWindowMicroSeconds;
20
- export declare function traceWindowFromMicroSeconds(min: Types.Timing.MicroSeconds, max: Types.Timing.MicroSeconds): Types.Timing.TraceWindowMicroSeconds;
21
- export declare function traceWindowFromEvent(event: Types.Events.Event): Types.Timing.TraceWindowMicroSeconds;
14
+ export declare function eventTimingsMicroSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.Micro>;
15
+ export declare function eventTimingsMilliSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.Milli>;
16
+ export declare function traceWindowMilliSeconds(bounds: Types.Timing.TraceWindowMicro): Types.Timing.TraceWindowMilli;
17
+ export declare function traceWindowMillisecondsToMicroSeconds(bounds: Types.Timing.TraceWindowMilli): Types.Timing.TraceWindowMicro;
18
+ export declare function traceWindowMicroSecondsToMilliSeconds(bounds: Types.Timing.TraceWindowMicro): Types.Timing.TraceWindowMilli;
19
+ export declare function traceWindowFromMilliSeconds(min: Types.Timing.Milli, max: Types.Timing.Milli): Types.Timing.TraceWindowMicro;
20
+ export declare function traceWindowFromMicroSeconds(min: Types.Timing.Micro, max: Types.Timing.Micro): Types.Timing.TraceWindowMicro;
21
+ export declare function traceWindowFromEvent(event: Types.Events.Event): Types.Timing.TraceWindowMicro;
22
22
  export interface BoundsIncludeTimeRange {
23
- timeRange: Types.Timing.TraceWindowMicroSeconds;
24
- bounds: Types.Timing.TraceWindowMicroSeconds;
23
+ timeRange: Types.Timing.TraceWindowMicro;
24
+ bounds: Types.Timing.TraceWindowMicro;
25
25
  }
26
26
  /**
27
27
  * Checks to see if the timeRange is within the bounds. By "within" we mean
@@ -37,15 +37,15 @@ export interface BoundsIncludeTimeRange {
37
37
  */
38
38
  export declare function boundsIncludeTimeRange(data: BoundsIncludeTimeRange): boolean;
39
39
  /** Checks to see if the event is within or overlaps the bounds */
40
- export declare function eventIsInBounds(event: Types.Events.Event, bounds: Types.Timing.TraceWindowMicroSeconds): boolean;
41
- export declare function timestampIsInBounds(bounds: Types.Timing.TraceWindowMicroSeconds, timestamp: Types.Timing.MicroSeconds): boolean;
40
+ export declare function eventIsInBounds(event: Types.Events.Event, bounds: Types.Timing.TraceWindowMicro): boolean;
41
+ export declare function timestampIsInBounds(bounds: Types.Timing.TraceWindowMicro, timestamp: Types.Timing.Micro): boolean;
42
42
  export interface WindowFitsInsideBounds {
43
- window: Types.Timing.TraceWindowMicroSeconds;
44
- bounds: Types.Timing.TraceWindowMicroSeconds;
43
+ window: Types.Timing.TraceWindowMicro;
44
+ bounds: Types.Timing.TraceWindowMicro;
45
45
  }
46
46
  /**
47
47
  * Returns true if the window fits entirely within the bounds.
48
48
  * Note that if the window is equivalent to the bounds, that is considered to fit
49
49
  */
50
50
  export declare function windowFitsInsideBounds(data: WindowFitsInsideBounds): boolean;
51
- export declare function windowsEqual(w1: Types.Timing.TraceWindowMicroSeconds, w2: Types.Timing.TraceWindowMicroSeconds): boolean;
51
+ export declare function windowsEqual(w1: Types.Timing.TraceWindowMicro, w2: Types.Timing.TraceWindowMicro): boolean;
@@ -3,10 +3,10 @@
3
3
  // found in the LICENSE file.
4
4
  import * as Types from '../types/types.js';
5
5
  import { getNavigationForTraceEvent } from './Trace.js';
6
- export const milliToMicro = (value) => Types.Timing.MicroSeconds(value * 1000);
7
- export const secondsToMilli = (value) => Types.Timing.MilliSeconds(value * 1000);
6
+ export const milliToMicro = (value) => Types.Timing.Micro(value * 1000);
7
+ export const secondsToMilli = (value) => Types.Timing.Milli(value * 1000);
8
8
  export const secondsToMicro = (value) => milliToMicro(secondsToMilli(value));
9
- export const microToMilli = (value) => Types.Timing.MilliSeconds(value / 1000);
9
+ export const microToMilli = (value) => Types.Timing.Milli(value / 1000);
10
10
  export const microToSeconds = (value) => Types.Timing.Seconds(value / 1000 / 1000);
11
11
  export function timeStampForEventAdjustedByClosestNavigation(event, traceBounds, navigationsByNavigationId, navigationsByFrameId) {
12
12
  let eventTimeStamp = event.ts - traceBounds.min;
@@ -22,7 +22,7 @@ export function timeStampForEventAdjustedByClosestNavigation(event, traceBounds,
22
22
  eventTimeStamp = event.ts - navigationForEvent.ts;
23
23
  }
24
24
  }
25
- return Types.Timing.MicroSeconds(eventTimeStamp);
25
+ return Types.Timing.Micro(eventTimeStamp);
26
26
  }
27
27
  // Expands the trace window by a provided percentage or, if it the expanded window is smaller than 1 millisecond, expands it to 1 millisecond.
28
28
  // If the expanded window is outside of the max trace window, cut the overflowing bound to the max trace window bound.
@@ -38,9 +38,9 @@ export function expandWindowByPercentOrToOneMillisecond(annotationWindow, maxTra
38
38
  newMin = Math.max(newMin, maxTraceWindow.min);
39
39
  newMax = Math.min(newMax, maxTraceWindow.max);
40
40
  const expandedWindow = {
41
- min: Types.Timing.MicroSeconds(newMin),
42
- max: Types.Timing.MicroSeconds(newMax),
43
- range: Types.Timing.MicroSeconds(newMax - newMin),
41
+ min: Types.Timing.Micro(newMin),
42
+ max: Types.Timing.Micro(newMax),
43
+ range: Types.Timing.Micro(newMax - newMin),
44
44
  };
45
45
  return expandedWindow;
46
46
  }
@@ -83,7 +83,7 @@ export function traceWindowFromMilliSeconds(min, max) {
83
83
  const traceWindow = {
84
84
  min: milliToMicro(min),
85
85
  max: milliToMicro(max),
86
- range: Types.Timing.MicroSeconds(milliToMicro(max) - milliToMicro(min)),
86
+ range: Types.Timing.Micro(milliToMicro(max) - milliToMicro(min)),
87
87
  };
88
88
  return traceWindow;
89
89
  }
@@ -91,15 +91,15 @@ export function traceWindowFromMicroSeconds(min, max) {
91
91
  const traceWindow = {
92
92
  min,
93
93
  max,
94
- range: Types.Timing.MicroSeconds(max - min),
94
+ range: Types.Timing.Micro(max - min),
95
95
  };
96
96
  return traceWindow;
97
97
  }
98
98
  export function traceWindowFromEvent(event) {
99
99
  return {
100
100
  min: event.ts,
101
- max: Types.Timing.MicroSeconds(event.ts + (event.dur ?? 0)),
102
- range: event.dur ?? Types.Timing.MicroSeconds(0),
101
+ max: Types.Timing.Micro(event.ts + (event.dur ?? 0)),
102
+ range: event.dur ?? Types.Timing.Micro(0),
103
103
  };
104
104
  }
105
105
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Timing.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/helpers/Timing.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,0BAA0B,EAAC,MAAM,YAAY,CAAC;AAEtD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAgC,EAA6B,EAAE,CACxF,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA2B,EAA6B,EAAE,CACrF,KAAK,CAAC,MA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CAAC,KAAyB,EAAE,MAA4C;IACrG,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC;IAC3B,OAAO,SAAS,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAC/B,MAA4C,EAAE,SAAoC;IACpF,OAAO,SAAS,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC;AAC5D,CAAC;AAOD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAA4B;IACjE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,YAAY,CACxB,EAAwC,EAAE,EAAwC;IACpF,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC;AAChD,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Types from '../types/types.js';\n\nimport {getNavigationForTraceEvent} from './Trace.js';\n\nexport const milliToMicro = (value: Types.Timing.MilliSeconds): Types.Timing.MicroSeconds =>\n Types.Timing.MicroSeconds(value * 1000);\n\nexport const secondsToMilli = (value: Types.Timing.Seconds): Types.Timing.MilliSeconds =>\n Types.Timing.MilliSeconds(value * 1000);\n\nexport const secondsToMicro = (value: Types.Timing.Seconds): Types.Timing.MicroSeconds =>\n milliToMicro(secondsToMilli(value));\n\nexport const microToMilli = (value: Types.Timing.MicroSeconds): Types.Timing.MilliSeconds =>\n Types.Timing.MilliSeconds(value / 1000);\n\nexport const microToSeconds = (value: Types.Timing.MicroSeconds): Types.Timing.Seconds =>\n Types.Timing.Seconds(value / 1000 / 1000);\n\nexport function timeStampForEventAdjustedByClosestNavigation(\n event: Types.Events.Event,\n traceBounds: Types.Timing.TraceWindowMicroSeconds,\n navigationsByNavigationId: Map<string, Types.Events.NavigationStart>,\n navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>,\n ): Types.Timing.MicroSeconds {\n let eventTimeStamp = event.ts - traceBounds.min;\n if (event.args?.data?.navigationId) {\n const navigationForEvent = navigationsByNavigationId.get(event.args.data.navigationId);\n if (navigationForEvent) {\n eventTimeStamp = event.ts - navigationForEvent.ts;\n }\n } else if (event.args?.data?.frame) {\n const navigationForEvent = getNavigationForTraceEvent(event, event.args.data.frame, navigationsByFrameId);\n if (navigationForEvent) {\n eventTimeStamp = event.ts - navigationForEvent.ts;\n }\n }\n return Types.Timing.MicroSeconds(eventTimeStamp);\n}\n\n// Expands the trace window by a provided percentage or, if it the expanded window is smaller than 1 millisecond, expands it to 1 millisecond.\n// If the expanded window is outside of the max trace window, cut the overflowing bound to the max trace window bound.\nexport function expandWindowByPercentOrToOneMillisecond(\n annotationWindow: Types.Timing.TraceWindowMicroSeconds, maxTraceWindow: Types.Timing.TraceWindowMicroSeconds,\n percentage: number): Types.Timing.TraceWindowMicroSeconds {\n // Expand min and max of the window by half of the provided percentage. That way, in total, the window will be expanded by the provided percentage.\n let newMin = annotationWindow.min - annotationWindow.range * (percentage / 100) / 2;\n let newMax = annotationWindow.max + annotationWindow.range * (percentage / 100) / 2;\n\n if (newMax - newMin < 1_000) {\n const rangeMiddle = (annotationWindow.min + annotationWindow.max) / 2;\n newMin = rangeMiddle - 500;\n newMax = rangeMiddle + 500;\n }\n\n newMin = Math.max(newMin, maxTraceWindow.min);\n newMax = Math.min(newMax, maxTraceWindow.max);\n\n const expandedWindow: Types.Timing.TraceWindowMicroSeconds = {\n min: Types.Timing.MicroSeconds(newMin),\n max: Types.Timing.MicroSeconds(newMax),\n range: Types.Timing.MicroSeconds(newMax - newMin),\n };\n\n return expandedWindow;\n}\n\nexport interface EventTimingsData<\n ValueType extends Types.Timing.MicroSeconds|Types.Timing.MilliSeconds|Types.Timing.Seconds,\n> {\n startTime: ValueType;\n endTime: ValueType;\n duration: ValueType;\n}\n\nexport function eventTimingsMicroSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.MicroSeconds> {\n return {\n startTime: event.ts as Types.Timing.MicroSeconds,\n endTime: (event.ts + (event.dur ?? 0)) as Types.Timing.MicroSeconds,\n duration: (event.dur || 0) as Types.Timing.MicroSeconds,\n };\n}\nexport function eventTimingsMilliSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.MilliSeconds> {\n return {\n startTime: (event.ts / 1000) as Types.Timing.MilliSeconds,\n endTime: (event.ts + (event.dur ?? 0)) / 1000 as Types.Timing.MilliSeconds,\n duration: (event.dur || 0) / 1000 as Types.Timing.MilliSeconds,\n };\n}\n\nexport function traceWindowMilliSeconds(bounds: Types.Timing.TraceWindowMicroSeconds):\n Types.Timing.TraceWindowMilliSeconds {\n return {\n min: microToMilli(bounds.min),\n max: microToMilli(bounds.max),\n range: microToMilli(bounds.range),\n };\n}\n\nexport function traceWindowMillisecondsToMicroSeconds(bounds: Types.Timing.TraceWindowMilliSeconds):\n Types.Timing.TraceWindowMicroSeconds {\n return {\n min: milliToMicro(bounds.min),\n max: milliToMicro(bounds.max),\n range: milliToMicro(bounds.range),\n };\n}\nexport function traceWindowMicroSecondsToMilliSeconds(bounds: Types.Timing.TraceWindowMicroSeconds):\n Types.Timing.TraceWindowMilliSeconds {\n return {\n min: microToMilli(bounds.min),\n max: microToMilli(bounds.max),\n range: microToMilli(bounds.range),\n };\n}\n\nexport function traceWindowFromMilliSeconds(\n min: Types.Timing.MilliSeconds, max: Types.Timing.MilliSeconds): Types.Timing.TraceWindowMicroSeconds {\n const traceWindow: Types.Timing.TraceWindowMicroSeconds = {\n min: milliToMicro(min),\n max: milliToMicro(max),\n range: Types.Timing.MicroSeconds(milliToMicro(max) - milliToMicro(min)),\n };\n return traceWindow;\n}\n\nexport function traceWindowFromMicroSeconds(\n min: Types.Timing.MicroSeconds, max: Types.Timing.MicroSeconds): Types.Timing.TraceWindowMicroSeconds {\n const traceWindow: Types.Timing.TraceWindowMicroSeconds = {\n min,\n max,\n range: Types.Timing.MicroSeconds(max - min),\n };\n return traceWindow;\n}\n\nexport function traceWindowFromEvent(event: Types.Events.Event): Types.Timing.TraceWindowMicroSeconds {\n return {\n min: event.ts,\n max: Types.Timing.MicroSeconds(event.ts + (event.dur ?? 0)),\n range: event.dur ?? Types.Timing.MicroSeconds(0),\n };\n}\n\nexport interface BoundsIncludeTimeRange {\n timeRange: Types.Timing.TraceWindowMicroSeconds;\n bounds: Types.Timing.TraceWindowMicroSeconds;\n}\n\n/**\n * Checks to see if the timeRange is within the bounds. By \"within\" we mean\n * \"has any overlap\":\n * |------------------------|\n * == no overlap (entirely before)\n * ========= overlap\n * ========= overlap\n * ========= overlap\n * ==== no overlap (entirely after)\n * ============================== overlap (time range is larger than bounds)\n * |------------------------|\n */\nexport function boundsIncludeTimeRange(data: BoundsIncludeTimeRange): boolean {\n const {min: visibleMin, max: visibleMax} = data.bounds;\n const {min: rangeMin, max: rangeMax} = data.timeRange;\n\n return visibleMin <= rangeMax && visibleMax >= rangeMin;\n}\n\n/** Checks to see if the event is within or overlaps the bounds */\nexport function eventIsInBounds(event: Types.Events.Event, bounds: Types.Timing.TraceWindowMicroSeconds): boolean {\n const startTime = event.ts;\n return startTime <= bounds.max && bounds.min <= (startTime + (event.dur ?? 0));\n}\n\nexport function timestampIsInBounds(\n bounds: Types.Timing.TraceWindowMicroSeconds, timestamp: Types.Timing.MicroSeconds): boolean {\n return timestamp >= bounds.min && timestamp <= bounds.max;\n}\n\nexport interface WindowFitsInsideBounds {\n window: Types.Timing.TraceWindowMicroSeconds;\n bounds: Types.Timing.TraceWindowMicroSeconds;\n}\n\n/**\n * Returns true if the window fits entirely within the bounds.\n * Note that if the window is equivalent to the bounds, that is considered to fit\n */\nexport function windowFitsInsideBounds(data: WindowFitsInsideBounds): boolean {\n return data.window.min >= data.bounds.min && data.window.max <= data.bounds.max;\n}\n\nexport function windowsEqual(\n w1: Types.Timing.TraceWindowMicroSeconds, w2: Types.Timing.TraceWindowMicroSeconds): boolean {\n return w1.min === w2.min && w1.max === w2.max;\n}\n"]}
1
+ {"version":3,"file":"Timing.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/helpers/Timing.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,0BAA0B,EAAC,MAAM,YAAY,CAAC;AAEtD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAyB,EAAsB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;AAEhH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA2B,EAAsB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;AAEpH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA2B,EAAsB,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAEvH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAyB,EAAsB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;AAEhH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAyB,EAAwB,EAAE,CAC9E,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAE9C,MAAM,UAAU,4CAA4C,CACxD,KAAyB,EACzB,WAA0C,EAC1C,yBAA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AAI,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAiC,EAAE,EAAiC;IAC/F,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,CAAC;AAChD,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Types from '../types/types.js';\n\nimport {getNavigationForTraceEvent} from './Trace.js';\n\nexport const milliToMicro = (value: Types.Timing.Milli): Types.Timing.Micro => Types.Timing.Micro(value * 1000);\n\nexport const secondsToMilli = (value: Types.Timing.Seconds): Types.Timing.Milli => Types.Timing.Milli(value * 1000);\n\nexport const secondsToMicro = (value: Types.Timing.Seconds): Types.Timing.Micro => milliToMicro(secondsToMilli(value));\n\nexport const microToMilli = (value: Types.Timing.Micro): Types.Timing.Milli => Types.Timing.Milli(value / 1000);\n\nexport const microToSeconds = (value: Types.Timing.Micro): Types.Timing.Seconds =>\n Types.Timing.Seconds(value / 1000 / 1000);\n\nexport function timeStampForEventAdjustedByClosestNavigation(\n event: Types.Events.Event,\n traceBounds: Types.Timing.TraceWindowMicro,\n navigationsByNavigationId: Map<string, Types.Events.NavigationStart>,\n navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>,\n ): Types.Timing.Micro {\n let eventTimeStamp = event.ts - traceBounds.min;\n if (event.args?.data?.navigationId) {\n const navigationForEvent = navigationsByNavigationId.get(event.args.data.navigationId);\n if (navigationForEvent) {\n eventTimeStamp = event.ts - navigationForEvent.ts;\n }\n } else if (event.args?.data?.frame) {\n const navigationForEvent = getNavigationForTraceEvent(event, event.args.data.frame, navigationsByFrameId);\n if (navigationForEvent) {\n eventTimeStamp = event.ts - navigationForEvent.ts;\n }\n }\n return Types.Timing.Micro(eventTimeStamp);\n}\n\n// Expands the trace window by a provided percentage or, if it the expanded window is smaller than 1 millisecond, expands it to 1 millisecond.\n// If the expanded window is outside of the max trace window, cut the overflowing bound to the max trace window bound.\nexport function expandWindowByPercentOrToOneMillisecond(\n annotationWindow: Types.Timing.TraceWindowMicro, maxTraceWindow: Types.Timing.TraceWindowMicro,\n percentage: number): Types.Timing.TraceWindowMicro {\n // Expand min and max of the window by half of the provided percentage. That way, in total, the window will be expanded by the provided percentage.\n let newMin = annotationWindow.min - annotationWindow.range * (percentage / 100) / 2;\n let newMax = annotationWindow.max + annotationWindow.range * (percentage / 100) / 2;\n\n if (newMax - newMin < 1_000) {\n const rangeMiddle = (annotationWindow.min + annotationWindow.max) / 2;\n newMin = rangeMiddle - 500;\n newMax = rangeMiddle + 500;\n }\n\n newMin = Math.max(newMin, maxTraceWindow.min);\n newMax = Math.min(newMax, maxTraceWindow.max);\n\n const expandedWindow: Types.Timing.TraceWindowMicro = {\n min: Types.Timing.Micro(newMin),\n max: Types.Timing.Micro(newMax),\n range: Types.Timing.Micro(newMax - newMin),\n };\n\n return expandedWindow;\n}\n\nexport interface EventTimingsData<ValueType extends Types.Timing.Micro|Types.Timing.Milli|Types.Timing.Seconds, > {\n startTime: ValueType;\n endTime: ValueType;\n duration: ValueType;\n}\n\nexport function eventTimingsMicroSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.Micro> {\n return {\n startTime: event.ts as Types.Timing.Micro,\n endTime: (event.ts + (event.dur ?? 0)) as Types.Timing.Micro,\n duration: (event.dur || 0) as Types.Timing.Micro,\n };\n}\nexport function eventTimingsMilliSeconds(event: Types.Events.Event): EventTimingsData<Types.Timing.Milli> {\n return {\n startTime: (event.ts / 1000) as Types.Timing.Milli,\n endTime: (event.ts + (event.dur ?? 0)) / 1000 as Types.Timing.Milli,\n duration: (event.dur || 0) / 1000 as Types.Timing.Milli,\n };\n}\n\nexport function traceWindowMilliSeconds(bounds: Types.Timing.TraceWindowMicro): Types.Timing.TraceWindowMilli {\n return {\n min: microToMilli(bounds.min),\n max: microToMilli(bounds.max),\n range: microToMilli(bounds.range),\n };\n}\n\nexport function traceWindowMillisecondsToMicroSeconds(bounds: Types.Timing.TraceWindowMilli):\n Types.Timing.TraceWindowMicro {\n return {\n min: milliToMicro(bounds.min),\n max: milliToMicro(bounds.max),\n range: milliToMicro(bounds.range),\n };\n}\nexport function traceWindowMicroSecondsToMilliSeconds(bounds: Types.Timing.TraceWindowMicro):\n Types.Timing.TraceWindowMilli {\n return {\n min: microToMilli(bounds.min),\n max: microToMilli(bounds.max),\n range: microToMilli(bounds.range),\n };\n}\n\nexport function traceWindowFromMilliSeconds(\n min: Types.Timing.Milli, max: Types.Timing.Milli): Types.Timing.TraceWindowMicro {\n const traceWindow: Types.Timing.TraceWindowMicro = {\n min: milliToMicro(min),\n max: milliToMicro(max),\n range: Types.Timing.Micro(milliToMicro(max) - milliToMicro(min)),\n };\n return traceWindow;\n}\n\nexport function traceWindowFromMicroSeconds(\n min: Types.Timing.Micro, max: Types.Timing.Micro): Types.Timing.TraceWindowMicro {\n const traceWindow: Types.Timing.TraceWindowMicro = {\n min,\n max,\n range: Types.Timing.Micro(max - min),\n };\n return traceWindow;\n}\n\nexport function traceWindowFromEvent(event: Types.Events.Event): Types.Timing.TraceWindowMicro {\n return {\n min: event.ts,\n max: Types.Timing.Micro(event.ts + (event.dur ?? 0)),\n range: event.dur ?? Types.Timing.Micro(0),\n };\n}\n\nexport interface BoundsIncludeTimeRange {\n timeRange: Types.Timing.TraceWindowMicro;\n bounds: Types.Timing.TraceWindowMicro;\n}\n\n/**\n * Checks to see if the timeRange is within the bounds. By \"within\" we mean\n * \"has any overlap\":\n * |------------------------|\n * == no overlap (entirely before)\n * ========= overlap\n * ========= overlap\n * ========= overlap\n * ==== no overlap (entirely after)\n * ============================== overlap (time range is larger than bounds)\n * |------------------------|\n */\nexport function boundsIncludeTimeRange(data: BoundsIncludeTimeRange): boolean {\n const {min: visibleMin, max: visibleMax} = data.bounds;\n const {min: rangeMin, max: rangeMax} = data.timeRange;\n\n return visibleMin <= rangeMax && visibleMax >= rangeMin;\n}\n\n/** Checks to see if the event is within or overlaps the bounds */\nexport function eventIsInBounds(event: Types.Events.Event, bounds: Types.Timing.TraceWindowMicro): boolean {\n const startTime = event.ts;\n return startTime <= bounds.max && bounds.min <= (startTime + (event.dur ?? 0));\n}\n\nexport function timestampIsInBounds(bounds: Types.Timing.TraceWindowMicro, timestamp: Types.Timing.Micro): boolean {\n return timestamp >= bounds.min && timestamp <= bounds.max;\n}\n\nexport interface WindowFitsInsideBounds {\n window: Types.Timing.TraceWindowMicro;\n bounds: Types.Timing.TraceWindowMicro;\n}\n\n/**\n * Returns true if the window fits entirely within the bounds.\n * Note that if the window is equivalent to the bounds, that is considered to fit\n */\nexport function windowFitsInsideBounds(data: WindowFitsInsideBounds): boolean {\n return data.window.min >= data.bounds.min && data.window.max <= data.bounds.max;\n}\n\nexport function windowsEqual(w1: Types.Timing.TraceWindowMicro, w2: Types.Timing.TraceWindowMicro): boolean {\n return w1.min === w2.min && w1.max === w2.max;\n}\n"]}
@@ -23,8 +23,8 @@ export declare function extractOriginFromTrace(firstNavigationURL: string): stri
23
23
  export type EventsInThread<T extends Types.Events.Event> = Map<Types.Events.ThreadID, T[]>;
24
24
  export declare function addEventToProcessThread<T extends Types.Events.Event>(event: T, eventsInProcessThread: Map<Types.Events.ProcessID, EventsInThread<T>>): void;
25
25
  export interface TimeSpan {
26
- ts: Types.Timing.MicroSeconds;
27
- dur?: Types.Timing.MicroSeconds;
26
+ ts: Types.Timing.Micro;
27
+ dur?: Types.Timing.Micro;
28
28
  }
29
29
  export declare function eventTimeComparator(a: TimeSpan, b: TimeSpan): -1 | 0 | 1;
30
30
  /**
@@ -32,8 +32,8 @@ export declare function eventTimeComparator(a: TimeSpan, b: TimeSpan): -1 | 0 |
32
32
  * the same start time, orders them by longest first.
33
33
  */
34
34
  export declare function sortTraceEventsInPlace(events: {
35
- ts: Types.Timing.MicroSeconds;
36
- dur?: Types.Timing.MicroSeconds;
35
+ ts: Types.Timing.Micro;
36
+ dur?: Types.Timing.Micro;
37
37
  }[]): void;
38
38
  /**
39
39
  * Returns an array of ordered events that results after merging the two
@@ -42,9 +42,9 @@ export declare function sortTraceEventsInPlace(events: {
42
42
  export declare function mergeEventsInOrder<T1 extends Types.Events.Event, T2 extends Types.Events.Event>(eventsArray1: readonly T1[], eventsArray2: readonly T2[]): (T1 | T2)[];
43
43
  export declare function getNavigationForTraceEvent(event: Types.Events.Event, eventFrameId: string, navigationsByFrameId: Map<string, Types.Events.NavigationStart[]>): Types.Events.NavigationStart | null;
44
44
  export declare function extractId(event: Types.Events.PairableAsync | Types.Events.SyntheticEventPair<Types.Events.PairableAsync>): string | undefined;
45
- export declare function activeURLForFrameAtTime(frameId: string, time: Types.Timing.MicroSeconds, rendererProcessesByFrame: Map<string, Map<Types.Events.ProcessID, {
45
+ export declare function activeURLForFrameAtTime(frameId: string, time: Types.Timing.Micro, rendererProcessesByFrame: Map<string, Map<Types.Events.ProcessID, {
46
46
  frame: Types.Events.TraceFrame;
47
- window: Types.Timing.TraceWindowMicroSeconds;
47
+ window: Types.Timing.TraceWindowMicro;
48
48
  }[]>>): string | null;
49
49
  /**
50
50
  * @param node the node attached to the profile call. Here a node represents a function in the call tree.
@@ -56,7 +56,7 @@ export declare function activeURLForFrameAtTime(frameId: string, time: Types.Tim
56
56
  *
57
57
  * See `panels/timeline/docs/profile_calls.md` for more context on how these events are created.
58
58
  */
59
- export declare function makeProfileCall(node: CPUProfile.ProfileTreeModel.ProfileNode, profileId: Types.Events.ProfileID, sampleIndex: number, ts: Types.Timing.MicroSeconds, pid: Types.Events.ProcessID, tid: Types.Events.ThreadID): Types.Events.SyntheticProfileCall;
59
+ export declare function makeProfileCall(node: CPUProfile.ProfileTreeModel.ProfileNode, profileId: Types.Events.ProfileID, sampleIndex: number, ts: Types.Timing.Micro, pid: Types.Events.ProcessID, tid: Types.Events.ThreadID): Types.Events.SyntheticProfileCall;
60
60
  /**
61
61
  * Matches beginning events with PairableAsyncEnd and PairableAsyncInstant (ASYNC_NESTABLE_INSTANT)
62
62
  * if provided, though currently only coming from Animations. Traces may contain multiple instant events so we need to
@@ -98,16 +98,16 @@ export declare function getZeroIndexedStackTraceForEvent(event: Types.Events.Eve
98
98
  export declare function makeZeroBasedCallFrame(callFrame: Types.Events.CallFrame): Types.Events.CallFrame;
99
99
  export declare function frameIDForEvent(event: Types.Events.Event): string | null;
100
100
  export declare function isTopLevelEvent(event: Types.Events.Event): boolean;
101
- export declare function findUpdateLayoutTreeEvents(events: Types.Events.Event[], startTime: Types.Timing.MicroSeconds, endTime?: Types.Timing.MicroSeconds): Types.Events.UpdateLayoutTree[];
102
- export declare function findNextEventAfterTimestamp<T extends Types.Events.Event>(candidates: T[], ts: Types.Timing.MicroSeconds): T | null;
103
- export declare function findPreviousEventBeforeTimestamp<T extends Types.Events.Event>(candidates: T[], ts: Types.Timing.MicroSeconds): T | null;
101
+ export declare function findUpdateLayoutTreeEvents(events: Types.Events.Event[], startTime: Types.Timing.Micro, endTime?: Types.Timing.Micro): Types.Events.UpdateLayoutTree[];
102
+ export declare function findNextEventAfterTimestamp<T extends Types.Events.Event>(candidates: T[], ts: Types.Timing.Micro): T | null;
103
+ export declare function findPreviousEventBeforeTimestamp<T extends Types.Events.Event>(candidates: T[], ts: Types.Timing.Micro): T | null;
104
104
  export interface ForEachEventConfig {
105
105
  onStartEvent: (event: Types.Events.Event) => void;
106
106
  onEndEvent: (event: Types.Events.Event) => void;
107
107
  onInstantEvent?: (event: Types.Events.Event) => void;
108
108
  eventFilter?: (event: Types.Events.Event) => boolean;
109
- startTime?: Types.Timing.MicroSeconds;
110
- endTime?: Types.Timing.MicroSeconds;
109
+ startTime?: Types.Timing.Micro;
110
+ endTime?: Types.Timing.Micro;
111
111
  ignoreAsyncEvents?: boolean;
112
112
  }
113
113
  /**
@@ -138,7 +138,7 @@ export interface ForEachEventConfig {
138
138
  * 9. End A
139
139
  *
140
140
  * By default, async events are skipped. This behaviour can be
141
- * overriden making use of the config.ignoreAsyncEvents parameter.
141
+ * overridden making use of the config.ignoreAsyncEvents parameter.
142
142
  */
143
143
  export declare function forEachEvent(events: Types.Events.Event[], config: ForEachEventConfig): void;
144
144
  export declare function eventHasCategory(event: Types.Events.Event, category: string): boolean;
@@ -147,5 +147,6 @@ export declare function nodeIdForInvalidationEvent(event: Types.Events.Invalidat
147
147
  * This compares Types.Events.CallFrame with Protocol.Runtime.CallFrame and checks for equality.
148
148
  */
149
149
  export declare function isMatchingCallFrame(eventFrame: Types.Events.CallFrame, nodeFrame: Protocol.Runtime.CallFrame): boolean;
150
- export declare function eventContainsTimestamp(event: Types.Events.Event, ts: Types.Timing.MicroSeconds): boolean;
150
+ export declare function eventContainsTimestamp(event: Types.Events.Event, ts: Types.Timing.Micro): boolean;
151
+ export declare function extractSampleTraceId(event: Types.Events.Event): number | null;
151
152
  export {};