@paulirish/trace_engine 0.0.21 → 0.0.23

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 (67) hide show
  1. package/analyze-trace.mjs +24 -16
  2. package/generated/protocol.d.ts +26 -3
  3. package/models/cpu_profile/CPUProfileDataModel.d.ts +1 -1
  4. package/models/cpu_profile/CPUProfileDataModel.js +6 -6
  5. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
  6. package/models/trace/ModelImpl.d.ts +0 -6
  7. package/models/trace/ModelImpl.js +1 -10
  8. package/models/trace/ModelImpl.js.map +1 -1
  9. package/models/trace/Processor.d.ts +0 -1
  10. package/models/trace/Processor.js +13 -14
  11. package/models/trace/Processor.js.map +1 -1
  12. package/models/trace/TracingManager.js.map +1 -1
  13. package/models/trace/handlers/AuctionWorkletsHandler.js +1 -0
  14. package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
  15. package/models/trace/handlers/ExtensionTraceDataHandler.js +18 -5
  16. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
  17. package/models/trace/handlers/LayoutShiftsHandler.js +1 -0
  18. package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
  19. package/models/trace/handlers/NetworkRequestsHandler.d.ts +1 -1
  20. package/models/trace/handlers/NetworkRequestsHandler.js +6 -8
  21. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  22. package/models/trace/handlers/PageLoadMetricsHandler.js +1 -1
  23. package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
  24. package/models/trace/handlers/RendererHandler.js +17 -7
  25. package/models/trace/handlers/RendererHandler.js.map +1 -1
  26. package/models/trace/handlers/SamplesHandler.d.ts +1 -0
  27. package/models/trace/handlers/SamplesHandler.js +11 -5
  28. package/models/trace/handlers/SamplesHandler.js.map +1 -1
  29. package/models/trace/handlers/ScreenshotsHandler.js +1 -0
  30. package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
  31. package/models/trace/handlers/Threads.js +2 -2
  32. package/models/trace/handlers/Threads.js.map +1 -1
  33. package/models/trace/handlers/UserInteractionsHandler.js +1 -0
  34. package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
  35. package/models/trace/handlers/WarningsHandler.js +0 -1
  36. package/models/trace/handlers/WarningsHandler.js.map +1 -1
  37. package/models/trace/helpers/Extensions.js +4 -0
  38. package/models/trace/helpers/Extensions.js.map +1 -1
  39. package/models/trace/helpers/SamplesIntegrator.d.ts +6 -1
  40. package/models/trace/helpers/SamplesIntegrator.js +36 -8
  41. package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
  42. package/models/trace/helpers/Trace.d.ts +80 -7
  43. package/models/trace/helpers/Trace.js +190 -24
  44. package/models/trace/helpers/Trace.js.map +1 -1
  45. package/models/trace/helpers/TreeHelpers.d.ts +20 -0
  46. package/models/trace/helpers/TreeHelpers.js +50 -0
  47. package/models/trace/helpers/TreeHelpers.js.map +1 -1
  48. package/models/trace/insights/CumulativeLayoutShift.d.ts +29 -0
  49. package/models/trace/insights/CumulativeLayoutShift.js +81 -0
  50. package/models/trace/insights/CumulativeLayoutShift.js.map +1 -0
  51. package/models/trace/insights/InsightRunners.d.ts +1 -0
  52. package/models/trace/insights/InsightRunners.js +1 -0
  53. package/models/trace/insights/InsightRunners.js.map +1 -1
  54. package/models/trace/insights/RenderBlocking.js +14 -0
  55. package/models/trace/insights/RenderBlocking.js.map +1 -1
  56. package/models/trace/insights/insights-tsconfig.json +1 -0
  57. package/models/trace/trace-tsconfig.json +0 -1
  58. package/models/trace/trace.d.ts +1 -2
  59. package/models/trace/trace.js +1 -4
  60. package/models/trace/trace.js.map +1 -1
  61. package/models/trace/types/Configuration.d.ts +16 -28
  62. package/models/trace/types/Configuration.js +7 -27
  63. package/models/trace/types/Configuration.js.map +1 -1
  64. package/models/trace/types/TraceEvents.d.ts +84 -19
  65. package/models/trace/types/TraceEvents.js +22 -1
  66. package/models/trace/types/TraceEvents.js.map +1 -1
  67. package/package.json +1 -1
@@ -1,33 +1,21 @@
1
- export type Configuration = Readonly<{
2
- settings: {};
3
- experiments: {
4
- /**
5
- * Include V8 RCS in the timeline
6
- */
7
- timelineV8RuntimeCallStats: boolean;
8
- /**
9
- * Show all events: disable the default filtering which hides and excludes some events.
10
- */
11
- timelineShowAllEvents: boolean;
12
- };
13
- processing: {
14
- /**
15
- * How long the processor should pause between event chunks.
16
- */
17
- pauseDuration: number;
18
- /**
19
- * How many events should be processed before yielding to the main thread for a pause.
20
- */
21
- eventsPerChunk: number;
22
- };
23
- }>;
24
- export declare const DEFAULT: Configuration;
1
+ export type Configuration = {
2
+ /**
3
+ * Include V8 RCS functions in the JS stacks
4
+ */
5
+ includeRuntimeCallStats: boolean;
6
+ /**
7
+ * Show all events: disable the default filtering which hides and excludes some events.
8
+ */
9
+ showAllEvents: boolean;
10
+ /**
11
+ * Extra detail for RPP developers (eg Trace Event json in Summary, and individual JS Sample events)
12
+ */
13
+ debugMode: boolean;
14
+ };
15
+ export declare const defaults: () => Configuration;
25
16
  /**
26
17
  * Generates a key that can be used to represent this config in a cache. This is
27
18
  * used mainly in tests, where we want to avoid re-parsing a file if we have
28
- * already processed it with the same configuration. This cache key purposefully
29
- * does not include all settings in the configuration; the processing settings
30
- * do not impact the actual resulting data. Only new flags in the config that
31
- * alter parsing should be added to this cache key.
19
+ * already processed it with the same configuration.
32
20
  */
33
21
  export declare function configToCacheKey(config: Configuration): string;
@@ -1,37 +1,17 @@
1
1
  // Copyright 2023 The Chromium Authors. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- export const DEFAULT = {
5
- settings: {},
6
- experiments: {
7
- timelineV8RuntimeCallStats: false,
8
- timelineShowAllEvents: false,
9
- },
10
- processing: {
11
- /**
12
- * We want to yield regularly to maintain responsiveness. If we yield too often, we're wasting idle time.
13
- * We could do this by checking `performance.now()` regularly, but it's an expensive call in such a hot loop.
14
- * `eventsPerChunk` is an approximated proxy metric.
15
- * But how big a chunk? We're aiming for long tasks that are no smaller than 100ms and not bigger than 200ms.
16
- * It's CPU dependent, so it should be calibrated on oldish hardware.
17
- * Illustration of a previous change to `eventsPerChunk`: https://imgur.com/wzp8BnR
18
- */
19
- eventsPerChunk: 50_000,
20
- pauseDuration: 0,
21
- },
22
- };
4
+ export const defaults = () => ({
5
+ includeRuntimeCallStats: false,
6
+ showAllEvents: false,
7
+ debugMode: false,
8
+ });
23
9
  /**
24
10
  * Generates a key that can be used to represent this config in a cache. This is
25
11
  * used mainly in tests, where we want to avoid re-parsing a file if we have
26
- * already processed it with the same configuration. This cache key purposefully
27
- * does not include all settings in the configuration; the processing settings
28
- * do not impact the actual resulting data. Only new flags in the config that
29
- * alter parsing should be added to this cache key.
12
+ * already processed it with the same configuration.
30
13
  */
31
14
  export function configToCacheKey(config) {
32
- return [
33
- `experiments.timelineShowAllEvents:${config.experiments.timelineShowAllEvents}`,
34
- `experiments.timelineV8RuntimeCallStats:${config.experiments.timelineV8RuntimeCallStats}`,
35
- ].join('-');
15
+ return JSON.stringify(config);
36
16
  }
37
17
  //# sourceMappingURL=Configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AA4B7B,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE;QACX,0BAA0B,EAAE,KAAK;QACjC,qBAAqB,EAAE,KAAK;KAC7B;IACD,UAAU,EAAE;QAEV;;;;;;;WAOG;QACH,cAAc,EAAE,MAAM;QACtB,aAAa,EAAE,CAAC;KACjB;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAqB;IACpD,OAAO;QACL,qCAAqC,MAAM,CAAC,WAAW,CAAC,qBAAqB,EAAE;QAC/E,0CAA0C,MAAM,CAAC,WAAW,CAAC,0BAA0B,EAAE;KAC1F,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC","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\nexport type Configuration = Readonly<{\n settings: {\n // Currently empty but defining here as we will migrate more settings into this.\n },\n experiments: {\n /**\n * Include V8 RCS in the timeline\n */\n timelineV8RuntimeCallStats: boolean,\n /**\n * Show all events: disable the default filtering which hides and excludes some events.\n */\n timelineShowAllEvents: boolean,\n },\n processing: {\n /**\n * How long the processor should pause between event chunks.\n */\n pauseDuration: number,\n /**\n * How many events should be processed before yielding to the main thread for a pause.\n */\n eventsPerChunk: number,\n },\n}>;\n\nexport const DEFAULT: Configuration = {\n settings: {},\n experiments: {\n timelineV8RuntimeCallStats: false,\n timelineShowAllEvents: false,\n },\n processing: {\n\n /**\n * We want to yield regularly to maintain responsiveness. If we yield too often, we're wasting idle time.\n * We could do this by checking `performance.now()` regularly, but it's an expensive call in such a hot loop.\n * `eventsPerChunk` is an approximated proxy metric.\n * But how big a chunk? We're aiming for long tasks that are no smaller than 100ms and not bigger than 200ms.\n * It's CPU dependent, so it should be calibrated on oldish hardware.\n * Illustration of a previous change to `eventsPerChunk`: https://imgur.com/wzp8BnR\n */\n eventsPerChunk: 50_000,\n pauseDuration: 0,\n },\n};\n\n/**\n * Generates a key that can be used to represent this config in a cache. This is\n * used mainly in tests, where we want to avoid re-parsing a file if we have\n * already processed it with the same configuration. This cache key purposefully\n * does not include all settings in the configuration; the processing settings\n * do not impact the actual resulting data. Only new flags in the config that\n * alter parsing should be added to this cache key.\n */\nexport function configToCacheKey(config: Configuration): string {\n return [\n `experiments.timelineShowAllEvents:${config.experiments.timelineShowAllEvents}`,\n `experiments.timelineV8RuntimeCallStats:${config.experiments.timelineV8RuntimeCallStats}`,\n ].join('-');\n}\n"]}
1
+ {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAiB7B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAkB,EAAE,CAAC,CAAC;IAC5C,uBAAuB,EAAE,KAAK;IAC9B,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,KAAK;CACjB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAqB;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC","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\nexport type Configuration = {\n /**\n * Include V8 RCS functions in the JS stacks\n */\n includeRuntimeCallStats: boolean,\n /**\n * Show all events: disable the default filtering which hides and excludes some events.\n */\n showAllEvents: boolean,\n /**\n * Extra detail for RPP developers (eg Trace Event json in Summary, and individual JS Sample events)\n */\n debugMode: boolean,\n};\n\nexport const defaults = (): Configuration => ({\n includeRuntimeCallStats: false,\n showAllEvents: false,\n debugMode: false,\n});\n\n/**\n * Generates a key that can be used to represent this config in a cache. This is\n * used mainly in tests, where we want to avoid re-parsing a file if we have\n * already processed it with the same configuration.\n */\nexport function configToCacheKey(config: Configuration): string {\n return JSON.stringify(config);\n}\n"]}
@@ -63,6 +63,7 @@ export interface TraceEventCallFrame {
63
63
  lineNumber: number;
64
64
  url: string;
65
65
  }
66
+ export declare function objectIsTraceEventCallFrame(object: {}): object is TraceEventCallFrame;
66
67
  export interface TraceFrame {
67
68
  frame: string;
68
69
  name: string;
@@ -78,7 +79,7 @@ export interface TraceEventSample extends TraceEventData {
78
79
  * A fake trace event created to support CDP.Profiler.Profiles in the
79
80
  * trace engine.
80
81
  */
81
- export interface SyntheticCpuProfile extends TraceEventInstant {
82
+ export interface SyntheticCpuProfile extends TraceEventInstant, SyntheticEvent<Phase.INSTANT> {
82
83
  name: 'CpuProfile';
83
84
  args: TraceEventArgs & {
84
85
  data: TraceEventArgsData & {
@@ -119,6 +120,10 @@ export interface TraceEventComplete extends TraceEventData {
119
120
  ph: Phase.COMPLETE;
120
121
  dur: MicroSeconds;
121
122
  }
123
+ export interface TraceEventRunTask extends TraceEventComplete {
124
+ name: KnownEventName.RunTask;
125
+ }
126
+ export declare function isTraceEventRunTask(event: TraceEventData): event is TraceEventRunTask;
122
127
  export interface TraceEventFireIdleCallback extends TraceEventComplete {
123
128
  name: KnownEventName.FireIdleCallback;
124
129
  args: TraceEventArgs & {
@@ -242,7 +247,8 @@ interface SyntheticArgsData {
242
247
  totalTime: MicroSeconds;
243
248
  waiting: MicroSeconds;
244
249
  }
245
- export interface SyntheticNetworkRequest extends TraceEventComplete {
250
+ export interface SyntheticNetworkRequest extends TraceEventComplete, SyntheticEvent<Phase.COMPLETE> {
251
+ rawSourceEvent: TraceEventData;
246
252
  args: TraceEventArgs & {
247
253
  data: TraceEventArgsData & {
248
254
  syntheticData: SyntheticArgsData;
@@ -251,12 +257,16 @@ export interface SyntheticNetworkRequest extends TraceEventComplete {
251
257
  frame: string;
252
258
  fromServiceWorker: boolean;
253
259
  isLinkPreload: boolean;
254
- host: string;
255
260
  mimeType: string;
256
- pathname: string;
257
- search: string;
258
261
  priority: Protocol.Network.ResourcePriority;
259
262
  initialPriority: Protocol.Network.ResourcePriority;
263
+ /**
264
+ * This is the protocol used to resolve the request.
265
+ *
266
+ * Note, this is not the same as URL.protocol.
267
+ *
268
+ * Example values (not exhaustive): http/0.9, http/1.0, http/1.1, http, h2, h3-Q050, data, blob
269
+ */
260
270
  protocol: string;
261
271
  redirects: SyntheticNetworkRedirect[];
262
272
  renderBlocking: RenderBlocking;
@@ -296,7 +306,8 @@ export declare const enum AuctionWorkletType {
296
306
  SELLER = "seller",
297
307
  UNKNOWN = "unknown"
298
308
  }
299
- export interface SyntheticAuctionWorkletEvent extends TraceEventInstant {
309
+ export interface SyntheticAuctionWorkletEvent extends TraceEventInstant, SyntheticEvent<Phase.INSTANT> {
310
+ rawSourceEvent: TraceEventData;
300
311
  name: 'SyntheticAuctionWorkletEvent';
301
312
  pid: ProcessID;
302
313
  host: string;
@@ -359,7 +370,8 @@ export interface TraceEventScreenshot extends TraceEventData {
359
370
  ph: Phase.OBJECT_SNAPSHOT;
360
371
  }
361
372
  export declare function isTraceEventScreenshot(event: TraceEventData): event is TraceEventScreenshot;
362
- export interface SyntheticScreenshot extends TraceEventData {
373
+ export interface SyntheticScreenshot extends TraceEventData, SyntheticEvent {
374
+ rawSourceEvent: TraceEventScreenshot;
363
375
  /** This is the correct presentation timestamp. */
364
376
  ts: MicroSeconds;
365
377
  args: TraceEventArgs & {
@@ -371,19 +383,22 @@ export interface SyntheticScreenshot extends TraceEventData {
371
383
  }
372
384
  export interface TraceEventAnimation extends TraceEventData {
373
385
  args: TraceEventArgs & {
374
- id?: string;
375
- name?: string;
376
- nodeId?: number;
377
- nodeName?: string;
378
- state?: string;
379
- compositeFailed?: number;
380
- unsupportedProperties?: string[];
386
+ data: TraceEventArgsData & {
387
+ nodeName?: string;
388
+ nodeId?: number;
389
+ displayName?: string;
390
+ id?: string;
391
+ name?: string;
392
+ state?: string;
393
+ compositeFailed?: number;
394
+ unsupportedProperties?: string[];
395
+ };
381
396
  };
382
397
  name: 'Animation';
383
398
  id2?: {
384
399
  local?: string;
385
400
  };
386
- ph: Phase.ASYNC_NESTABLE_START | Phase.ASYNC_NESTABLE_END;
401
+ ph: Phase.ASYNC_NESTABLE_START | Phase.ASYNC_NESTABLE_END | Phase.ASYNC_NESTABLE_INSTANT;
387
402
  }
388
403
  export interface TraceEventMetadata extends TraceEventData {
389
404
  ph: Phase.METADATA;
@@ -613,7 +628,9 @@ export interface LayoutShiftParsedData {
613
628
  cumulativeWeightedScoreInWindow: number;
614
629
  sessionWindowData: LayoutShiftSessionWindowData;
615
630
  }
616
- export interface SyntheticLayoutShift extends TraceEventLayoutShift {
631
+ export interface SyntheticLayoutShift extends TraceEventLayoutShift, SyntheticEvent<Phase.INSTANT> {
632
+ name: 'LayoutShift';
633
+ rawSourceEvent: TraceEventLayoutShift;
617
634
  args: TraceEventArgs & {
618
635
  frame: string;
619
636
  data?: LayoutShiftData & {
@@ -709,6 +726,14 @@ export interface TraceEventResourceReceiveResponse extends TraceEventInstant {
709
726
  name: 'ResourceReceiveResponse';
710
727
  args: TraceEventArgs & {
711
728
  data: TraceEventArgsData & {
729
+ /**
730
+ * This is the protocol used to resolve the request.
731
+ *
732
+ * Note, this is not the same as URL.protocol.
733
+ *
734
+ * Example values (not exhaustive): http/0.9, http/1.0, http/1.1, http, h2, h3-Q050, data, blob
735
+ */
736
+ protocol: string;
712
737
  encodedDataLength: number;
713
738
  frame: string;
714
739
  fromCache: boolean;
@@ -831,7 +856,7 @@ export interface TraceEventPrePaint extends TraceEventComplete {
831
856
  name: 'PrePaint';
832
857
  }
833
858
  export interface TraceEventPairableAsync extends TraceEventData {
834
- ph: Phase.ASYNC_NESTABLE_START | Phase.ASYNC_NESTABLE_END;
859
+ ph: Phase.ASYNC_NESTABLE_START | Phase.ASYNC_NESTABLE_END | Phase.ASYNC_NESTABLE_INSTANT;
835
860
  id2?: {
836
861
  local?: string;
837
862
  global?: string;
@@ -841,6 +866,9 @@ export interface TraceEventPairableAsync extends TraceEventData {
841
866
  export interface TraceEventPairableAsyncBegin extends TraceEventPairableAsync {
842
867
  ph: Phase.ASYNC_NESTABLE_START;
843
868
  }
869
+ export interface TraceEventPairableAsyncInstant extends TraceEventPairableAsync {
870
+ ph: Phase.ASYNC_NESTABLE_INSTANT;
871
+ }
844
872
  export interface TraceEventPairableAsyncEnd extends TraceEventPairableAsync {
845
873
  ph: Phase.ASYNC_NESTABLE_END;
846
874
  }
@@ -976,7 +1004,13 @@ export interface TraceEventPipelineReporter extends TraceEventData {
976
1004
  };
977
1005
  }
978
1006
  export declare function isTraceEventPipelineReporter(event: TraceEventData): event is TraceEventPipelineReporter;
979
- export interface SyntheticEventPair<T extends TraceEventPairableAsync = TraceEventPairableAsync> extends TraceEventData {
1007
+ interface SyntheticEvent<Ph extends Phase = Phase> extends TraceEventData {
1008
+ ph: Ph;
1009
+ rawSourceEvent: TraceEventData;
1010
+ }
1011
+ export declare function isSyntheticEvent(event: TraceEventData): event is SyntheticEvent;
1012
+ export interface SyntheticEventPair<T extends TraceEventPairableAsync = TraceEventPairableAsync> extends SyntheticEvent {
1013
+ rawSourceEvent: TraceEventData;
980
1014
  name: T['name'];
981
1015
  cat: T['cat'];
982
1016
  id?: string;
@@ -989,6 +1023,7 @@ export interface SyntheticEventPair<T extends TraceEventPairableAsync = TraceEve
989
1023
  data: {
990
1024
  beginEvent: T & TraceEventPairableAsyncBegin;
991
1025
  endEvent: T & TraceEventPairableAsyncEnd;
1026
+ instantEvents?: Array<T & TraceEventPairableAsyncInstant>;
992
1027
  };
993
1028
  };
994
1029
  }
@@ -1017,10 +1052,32 @@ export interface SyntheticTraceEntry extends TraceEventData {
1017
1052
  /**
1018
1053
  * A profile call created in the frontend from samples disguised as a
1019
1054
  * trace event.
1055
+ *
1056
+ * We store the sampleIndex, profileId and nodeId so that we can easily link
1057
+ * back a Synthetic Trace Entry to an indivdual Sample trace event within a
1058
+ * Profile.
1059
+ *
1060
+ * Because a sample contains a set of call frames representing the stack at the
1061
+ * point in time that the sample was created, we also have to store the ID of
1062
+ * the Node that points to the function call that this profile call represents.
1020
1063
  */
1021
1064
  export interface SyntheticProfileCall extends SyntheticTraceEntry {
1022
1065
  callFrame: Protocol.Runtime.CallFrame;
1023
1066
  nodeId: Protocol.integer;
1067
+ sampleIndex: number;
1068
+ profileId: ProfileID;
1069
+ }
1070
+ /**
1071
+ * A JS Sample reflects a single sample from the V8 CPU Profile
1072
+ */
1073
+ export interface SyntheticJSSample extends SyntheticTraceEntry {
1074
+ name: KnownEventName.JSSample;
1075
+ args: TraceEventArgs & {
1076
+ data: TraceEventArgsData & {
1077
+ stackTrace: Protocol.Runtime.CallFrame[];
1078
+ };
1079
+ };
1080
+ ph: Phase.INSTANT;
1024
1081
  }
1025
1082
  /**
1026
1083
  * A trace event augmented synthetically in the frontend to contain
@@ -1528,6 +1585,9 @@ export interface TraceEventV8Compile extends TraceEventComplete {
1528
1585
  data?: {
1529
1586
  url?: string;
1530
1587
  columnNumber?: number;
1588
+ consumedCacheSize?: number;
1589
+ cacheRejected?: boolean;
1590
+ cacheKind?: 'full' | 'normal';
1531
1591
  lineNumber?: number;
1532
1592
  notStreamedReason?: string;
1533
1593
  streamed?: boolean;
@@ -1620,7 +1680,6 @@ export declare const enum KnownEventName {
1620
1680
  GCCollectGarbage = "BlinkGC.AtomicPhase",
1621
1681
  CPPGCSweep = "CppGC.IncrementalSweep",
1622
1682
  ScheduleStyleRecalculation = "ScheduleStyleRecalculation",
1623
- RecalculateStyles = "RecalculateStyles",
1624
1683
  Layout = "Layout",
1625
1684
  UpdateLayoutTree = "UpdateLayoutTree",
1626
1685
  InvalidateLayout = "InvalidateLayout",
@@ -1696,6 +1755,7 @@ export declare const enum KnownEventName {
1696
1755
  StartProfiling = "CpuProfiler::StartProfiling",
1697
1756
  ProfileChunk = "ProfileChunk",
1698
1757
  UpdateCounters = "UpdateCounters",
1758
+ JSSample = "JSSample",
1699
1759
  Animation = "Animation",
1700
1760
  ParseAuthorStyleSheet = "ParseAuthorStyleSheet",
1701
1761
  EmbedderCallback = "EmbedderCallback",
@@ -1713,4 +1773,9 @@ export declare const enum KnownEventName {
1713
1773
  SchedulePostMessage = "SchedulePostMessage",
1714
1774
  HandlePostMessage = "HandlePostMessage"
1715
1775
  }
1776
+ export declare const Categories: {
1777
+ readonly Console: "blink.console";
1778
+ readonly UserTiming: "blink.user_timing";
1779
+ readonly Loading: "loading";
1780
+ };
1716
1781
  export {};
@@ -12,6 +12,16 @@ export function isAsyncPhase(phase) {
12
12
  export function isFlowPhase(phase) {
13
13
  return phase === "s" /* Phase.FLOW_START */ || phase === "t" /* Phase.FLOW_STEP */ || phase === "f" /* Phase.FLOW_END */;
14
14
  }
15
+ export function objectIsTraceEventCallFrame(object) {
16
+ return ('functionName' in object && typeof object.functionName === 'string') &&
17
+ ('scriptId' in object && (typeof object.scriptId === 'string' || typeof object.scriptId === 'number')) &&
18
+ ('columnNumber' in object && typeof object.columnNumber === 'number') &&
19
+ ('lineNumber' in object && typeof object.lineNumber === 'number') &&
20
+ ('url' in object && typeof object.url === 'string');
21
+ }
22
+ export function isTraceEventRunTask(event) {
23
+ return event.name === "RunTask" /* KnownEventName.RunTask */;
24
+ }
15
25
  export function isTraceEventAuctionWorkletRunningInProcess(event) {
16
26
  return event.name === 'AuctionWorkletRunningInProcess';
17
27
  }
@@ -61,6 +71,9 @@ export function isTraceEventScheduleStyleRecalculation(event) {
61
71
  export function isTraceEventPipelineReporter(event) {
62
72
  return event.name === "PipelineReporter" /* KnownEventName.PipelineReporter */;
63
73
  }
74
+ export function isSyntheticEvent(event) {
75
+ return 'rawSourceEvent' in event;
76
+ }
64
77
  export function isSyntheticInteractionEvent(event) {
65
78
  return Boolean('interactionId' in event && event.args?.data && 'beginEvent' in event.args.data && 'endEvent' in event.args.data);
66
79
  }
@@ -212,7 +225,8 @@ export function isTraceEventNavigationStart(traceEventData) {
212
225
  return traceEventData.name === 'navigationStart';
213
226
  }
214
227
  export function isTraceEventAnimation(traceEventData) {
215
- return traceEventData.name === 'Animation';
228
+ // We've found some rare traces with an Animtation trace event from a different category: https://crbug.com/1472375#comment7
229
+ return traceEventData.name === 'Animation' && traceEventData.cat.includes('devtools.timeline');
216
230
  }
217
231
  export function isTraceEventLayoutShift(traceEventData) {
218
232
  return traceEventData.name === 'LayoutShift';
@@ -434,4 +448,11 @@ export function isJSInvocationEvent(event) {
434
448
  }
435
449
  return false;
436
450
  }
451
+ // NOT AN EXHAUSTIVE LIST: just some categories we use and refer
452
+ // to in multiple places.
453
+ export const Categories = {
454
+ Console: 'blink.console',
455
+ UserTiming: 'blink.user_timing',
456
+ Loading: 'loading',
457
+ };
437
458
  //# sourceMappingURL=TraceEvents.js.map