@paulirish/trace_engine 0.0.65 → 0.0.67-beta.0

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 (720) hide show
  1. package/README.md +19 -17
  2. package/analyze-trace.mjs +6 -144
  3. package/core/common/Base64.d.ts +12 -0
  4. package/core/common/CharacterIdMap.d.ts +5 -0
  5. package/core/common/Color.d.ts +357 -0
  6. package/core/common/ColorConverter.d.ts +26 -0
  7. package/core/common/ColorUtils.d.ts +45 -0
  8. package/core/common/Console.d.ts +54 -0
  9. package/core/common/Debouncer.d.ts +8 -0
  10. package/core/common/EventTarget.d.ts +22 -0
  11. package/core/common/Gzip.d.ts +23 -0
  12. package/core/common/JavaScriptMetaData.d.ts +20 -0
  13. package/core/common/Lazy.d.ts +4 -0
  14. package/core/common/MapWithDefault.d.ts +9 -0
  15. package/core/common/Mutex.d.ts +13 -0
  16. package/core/common/Object.d.ts +20 -0
  17. package/core/common/ParsedURL.d.ts +87 -0
  18. package/core/common/Progress.d.ts +47 -0
  19. package/core/common/ResolverBase.d.ts +29 -0
  20. package/core/common/ResourceType.d.ts +52 -0
  21. package/core/common/ReturnToPanel.d.ts +10 -0
  22. package/core/common/Revealer.d.ts +66 -0
  23. package/core/common/Runnable.d.ts +14 -0
  24. package/core/common/SegmentedRange.d.ts +14 -0
  25. package/core/common/SettingRegistration.d.ts +136 -0
  26. package/core/common/Settings.d.ts +226 -0
  27. package/core/common/SimpleHistoryManager.d.ts +20 -0
  28. package/core/common/Srcset.d.ts +16 -0
  29. package/core/common/StringOutputStream.d.ts +10 -0
  30. package/core/common/TextDictionary.d.ts +11 -0
  31. package/core/common/Throttler.d.ts +12 -0
  32. package/core/common/Trie.d.ts +24 -0
  33. package/core/common/VersionController.d.ts +85 -0
  34. package/core/common/common.d.ts +33 -1
  35. package/core/host/AidaClient.d.ts +73 -0
  36. package/core/host/AidaClientTypes.d.ts +355 -0
  37. package/core/host/AidaGcaTranslation.d.ts +10 -0
  38. package/core/host/DispatchHttpRequestClient.d.ts +14 -0
  39. package/core/host/GcaClient.d.ts +14 -0
  40. package/core/host/GcaTypes.d.ts +411 -0
  41. package/core/host/GdpClient.d.ts +84 -0
  42. package/core/host/InspectorFrontendHost.d.ts +29 -0
  43. package/core/host/InspectorFrontendHostAPI.d.ts +425 -0
  44. package/core/host/InspectorFrontendHostStub.d.ts +151 -0
  45. package/core/host/Platform.d.ts +11 -0
  46. package/core/host/ResourceLoader.d.ts +15 -0
  47. package/core/host/UserMetrics.d.ts +116 -0
  48. package/core/host/UserMetricsEnums.d.ts +883 -0
  49. package/core/host/host.d.ts +13 -1
  50. package/core/i18n/ByteUtilities.d.ts +11 -0
  51. package/core/i18n/DevToolsLocale.d.ts +41 -0
  52. package/core/i18n/NumberFormatter.d.ts +11 -0
  53. package/core/i18n/i18n.d.ts +10 -0
  54. package/core/i18n/i18nImpl.d.ts +64 -0
  55. package/core/i18n/i18nTypes.d.ts +5 -0
  56. package/core/i18n/locales.d.ts +15 -0
  57. package/core/i18n/time-utilities.d.ts +16 -0
  58. package/core/platform/ArrayUtilities.d.ts +5 -0
  59. package/core/platform/HostRuntime.d.ts +1 -0
  60. package/core/platform/Size.d.ts +12 -0
  61. package/core/platform/StringUtilities.d.ts +28 -0
  62. package/core/platform/TypescriptUtilities.d.ts +0 -6
  63. package/core/platform/api/HostRuntime.d.ts +25 -0
  64. package/core/platform/platform.d.ts +2 -1
  65. package/core/protocol_client/CDPConnection.d.ts +77 -0
  66. package/core/protocol_client/ConnectionTransport.d.ts +9 -0
  67. package/core/protocol_client/DevToolsCDPConnection.d.ts +16 -0
  68. package/core/protocol_client/InspectorBackend.d.ts +223 -0
  69. package/core/protocol_client/protocol_client.d.ts +5 -0
  70. package/core/root/DevToolsContext.d.ts +34 -0
  71. package/core/root/ExperimentNames.d.ts +8 -0
  72. package/core/root/Runtime.d.ts +351 -0
  73. package/core/root/root.d.ts +4 -1
  74. package/core/sdk/AccessibilityModel.d.ts +76 -0
  75. package/core/sdk/AnimationModel.d.ts +161 -0
  76. package/core/sdk/AutofillModel.d.ts +23 -0
  77. package/core/sdk/CPUProfilerModel.d.ts +46 -0
  78. package/core/sdk/CPUThrottlingManager.d.ts +47 -0
  79. package/core/sdk/CSSContainerQuery.d.ts +42 -0
  80. package/core/sdk/CSSFontFace.d.ts +10 -0
  81. package/core/sdk/CSSLayer.d.ts +9 -0
  82. package/core/sdk/CSSLocation.d.ts +14 -0
  83. package/core/sdk/CSSMatchedStyles.d.ts +138 -0
  84. package/core/sdk/CSSMedia.d.ts +36 -0
  85. package/core/sdk/CSSMetadata.d.ts +87 -0
  86. package/core/sdk/CSSModel.d.ts +180 -0
  87. package/core/sdk/CSSNavigation.d.ts +10 -0
  88. package/core/sdk/CSSProperty.d.ts +53 -0
  89. package/core/sdk/CSSPropertyParser.d.ts +131 -0
  90. package/core/sdk/CSSPropertyParserMatchers.d.ts +442 -0
  91. package/core/sdk/CSSQuery.d.ts +22 -0
  92. package/core/sdk/CSSRule.d.ts +132 -0
  93. package/core/sdk/CSSScope.d.ts +9 -0
  94. package/core/sdk/CSSStartingStyle.d.ts +9 -0
  95. package/core/sdk/CSSStyleDeclaration.d.ts +38 -0
  96. package/core/sdk/CSSStyleSheetHeader.d.ts +53 -0
  97. package/core/sdk/CSSSupports.d.ts +10 -0
  98. package/core/sdk/CategorizedBreakpoint.d.ts +42 -0
  99. package/core/sdk/ChildTargetManager.d.ts +40 -0
  100. package/core/sdk/CompilerSourceMappingContentProvider.d.ts +12 -0
  101. package/core/sdk/Connections.d.ts +36 -0
  102. package/core/sdk/ConsoleModel.d.ts +127 -0
  103. package/core/sdk/ConsoleModelTypes.d.ts +6 -0
  104. package/core/sdk/Cookie.d.ts +68 -0
  105. package/core/sdk/CookieModel.d.ts +31 -0
  106. package/core/sdk/CookieParser.d.ts +14 -0
  107. package/core/sdk/CrashReportContextModel.d.ts +8 -0
  108. package/core/sdk/DOMDebuggerModel.d.ts +127 -0
  109. package/core/sdk/DOMModel.d.ts +436 -0
  110. package/core/sdk/DOMStorageModel.d.ts +79 -0
  111. package/core/sdk/DebuggerModel.d.ts +272 -0
  112. package/core/sdk/EmulationModel.d.ts +95 -0
  113. package/core/sdk/EnhancedTracesParser.d.ts +105 -0
  114. package/core/sdk/EventBreakpointsModel.d.ts +66 -0
  115. package/core/sdk/FrameAssociated.d.ts +6 -0
  116. package/core/sdk/FrameManager.d.ts +68 -0
  117. package/core/sdk/HeapProfilerModel.d.ts +75 -0
  118. package/core/sdk/HttpReasonPhraseStrings.d.ts +5 -0
  119. package/core/sdk/IOModel.d.ts +10 -0
  120. package/core/sdk/IsolateManager.d.ts +53 -0
  121. package/core/sdk/IssuesModel.d.ts +28 -0
  122. package/core/sdk/LayerTreeBase.d.ts +70 -0
  123. package/core/sdk/LogModel.d.ts +20 -0
  124. package/core/sdk/NetworkManager.d.ts +418 -0
  125. package/core/sdk/NetworkRequest.d.ts +469 -0
  126. package/core/sdk/NetworkRequestAccess.d.ts +91 -0
  127. package/core/sdk/OverlayColorGenerator.d.ts +14 -0
  128. package/core/sdk/OverlayModel.d.ts +186 -0
  129. package/core/sdk/OverlayPersistentHighlighter.d.ts +116 -0
  130. package/core/sdk/PageFunctions.d.ts +22 -0
  131. package/core/sdk/PageLoad.d.ts +14 -0
  132. package/core/sdk/PageResourceLoader.d.ts +111 -0
  133. package/core/sdk/PaintProfiler.d.ts +43 -0
  134. package/core/sdk/PerformanceMetricsModel.d.ts +12 -0
  135. package/core/sdk/PreloadingModel.d.ts +146 -0
  136. package/core/sdk/RehydratingConnection.d.ts +73 -0
  137. package/core/sdk/RehydratingObject.d.ts +59 -0
  138. package/core/sdk/RemoteObject.d.ts +210 -0
  139. package/core/sdk/Resource.d.ts +36 -0
  140. package/core/sdk/ResourceTreeModel.d.ts +278 -0
  141. package/core/sdk/RuntimeModel.d.ts +163 -0
  142. package/core/sdk/SDKModel.d.ts +30 -0
  143. package/core/sdk/SDKSettings.d.ts +53 -0
  144. package/core/sdk/ScopeTreeCache.d.ts +21 -0
  145. package/core/sdk/ScreenCaptureModel.d.ts +69 -0
  146. package/core/sdk/Script.d.ts +134 -0
  147. package/core/sdk/SecurityOrigin.d.ts +108 -0
  148. package/core/sdk/SecurityOriginManager.d.ts +23 -0
  149. package/core/sdk/ServerSentEvents.d.ts +18 -0
  150. package/core/sdk/ServerSentEventsProtocol.d.ts +18 -0
  151. package/core/sdk/ServerTiming.d.ts +24 -0
  152. package/core/sdk/ServiceWorkerCacheModel.d.ts +71 -0
  153. package/core/sdk/ServiceWorkerManager.d.ts +125 -0
  154. package/core/sdk/SourceMap.d.ts +197 -0
  155. package/core/sdk/SourceMapCache.d.ts +12 -0
  156. package/core/sdk/SourceMapFunctionRanges.d.ts +26 -0
  157. package/core/sdk/SourceMapManager.d.ts +46 -0
  158. package/core/sdk/SourceMapRangeMappings.d.ts +15 -0
  159. package/core/sdk/SourceMapScopeChainEntry.d.ts +23 -0
  160. package/core/sdk/SourceMapScopesInfo.d.ts +109 -0
  161. package/core/sdk/StorageBucketsModel.d.ts +48 -0
  162. package/core/sdk/StorageKeyManager.d.ts +38 -0
  163. package/core/sdk/Target.d.ts +79 -0
  164. package/core/sdk/TargetManager.d.ts +92 -0
  165. package/core/sdk/TraceObject.d.ts +43 -0
  166. package/core/sdk/WebAuthnModel.d.ts +29 -0
  167. package/core/sdk/sdk.d.ts +97 -1
  168. package/core/text_utils/CodeMirrorUtils.d.ts +3 -0
  169. package/core/text_utils/ContentData.d.ts +94 -0
  170. package/core/text_utils/ContentProvider.d.ts +42 -0
  171. package/core/text_utils/StaticContentProvider.d.ts +13 -0
  172. package/core/text_utils/StreamingContentData.d.ts +49 -0
  173. package/core/text_utils/Text.d.ts +19 -0
  174. package/core/text_utils/TextCursor.d.ts +9 -0
  175. package/core/text_utils/TextRange.d.ts +81 -0
  176. package/core/text_utils/TextUtils.d.ts +97 -0
  177. package/core/text_utils/WasmDisassembly.d.ts +29 -0
  178. package/core/text_utils/text_utils.d.ts +11 -0
  179. package/entrypoints/formatter_actions/formatter_actions.d.ts +48 -0
  180. package/generated/InspectorBackendCommands.d.ts +14 -0
  181. package/generated/SupportedCSSProperties.d.ts +18 -0
  182. package/generated/protocol-mapping.d.ts +5930 -0
  183. package/generated/protocol-proxy-api.d.ts +5396 -0
  184. package/generated/protocol.d.ts +736 -685
  185. package/index.js +6 -0
  186. package/locales/af.json +80 -62
  187. package/locales/am.json +363 -345
  188. package/locales/ar.json +364 -346
  189. package/locales/as.json +362 -344
  190. package/locales/az.json +353 -335
  191. package/locales/be.json +363 -345
  192. package/locales/bg.json +363 -345
  193. package/locales/bn.json +363 -345
  194. package/locales/bs.json +259 -241
  195. package/locales/ca.json +295 -277
  196. package/locales/cs.json +348 -330
  197. package/locales/cy.json +139 -121
  198. package/locales/da.json +222 -204
  199. package/locales/de.json +234 -216
  200. package/locales/el.json +348 -330
  201. package/locales/en-GB.json +36 -18
  202. package/locales/es-419.json +290 -272
  203. package/locales/es.json +292 -274
  204. package/locales/et.json +251 -233
  205. package/locales/eu.json +29 -11
  206. package/locales/fa.json +363 -345
  207. package/locales/fi.json +295 -277
  208. package/locales/fil.json +29 -11
  209. package/locales/fr-CA.json +320 -302
  210. package/locales/fr.json +317 -299
  211. package/locales/gl.json +276 -258
  212. package/locales/gu.json +364 -346
  213. package/locales/he.json +364 -346
  214. package/locales/hi.json +348 -330
  215. package/locales/hr.json +250 -232
  216. package/locales/hu.json +354 -336
  217. package/locales/hy.json +363 -345
  218. package/locales/id.json +27 -9
  219. package/locales/is.json +317 -299
  220. package/locales/it.json +154 -136
  221. package/locales/ja.json +363 -345
  222. package/locales/ka.json +364 -346
  223. package/locales/kk.json +364 -346
  224. package/locales/km.json +363 -345
  225. package/locales/kn.json +364 -346
  226. package/locales/ko.json +363 -345
  227. package/locales/ky.json +362 -344
  228. package/locales/lo.json +364 -346
  229. package/locales/lt.json +331 -313
  230. package/locales/lv.json +331 -313
  231. package/locales/mk.json +364 -346
  232. package/locales/ml.json +363 -345
  233. package/locales/mn.json +363 -345
  234. package/locales/mr.json +363 -345
  235. package/locales/ms.json +27 -9
  236. package/locales/my.json +362 -344
  237. package/locales/ne.json +348 -330
  238. package/locales/nl.json +84 -66
  239. package/locales/no.json +188 -170
  240. package/locales/or.json +363 -345
  241. package/locales/pa.json +363 -345
  242. package/locales/pl.json +322 -304
  243. package/locales/pt-PT.json +284 -266
  244. package/locales/pt.json +283 -265
  245. package/locales/ro.json +318 -300
  246. package/locales/ru.json +363 -345
  247. package/locales/si.json +364 -346
  248. package/locales/sk.json +345 -327
  249. package/locales/sl.json +231 -213
  250. package/locales/sq.json +329 -311
  251. package/locales/sr-Latn.json +267 -249
  252. package/locales/sr.json +364 -346
  253. package/locales/sv.json +296 -278
  254. package/locales/sw.json +35 -17
  255. package/locales/ta.json +364 -346
  256. package/locales/te.json +362 -344
  257. package/locales/th.json +364 -346
  258. package/locales/tr.json +337 -319
  259. package/locales/uk.json +363 -345
  260. package/locales/ur.json +364 -346
  261. package/locales/uz.json +175 -157
  262. package/locales/vi.json +364 -346
  263. package/locales/zh-HK.json +364 -346
  264. package/locales/zh-TW.json +363 -345
  265. package/locales/zh.json +363 -345
  266. package/locales/zu.json +35 -17
  267. package/models/crux-manager/CrUXManager.d.ts +107 -0
  268. package/models/crux-manager/crux-manager.d.ts +1 -0
  269. package/models/emulation/DeviceModeModel.d.ts +156 -0
  270. package/models/emulation/EmulatedDevices.d.ts +148 -0
  271. package/models/emulation/emulation.d.ts +3 -0
  272. package/models/formatter/FormatterWorkerPool.d.ts +58 -0
  273. package/models/formatter/ScriptFormatter.d.ts +11 -0
  274. package/models/formatter/formatter.d.ts +3 -0
  275. package/models/trace/ModelImpl.d.ts +2 -6
  276. package/models/trace/Processor.d.ts +2 -6
  277. package/models/trace/extras/StackTraceForEvent.d.ts +1 -1
  278. package/models/trace/extras/extras.d.ts +2 -7
  279. package/models/trace/handlers/FramesHandler.d.ts +1 -2
  280. package/models/trace/handlers/LayoutShiftsHandler.d.ts +2 -2
  281. package/models/trace/handlers/MetaHandler.d.ts +2 -3
  282. package/models/trace/handlers/ModelHandlers.d.ts +0 -1
  283. package/models/trace/handlers/PageLoadMetricsHandler.d.ts +2 -0
  284. package/models/trace/handlers/ScriptsHandler.d.ts +2 -2
  285. package/models/trace/handlers/Threads.d.ts +1 -3
  286. package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
  287. package/models/trace/helpers/Network.d.ts +3 -1
  288. package/models/trace/helpers/SyntheticEvents.d.ts +7 -0
  289. package/models/trace/insights/CLSCulprits.d.ts +6 -3
  290. package/models/trace/insights/Cache.d.ts +2 -1
  291. package/models/trace/insights/CharacterSet.d.ts +5 -4
  292. package/models/trace/insights/Common.d.ts +4 -4
  293. package/models/trace/insights/DOMSize.d.ts +4 -3
  294. package/models/trace/insights/DocumentLatency.d.ts +2 -1
  295. package/models/trace/insights/DuplicatedJavaScript.d.ts +9 -4
  296. package/models/trace/insights/FontDisplay.d.ts +11 -5
  297. package/models/trace/insights/ForcedReflow.d.ts +6 -6
  298. package/models/trace/insights/INPBreakdown.d.ts +5 -5
  299. package/models/trace/insights/ImageDelivery.d.ts +7 -7
  300. package/models/trace/insights/LCPBreakdown.d.ts +4 -3
  301. package/models/trace/insights/LCPDiscovery.d.ts +7 -6
  302. package/models/trace/insights/LegacyJavaScript.d.ts +9 -4
  303. package/models/trace/insights/ModernHTTP.d.ts +6 -6
  304. package/models/trace/insights/NetworkDependencyTree.d.ts +18 -96
  305. package/models/trace/insights/RenderBlocking.d.ts +4 -3
  306. package/models/trace/insights/SlowCSSSelector.d.ts +10 -9
  307. package/models/trace/insights/ThirdParties.d.ts +17 -8
  308. package/models/trace/insights/Viewport.d.ts +6 -4
  309. package/models/trace/insights/types.d.ts +10 -7
  310. package/models/trace/lantern/lantern.js +6 -8
  311. package/models/trace/lantern/simulation/Constants.d.ts +29 -28
  312. package/models/trace/trace.js +529 -18
  313. package/models/trace/types/Configuration.d.ts +12 -1
  314. package/models/trace/types/File.d.ts +6 -5
  315. package/models/trace/types/Overlays.d.ts +13 -3
  316. package/models/trace/types/Timing.js +6 -14
  317. package/models/trace/types/TraceEvents.d.ts +48 -18
  318. package/models/trace/types/TraceEvents.js +187 -884
  319. package/models/trace/types/types.js +6 -8
  320. package/package.json +30 -9
  321. package/third_party/codemirror.next/codemirror.next.d.ts +9196 -0
  322. package/third_party/i18n/i18n-impl.d.ts +25 -0
  323. package/third_party/i18n/i18n.d.ts +3 -0
  324. package/third_party/i18n/localized-string-set.d.ts +49 -0
  325. package/third_party/intl-messageformat/intl-messageformat.d.ts +1 -0
  326. package/third_party/legacy-javascript/legacy-javascript.d.ts +2 -1
  327. package/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
  328. package/third_party/source-map-scopes-codec/package/src/builder/builder.d.ts +67 -0
  329. package/third_party/source-map-scopes-codec/package/src/builder/safe_builder.d.ts +38 -0
  330. package/third_party/source-map-scopes-codec/package/src/codec.d.ts +48 -0
  331. package/third_party/source-map-scopes-codec/package/src/decode/decode.d.ts +31 -0
  332. package/third_party/source-map-scopes-codec/package/src/encode/encode.d.ts +8 -0
  333. package/third_party/source-map-scopes-codec/package/src/encode/encoder.d.ts +6 -0
  334. package/third_party/source-map-scopes-codec/package/src/mod.d.ts +5 -0
  335. package/third_party/source-map-scopes-codec/package/src/scopes.d.ts +168 -0
  336. package/third_party/source-map-scopes-codec/package/src/util.d.ts +5 -0
  337. package/third_party/source-map-scopes-codec/package/src/vlq.d.ts +14 -0
  338. package/third_party/source-map-scopes-codec/source-map-scopes-codec.d.ts +1 -0
  339. package/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
  340. package/third_party/third-party-web/package/lib/index.d.ts +34 -0
  341. package/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
  342. package/third_party/third-party-web/third-party-web.d.ts +2 -1
  343. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts +0 -13
  344. package/.tmp/tsbuildinfo/analyze-inspector-issues.d.mts.map +0 -1
  345. package/.tmp/tsbuildinfo/analyze-trace.d.mts +0 -17
  346. package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +0 -1
  347. package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +0 -4
  348. package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +0 -1
  349. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts +0 -2
  350. package/.tmp/tsbuildinfo/test/test-trace-engine.d.mts.map +0 -1
  351. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts +0 -3
  352. package/.tmp/tsbuildinfo/third_party/third-party-web/third-party-web.d.ts.map +0 -1
  353. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +0 -1
  354. package/analyze-inspector-issues.mjs +0 -60
  355. package/core/common/common.js +0 -1
  356. package/core/host/host.js +0 -1
  357. package/core/platform/ArrayUtilities.js +0 -210
  358. package/core/platform/ArrayUtilities.js.map +0 -1
  359. package/core/platform/Brand.js +0 -5
  360. package/core/platform/Brand.js.map +0 -1
  361. package/core/platform/Constructor.js +0 -5
  362. package/core/platform/Constructor.js.map +0 -1
  363. package/core/platform/DateUtilities.js +0 -14
  364. package/core/platform/DateUtilities.js.map +0 -1
  365. package/core/platform/DevToolsPath.js +0 -28
  366. package/core/platform/DevToolsPath.js.map +0 -1
  367. package/core/platform/HostRuntime.js +0 -31
  368. package/core/platform/HostRuntime.js.map +0 -1
  369. package/core/platform/KeyboardUtilities.js +0 -22
  370. package/core/platform/KeyboardUtilities.js.map +0 -1
  371. package/core/platform/MapUtilities.js +0 -80
  372. package/core/platform/MapUtilities.js.map +0 -1
  373. package/core/platform/MimeType.js +0 -144
  374. package/core/platform/MimeType.js.map +0 -1
  375. package/core/platform/NumberUtilities.js +0 -73
  376. package/core/platform/NumberUtilities.js.map +0 -1
  377. package/core/platform/StringUtilities.js +0 -594
  378. package/core/platform/StringUtilities.js.map +0 -1
  379. package/core/platform/Timing.js +0 -10
  380. package/core/platform/Timing.js.map +0 -1
  381. package/core/platform/TypedArrayUtilities.js +0 -158
  382. package/core/platform/TypedArrayUtilities.js.map +0 -1
  383. package/core/platform/TypescriptUtilities.js +0 -25
  384. package/core/platform/TypescriptUtilities.js.map +0 -1
  385. package/core/platform/UIString.js +0 -5
  386. package/core/platform/UIString.js.map +0 -1
  387. package/core/platform/UserVisibleError.js +0 -23
  388. package/core/platform/UserVisibleError.js.map +0 -1
  389. package/core/platform/api/HostRuntime.js +0 -5
  390. package/core/platform/api/HostRuntime.js.map +0 -1
  391. package/core/platform/api/api-tsconfig.json +0 -43
  392. package/core/platform/api/api.js +0 -6
  393. package/core/platform/api/api.js.map +0 -1
  394. package/core/platform/api/api_node_typecheck-tsconfig.json +0 -48
  395. package/core/platform/api/bundle-tsconfig.json +0 -1
  396. package/core/platform/api/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  397. package/core/platform/browser/HostRuntime.js +0 -75
  398. package/core/platform/browser/HostRuntime.js.map +0 -1
  399. package/core/platform/browser/browser-tsconfig.json +0 -48
  400. package/core/platform/browser/browser.js +0 -6
  401. package/core/platform/browser/browser.js.map +0 -1
  402. package/core/platform/browser/bundle-tsconfig.json +0 -1
  403. package/core/platform/browser/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  404. package/core/platform/bundle-tsconfig.json +0 -1
  405. package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  406. package/core/platform/node/HostRuntime.js +0 -82
  407. package/core/platform/node/HostRuntime.js.map +0 -1
  408. package/core/platform/node/bundle-tsconfig.json +0 -1
  409. package/core/platform/node/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  410. package/core/platform/node/node-tsconfig.json +0 -52
  411. package/core/platform/node/node.js +0 -6
  412. package/core/platform/node/node.js.map +0 -1
  413. package/core/platform/platform-tsconfig.json +0 -69
  414. package/core/platform/platform.js +0 -27
  415. package/core/platform/platform.js.map +0 -1
  416. package/core/platform/platform_node_typecheck-tsconfig.json +0 -74
  417. package/core/root/root.js +0 -1
  418. package/core/sdk/sdk.js +0 -1
  419. package/generated/protocol.js +0 -5
  420. package/locales/en-US.json +0 -1046
  421. package/locales/en-XL.json +0 -1046
  422. package/models/cpu_profile/CPUProfileDataModel.js +0 -517
  423. package/models/cpu_profile/CPUProfileDataModel.js.map +0 -1
  424. package/models/cpu_profile/ProfileTreeModel.js +0 -90
  425. package/models/cpu_profile/ProfileTreeModel.js.map +0 -1
  426. package/models/cpu_profile/bundle-tsconfig.json +0 -1
  427. package/models/cpu_profile/cpu_profile-tsconfig.json +0 -52
  428. package/models/cpu_profile/cpu_profile.js +0 -7
  429. package/models/cpu_profile/cpu_profile.js.map +0 -1
  430. package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  431. package/models/issues_manager/CheckFormsIssuesTrigger.d.ts +0 -1
  432. package/models/issues_manager/CheckFormsIssuesTrigger.js +0 -1
  433. package/models/issues_manager/ContrastCheckTrigger.d.ts +0 -1
  434. package/models/issues_manager/ContrastCheckTrigger.js +0 -1
  435. package/models/issues_manager/DeprecationIssue.d.ts +0 -1
  436. package/models/issues_manager/DeprecationIssue.js +0 -1
  437. package/models/issues_manager/IssueResolver.d.ts +0 -1
  438. package/models/issues_manager/IssueResolver.js +0 -1
  439. package/models/issues_manager/RelatedIssue.d.ts +0 -1
  440. package/models/issues_manager/RelatedIssue.js +0 -1
  441. package/models/issues_manager/SourceFrameIssuesManager.d.ts +0 -1
  442. package/models/issues_manager/SourceFrameIssuesManager.js +0 -1
  443. package/models/trace/EntityMapper.js +0 -133
  444. package/models/trace/EntityMapper.js.map +0 -1
  445. package/models/trace/EventsSerializer.js +0 -90
  446. package/models/trace/EventsSerializer.js.map +0 -1
  447. package/models/trace/LanternComputationData.js +0 -367
  448. package/models/trace/LanternComputationData.js.map +0 -1
  449. package/models/trace/LegacyTracingModel.d.ts +0 -1
  450. package/models/trace/LegacyTracingModel.js +0 -1
  451. package/models/trace/ModelImpl.js +0 -170
  452. package/models/trace/ModelImpl.js.map +0 -1
  453. package/models/trace/Name.js +0 -115
  454. package/models/trace/Name.js.map +0 -1
  455. package/models/trace/Processor.js +0 -556
  456. package/models/trace/Processor.js.map +0 -1
  457. package/models/trace/Styles.js +0 -824
  458. package/models/trace/Styles.js.map +0 -1
  459. package/models/trace/TracingManager.d.ts +0 -1
  460. package/models/trace/TracingManager.js +0 -1
  461. package/models/trace/bundle-tsconfig.json +0 -1
  462. package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -66
  463. package/models/trace/extras/FilmStrip.js +0 -45
  464. package/models/trace/extras/FilmStrip.js.map +0 -1
  465. package/models/trace/extras/Initiators.js +0 -47
  466. package/models/trace/extras/Initiators.js.map +0 -1
  467. package/models/trace/extras/MainThreadActivity.js +0 -77
  468. package/models/trace/extras/MainThreadActivity.js.map +0 -1
  469. package/models/trace/extras/ScriptDuplication.js +0 -163
  470. package/models/trace/extras/ScriptDuplication.js.map +0 -1
  471. package/models/trace/extras/StackTraceForEvent.js +0 -192
  472. package/models/trace/extras/StackTraceForEvent.js.map +0 -1
  473. package/models/trace/extras/ThirdParties.js +0 -119
  474. package/models/trace/extras/ThirdParties.js.map +0 -1
  475. package/models/trace/extras/TraceFilter.js +0 -51
  476. package/models/trace/extras/TraceFilter.js.map +0 -1
  477. package/models/trace/extras/TraceTree.js +0 -621
  478. package/models/trace/extras/TraceTree.js.map +0 -1
  479. package/models/trace/extras/bundle-tsconfig.json +0 -1
  480. package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  481. package/models/trace/extras/extras-tsconfig.json +0 -70
  482. package/models/trace/extras/extras.js +0 -13
  483. package/models/trace/extras/extras.js.map +0 -1
  484. package/models/trace/handlers/AnimationFramesHandler.js +0 -110
  485. package/models/trace/handlers/AnimationFramesHandler.js.map +0 -1
  486. package/models/trace/handlers/AnimationHandler.js +0 -27
  487. package/models/trace/handlers/AnimationHandler.js.map +0 -1
  488. package/models/trace/handlers/AsyncJSCallsHandler.js +0 -188
  489. package/models/trace/handlers/AsyncJSCallsHandler.js.map +0 -1
  490. package/models/trace/handlers/AuctionWorkletsHandler.d.ts +0 -8
  491. package/models/trace/handlers/AuctionWorkletsHandler.js +0 -163
  492. package/models/trace/handlers/AuctionWorkletsHandler.js.map +0 -1
  493. package/models/trace/handlers/DOMStatsHandler.js +0 -22
  494. package/models/trace/handlers/DOMStatsHandler.js.map +0 -1
  495. package/models/trace/handlers/ExtensionTraceDataHandler.js +0 -264
  496. package/models/trace/handlers/ExtensionTraceDataHandler.js.map +0 -1
  497. package/models/trace/handlers/FlowsHandler.js +0 -149
  498. package/models/trace/handlers/FlowsHandler.js.map +0 -1
  499. package/models/trace/handlers/FramesHandler.js +0 -492
  500. package/models/trace/handlers/FramesHandler.js.map +0 -1
  501. package/models/trace/handlers/GPUHandler.js +0 -36
  502. package/models/trace/handlers/GPUHandler.js.map +0 -1
  503. package/models/trace/handlers/ImagePaintingHandler.js +0 -148
  504. package/models/trace/handlers/ImagePaintingHandler.js.map +0 -1
  505. package/models/trace/handlers/InitiatorsHandler.js +0 -181
  506. package/models/trace/handlers/InitiatorsHandler.js.map +0 -1
  507. package/models/trace/handlers/InvalidationsHandler.js +0 -127
  508. package/models/trace/handlers/InvalidationsHandler.js.map +0 -1
  509. package/models/trace/handlers/LargestImagePaintHandler.js +0 -86
  510. package/models/trace/handlers/LargestImagePaintHandler.js.map +0 -1
  511. package/models/trace/handlers/LargestTextPaintHandler.js +0 -28
  512. package/models/trace/handlers/LargestTextPaintHandler.js.map +0 -1
  513. package/models/trace/handlers/LayerTreeHandler.js +0 -104
  514. package/models/trace/handlers/LayerTreeHandler.js.map +0 -1
  515. package/models/trace/handlers/LayoutShiftsHandler.js +0 -458
  516. package/models/trace/handlers/LayoutShiftsHandler.js.map +0 -1
  517. package/models/trace/handlers/MemoryHandler.js +0 -22
  518. package/models/trace/handlers/MemoryHandler.js.map +0 -1
  519. package/models/trace/handlers/MetaHandler.js +0 -411
  520. package/models/trace/handlers/MetaHandler.js.map +0 -1
  521. package/models/trace/handlers/ModelHandlers.js +0 -34
  522. package/models/trace/handlers/ModelHandlers.js.map +0 -1
  523. package/models/trace/handlers/NetworkRequestsHandler.js +0 -576
  524. package/models/trace/handlers/NetworkRequestsHandler.js.map +0 -1
  525. package/models/trace/handlers/PageFramesHandler.js +0 -43
  526. package/models/trace/handlers/PageFramesHandler.js.map +0 -1
  527. package/models/trace/handlers/PageLoadMetricsHandler.js +0 -423
  528. package/models/trace/handlers/PageLoadMetricsHandler.js.map +0 -1
  529. package/models/trace/handlers/RendererHandler.js +0 -347
  530. package/models/trace/handlers/RendererHandler.js.map +0 -1
  531. package/models/trace/handlers/SamplesHandler.js +0 -261
  532. package/models/trace/handlers/SamplesHandler.js.map +0 -1
  533. package/models/trace/handlers/ScreenshotsHandler.js +0 -98
  534. package/models/trace/handlers/ScreenshotsHandler.js.map +0 -1
  535. package/models/trace/handlers/ScriptsHandler.js +0 -286
  536. package/models/trace/handlers/ScriptsHandler.js.map +0 -1
  537. package/models/trace/handlers/SelectorStatsHandler.js +0 -72
  538. package/models/trace/handlers/SelectorStatsHandler.js.map +0 -1
  539. package/models/trace/handlers/Threads.js +0 -112
  540. package/models/trace/handlers/Threads.js.map +0 -1
  541. package/models/trace/handlers/UserInteractionsHandler.js +0 -319
  542. package/models/trace/handlers/UserInteractionsHandler.js.map +0 -1
  543. package/models/trace/handlers/UserTimingsHandler.js +0 -184
  544. package/models/trace/handlers/UserTimingsHandler.js.map +0 -1
  545. package/models/trace/handlers/WarningsHandler.js +0 -135
  546. package/models/trace/handlers/WarningsHandler.js.map +0 -1
  547. package/models/trace/handlers/WorkersHandler.js +0 -34
  548. package/models/trace/handlers/WorkersHandler.js.map +0 -1
  549. package/models/trace/handlers/bundle-tsconfig.json +0 -1
  550. package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  551. package/models/trace/handlers/handlers-tsconfig.json +0 -102
  552. package/models/trace/handlers/handlers.js +0 -8
  553. package/models/trace/handlers/handlers.js.map +0 -1
  554. package/models/trace/handlers/helpers.js +0 -164
  555. package/models/trace/handlers/helpers.js.map +0 -1
  556. package/models/trace/handlers/types.js +0 -2
  557. package/models/trace/handlers/types.js.map +0 -1
  558. package/models/trace/helpers/Extensions.js +0 -42
  559. package/models/trace/helpers/Extensions.js.map +0 -1
  560. package/models/trace/helpers/Network.js +0 -103
  561. package/models/trace/helpers/Network.js.map +0 -1
  562. package/models/trace/helpers/SamplesIntegrator.js +0 -496
  563. package/models/trace/helpers/SamplesIntegrator.js.map +0 -1
  564. package/models/trace/helpers/SyntheticEvents.js +0 -75
  565. package/models/trace/helpers/SyntheticEvents.js.map +0 -1
  566. package/models/trace/helpers/Timing.js +0 -194
  567. package/models/trace/helpers/Timing.js.map +0 -1
  568. package/models/trace/helpers/Trace.js +0 -817
  569. package/models/trace/helpers/Trace.js.map +0 -1
  570. package/models/trace/helpers/TreeHelpers.js +0 -255
  571. package/models/trace/helpers/TreeHelpers.js.map +0 -1
  572. package/models/trace/helpers/bundle-tsconfig.json +0 -1
  573. package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  574. package/models/trace/helpers/helpers-tsconfig.json +0 -69
  575. package/models/trace/helpers/helpers.js +0 -11
  576. package/models/trace/helpers/helpers.js.map +0 -1
  577. package/models/trace/insights/CLSCulprits.js +0 -518
  578. package/models/trace/insights/CLSCulprits.js.map +0 -1
  579. package/models/trace/insights/Cache.js +0 -210
  580. package/models/trace/insights/Cache.js.map +0 -1
  581. package/models/trace/insights/CharacterSet.js +0 -132
  582. package/models/trace/insights/CharacterSet.js.map +0 -1
  583. package/models/trace/insights/Common.js +0 -348
  584. package/models/trace/insights/Common.js.map +0 -1
  585. package/models/trace/insights/DOMSize.js +0 -182
  586. package/models/trace/insights/DOMSize.js.map +0 -1
  587. package/models/trace/insights/DocumentLatency.js +0 -259
  588. package/models/trace/insights/DocumentLatency.js.map +0 -1
  589. package/models/trace/insights/DuplicatedJavaScript.js +0 -95
  590. package/models/trace/insights/DuplicatedJavaScript.js.map +0 -1
  591. package/models/trace/insights/FontDisplay.js +0 -87
  592. package/models/trace/insights/FontDisplay.js.map +0 -1
  593. package/models/trace/insights/ForcedReflow.js +0 -162
  594. package/models/trace/insights/ForcedReflow.js.map +0 -1
  595. package/models/trace/insights/INPBreakdown.js +0 -130
  596. package/models/trace/insights/INPBreakdown.js.map +0 -1
  597. package/models/trace/insights/ImageDelivery.js +0 -264
  598. package/models/trace/insights/ImageDelivery.js.map +0 -1
  599. package/models/trace/insights/LCPBreakdown.js +0 -200
  600. package/models/trace/insights/LCPBreakdown.js.map +0 -1
  601. package/models/trace/insights/LCPDiscovery.js +0 -190
  602. package/models/trace/insights/LCPDiscovery.js.map +0 -1
  603. package/models/trace/insights/LegacyJavaScript.js +0 -95
  604. package/models/trace/insights/LegacyJavaScript.js.map +0 -1
  605. package/models/trace/insights/Models.js +0 -23
  606. package/models/trace/insights/Models.js.map +0 -1
  607. package/models/trace/insights/ModernHTTP.js +0 -201
  608. package/models/trace/insights/ModernHTTP.js.map +0 -1
  609. package/models/trace/insights/NetworkDependencyTree.js +0 -968
  610. package/models/trace/insights/NetworkDependencyTree.js.map +0 -1
  611. package/models/trace/insights/RenderBlocking.js +0 -193
  612. package/models/trace/insights/RenderBlocking.js.map +0 -1
  613. package/models/trace/insights/SlowCSSSelector.js +0 -137
  614. package/models/trace/insights/SlowCSSSelector.js.map +0 -1
  615. package/models/trace/insights/Statistics.js +0 -93
  616. package/models/trace/insights/Statistics.js.map +0 -1
  617. package/models/trace/insights/ThirdParties.js +0 -99
  618. package/models/trace/insights/ThirdParties.js.map +0 -1
  619. package/models/trace/insights/Viewport.js +0 -103
  620. package/models/trace/insights/Viewport.js.map +0 -1
  621. package/models/trace/insights/bundle-tsconfig.json +0 -1
  622. package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  623. package/models/trace/insights/insights-tsconfig.json +0 -103
  624. package/models/trace/insights/insights.js +0 -10
  625. package/models/trace/insights/insights.js.map +0 -1
  626. package/models/trace/insights/types.js +0 -41
  627. package/models/trace/insights/types.js.map +0 -1
  628. package/models/trace/lantern/bundle-tsconfig.json +0 -1
  629. package/models/trace/lantern/core/LanternError.js +0 -7
  630. package/models/trace/lantern/core/LanternError.js.map +0 -1
  631. package/models/trace/lantern/core/NetworkAnalyzer.js +0 -484
  632. package/models/trace/lantern/core/NetworkAnalyzer.js.map +0 -1
  633. package/models/trace/lantern/core/bundle-tsconfig.json +0 -1
  634. package/models/trace/lantern/core/core-tsconfig.json +0 -49
  635. package/models/trace/lantern/core/core.js +0 -6
  636. package/models/trace/lantern/core/core.js.map +0 -1
  637. package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  638. package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -60
  639. package/models/trace/lantern/graph/BaseNode.js +0 -277
  640. package/models/trace/lantern/graph/BaseNode.js.map +0 -1
  641. package/models/trace/lantern/graph/CPUNode.js +0 -64
  642. package/models/trace/lantern/graph/CPUNode.js.map +0 -1
  643. package/models/trace/lantern/graph/NetworkNode.js +0 -83
  644. package/models/trace/lantern/graph/NetworkNode.js.map +0 -1
  645. package/models/trace/lantern/graph/PageDependencyGraph.js +0 -552
  646. package/models/trace/lantern/graph/PageDependencyGraph.js.map +0 -1
  647. package/models/trace/lantern/graph/bundle-tsconfig.json +0 -1
  648. package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  649. package/models/trace/lantern/graph/graph-tsconfig.json +0 -54
  650. package/models/trace/lantern/graph/graph.js +0 -8
  651. package/models/trace/lantern/graph/graph.js.map +0 -1
  652. package/models/trace/lantern/lantern.js.map +0 -1
  653. package/models/trace/lantern/metrics/FirstContentfulPaint.js +0 -137
  654. package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +0 -1
  655. package/models/trace/lantern/metrics/Interactive.js +0 -68
  656. package/models/trace/lantern/metrics/Interactive.js.map +0 -1
  657. package/models/trace/lantern/metrics/LargestContentfulPaint.js +0 -69
  658. package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +0 -1
  659. package/models/trace/lantern/metrics/MaxPotentialFID.js +0 -49
  660. package/models/trace/lantern/metrics/MaxPotentialFID.js.map +0 -1
  661. package/models/trace/lantern/metrics/Metric.js +0 -69
  662. package/models/trace/lantern/metrics/Metric.js.map +0 -1
  663. package/models/trace/lantern/metrics/SpeedIndex.js +0 -102
  664. package/models/trace/lantern/metrics/SpeedIndex.js.map +0 -1
  665. package/models/trace/lantern/metrics/TBTUtils.js +0 -65
  666. package/models/trace/lantern/metrics/TBTUtils.js.map +0 -1
  667. package/models/trace/lantern/metrics/TotalBlockingTime.js +0 -79
  668. package/models/trace/lantern/metrics/TotalBlockingTime.js.map +0 -1
  669. package/models/trace/lantern/metrics/bundle-tsconfig.json +0 -1
  670. package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  671. package/models/trace/lantern/metrics/metrics-tsconfig.json +0 -64
  672. package/models/trace/lantern/metrics/metrics.js +0 -12
  673. package/models/trace/lantern/metrics/metrics.js.map +0 -1
  674. package/models/trace/lantern/simulation/ConnectionPool.js +0 -116
  675. package/models/trace/lantern/simulation/ConnectionPool.js.map +0 -1
  676. package/models/trace/lantern/simulation/Constants.js +0 -43
  677. package/models/trace/lantern/simulation/Constants.js.map +0 -1
  678. package/models/trace/lantern/simulation/DNSCache.js +0 -48
  679. package/models/trace/lantern/simulation/DNSCache.js.map +0 -1
  680. package/models/trace/lantern/simulation/SimulationTimingMap.js +0 -135
  681. package/models/trace/lantern/simulation/SimulationTimingMap.js.map +0 -1
  682. package/models/trace/lantern/simulation/Simulator.js +0 -451
  683. package/models/trace/lantern/simulation/Simulator.js.map +0 -1
  684. package/models/trace/lantern/simulation/TCPConnection.js +0 -155
  685. package/models/trace/lantern/simulation/TCPConnection.js.map +0 -1
  686. package/models/trace/lantern/simulation/bundle-tsconfig.json +0 -1
  687. package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  688. package/models/trace/lantern/simulation/simulation-tsconfig.json +0 -59
  689. package/models/trace/lantern/simulation/simulation.js +0 -10
  690. package/models/trace/lantern/simulation/simulation.js.map +0 -1
  691. package/models/trace/lantern/types/Lantern.js +0 -25
  692. package/models/trace/lantern/types/Lantern.js.map +0 -1
  693. package/models/trace/lantern/types/bundle-tsconfig.json +0 -1
  694. package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  695. package/models/trace/lantern/types/types-tsconfig.json +0 -48
  696. package/models/trace/lantern/types/types.js +0 -5
  697. package/models/trace/lantern/types/types.js.map +0 -1
  698. package/models/trace/trace-tsconfig.json +0 -78
  699. package/models/trace/trace.js.map +0 -1
  700. package/models/trace/types/Configuration.js +0 -18
  701. package/models/trace/types/Configuration.js.map +0 -1
  702. package/models/trace/types/Extensions.js +0 -38
  703. package/models/trace/types/Extensions.js.map +0 -1
  704. package/models/trace/types/File.js +0 -82
  705. package/models/trace/types/File.js.map +0 -1
  706. package/models/trace/types/Overlays.js +0 -5
  707. package/models/trace/types/Overlays.js.map +0 -1
  708. package/models/trace/types/Timing.js.map +0 -1
  709. package/models/trace/types/TraceEvents.js.map +0 -1
  710. package/models/trace/types/bundle-tsconfig.json +0 -1
  711. package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -48
  712. package/models/trace/types/types-tsconfig.json +0 -65
  713. package/models/trace/types/types.js.map +0 -1
  714. package/test/invalid-animation-events.json.gz +0 -0
  715. package/test/test-trace-engine.mjs +0 -191
  716. package/third_party/legacy-javascript/legacy-javascript.js +0 -1
  717. package/third_party/marked/marked.d.ts +0 -1
  718. package/third_party/marked/marked.js +0 -1
  719. package/third_party/third-party-web/third-party-web.js +0 -1
  720. package/tsconfig.json +0 -29
@@ -1,319 +0,0 @@
1
- // Copyright 2022 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
- import * as Platform from '../../../core/platform/platform.js';
5
- import * as Helpers from '../helpers/helpers.js';
6
- import * as Types from '../types/types.js';
7
- import { data as metaHandlerData } from './MetaHandler.js';
8
- import { ScoreClassification } from './PageLoadMetricsHandler.js';
9
- // This handler gathers EventTimings into Interactions, which we use to show
10
- // interactions and highlight long interactions to the user, along with INP.
11
- let beginCommitCompositorFrameEvents = [];
12
- let parseMetaViewportEvents = [];
13
- export const LONG_INTERACTION_THRESHOLD = Helpers.Timing.milliToMicro(Types.Timing.Milli(200));
14
- const INP_GOOD_TIMING = LONG_INTERACTION_THRESHOLD;
15
- const INP_MEDIUM_TIMING = Helpers.Timing.milliToMicro(Types.Timing.Milli(500));
16
- let longestInteractionEvent = null;
17
- let interactionEvents = [];
18
- let interactionEventsWithNoNesting = [];
19
- let eventTimingStartEventsForInteractions = [];
20
- let eventTimingEndEventsForInteractions = [];
21
- export function reset() {
22
- beginCommitCompositorFrameEvents = [];
23
- parseMetaViewportEvents = [];
24
- interactionEvents = [];
25
- eventTimingStartEventsForInteractions = [];
26
- eventTimingEndEventsForInteractions = [];
27
- interactionEventsWithNoNesting = [];
28
- longestInteractionEvent = null;
29
- }
30
- export function handleEvent(event) {
31
- if (Types.Events.isBeginCommitCompositorFrame(event)) {
32
- beginCommitCompositorFrameEvents.push(event);
33
- return;
34
- }
35
- if (Types.Events.isParseMetaViewport(event)) {
36
- parseMetaViewportEvents.push(event);
37
- return;
38
- }
39
- if (!Types.Events.isEventTiming(event)) {
40
- return;
41
- }
42
- if (Types.Events.isEventTimingEnd(event)) {
43
- // Store the end event; for each start event that is an interaction, we need the matching end event to calculate the duration correctly.
44
- eventTimingEndEventsForInteractions.push(event);
45
- }
46
- // From this point on we want to find events that represent interactions.
47
- // These events are always start events - those are the ones that contain all
48
- // the metadata about the interaction.
49
- if (!event.args.data || !Types.Events.isEventTimingStart(event)) {
50
- return;
51
- }
52
- const { duration, interactionId } = event.args.data;
53
- // We exclude events for the sake of interactions if:
54
- // 1. They have no duration.
55
- // 2. They have no interactionId
56
- // 3. They have an interactionId of 0: this indicates that it's not an
57
- // interaction that we care about because it hasn't had its own interactionId
58
- // set (0 is the default on the backend).
59
- // See: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/responsiveness_metrics.cc;l=133;drc=40c209a9c365ebb9f16fb99dfe78c7fe768b9594
60
- if (duration < 1 || interactionId === undefined || interactionId === 0) {
61
- return;
62
- }
63
- // Store the start event. In the finalize() function we will pair this with
64
- // its end event and create the synthetic interaction event.
65
- eventTimingStartEventsForInteractions.push(event);
66
- }
67
- /**
68
- * See https://web.dev/better-responsiveness-metric/#interaction-types for the
69
- * table that defines these sets.
70
- **/
71
- const pointerEventTypes = new Set([
72
- 'pointerdown',
73
- 'touchstart',
74
- 'pointerup',
75
- 'touchend',
76
- 'mousedown',
77
- 'mouseup',
78
- 'click',
79
- ]);
80
- const keyboardEventTypes = new Set([
81
- 'keydown',
82
- 'keypress',
83
- 'keyup',
84
- ]);
85
- export function categoryOfInteraction(interaction) {
86
- if (pointerEventTypes.has(interaction.type)) {
87
- return 'POINTER';
88
- }
89
- if (keyboardEventTypes.has(interaction.type)) {
90
- return 'KEYBOARD';
91
- }
92
- return 'OTHER';
93
- }
94
- /**
95
- * We define a set of interactions as nested where:
96
- * 1. Their end times align.
97
- * 2. The longest interaction's start time is earlier than all other
98
- * interactions with the same end time.
99
- * 3. The interactions are of the same category [each interaction is either
100
- * categorised as keyboard, or pointer.]
101
- *
102
- * =============A=[pointerup]=
103
- * ====B=[pointerdown]=
104
- * ===C=[pointerdown]==
105
- * ===D=[pointerup]===
106
- *
107
- * In this example, B, C and D are all nested and therefore should not be
108
- * returned from this function.
109
- *
110
- * However, in this example we would only consider B nested (under A) and D
111
- * nested (under C). A and C both stay because they are of different types.
112
- * ========A=[keydown]====
113
- * =======B=[keyup]=====
114
- * ====C=[pointerdown]=
115
- * =D=[pointerup]=
116
- *
117
- * Additionally, this method will also maximise the processing duration of the
118
- * events that we keep as non-nested. We want to make sure we give an accurate
119
- * representation of main thread activity, so if we keep an event + hide its
120
- * nested children, we set the top level event's processing start &
121
- * processing end to be the earliest processing start & the latest processing
122
- * end of its children. This ensures we report a more accurate main thread
123
- * activity time which is important as we want developers to focus on fixing
124
- * this.
125
- **/
126
- export function removeNestedInteractionsAndSetProcessingTime(interactions) {
127
- /**
128
- * Because we nest events only that are in the same category, we store the
129
- * longest event for a given end time by category.
130
- **/
131
- const earliestEventForEndTimePerCategory = {
132
- POINTER: new Map(),
133
- KEYBOARD: new Map(),
134
- OTHER: new Map(),
135
- };
136
- function storeEventIfEarliestForCategoryAndEndTime(interaction) {
137
- const category = categoryOfInteraction(interaction);
138
- const earliestEventForEndTime = earliestEventForEndTimePerCategory[category];
139
- const endTime = Types.Timing.Micro(interaction.ts + interaction.dur);
140
- const earliestCurrentEvent = earliestEventForEndTime.get(endTime);
141
- if (!earliestCurrentEvent) {
142
- earliestEventForEndTime.set(endTime, interaction);
143
- return;
144
- }
145
- if (interaction.ts < earliestCurrentEvent.ts) {
146
- earliestEventForEndTime.set(endTime, interaction);
147
- }
148
- else if (interaction.ts === earliestCurrentEvent.ts &&
149
- interaction.interactionId === earliestCurrentEvent.interactionId) {
150
- // We have seen in traces that the same interaction can have multiple
151
- // events (e.g. a 'click' and a 'pointerdown'). Often only one of these
152
- // events will have an event handler bound to it which caused delay on
153
- // the main thread, and the others will not. This leads to a situation
154
- // where if we pick one of the events that had no event handler, its
155
- // processing duration (processingEnd - processingStart) will be 0, but if we
156
- // had picked the event that had the slow event handler, we would show
157
- // correctly the main thread delay due to the event handler.
158
- // So, if we find events with the same interactionId and the same
159
- // begin/end times, we pick the one with the largest (processingEnd -
160
- // processingStart) time in order to make sure we find the event with the
161
- // worst main thread delay, as that is the one the user should care
162
- // about.
163
- const currentProcessingDuration = earliestCurrentEvent.processingEnd - earliestCurrentEvent.processingStart;
164
- const newProcessingDuration = interaction.processingEnd - interaction.processingStart;
165
- // Use the new interaction if it has a longer processing duration than the existing one.
166
- if (newProcessingDuration > currentProcessingDuration) {
167
- earliestEventForEndTime.set(endTime, interaction);
168
- }
169
- }
170
- // Maximize the processing duration based on the "children" interactions.
171
- // We pick the earliest start processing duration, and the latest end
172
- // processing duration to avoid under-reporting.
173
- if (interaction.processingStart < earliestCurrentEvent.processingStart) {
174
- earliestCurrentEvent.processingStart = interaction.processingStart;
175
- writeSyntheticTimespans(earliestCurrentEvent);
176
- }
177
- if (interaction.processingEnd > earliestCurrentEvent.processingEnd) {
178
- earliestCurrentEvent.processingEnd = interaction.processingEnd;
179
- writeSyntheticTimespans(earliestCurrentEvent);
180
- }
181
- }
182
- for (const interaction of interactions) {
183
- storeEventIfEarliestForCategoryAndEndTime(interaction);
184
- }
185
- // Combine all the events that we have kept from all the per-category event
186
- // maps back into an array and sort them by timestamp.
187
- const keptEvents = Object.values(earliestEventForEndTimePerCategory)
188
- .flatMap(eventsByEndTime => Array.from(eventsByEndTime.values()));
189
- keptEvents.sort((eventA, eventB) => {
190
- return eventA.ts - eventB.ts;
191
- });
192
- return keptEvents;
193
- }
194
- function writeSyntheticTimespans(event) {
195
- const startEvent = event.args.data.beginEvent;
196
- const endEvent = event.args.data.endEvent;
197
- event.inputDelay = Types.Timing.Micro(event.processingStart - startEvent.ts);
198
- event.mainThreadHandling = Types.Timing.Micro(event.processingEnd - event.processingStart);
199
- event.presentationDelay = Types.Timing.Micro(endEvent.ts - event.processingEnd);
200
- }
201
- export async function finalize() {
202
- const { navigationsByFrameId } = metaHandlerData();
203
- const beginAndEndEvents = Platform.ArrayUtilities.mergeOrdered(eventTimingStartEventsForInteractions, eventTimingEndEventsForInteractions, Helpers.Trace.eventTimeComparator);
204
- // Pair up the begin & end events and create synthetic user timing events.
205
- const beginEventById = new Map();
206
- for (const event of beginAndEndEvents) {
207
- if (Types.Events.isEventTimingStart(event)) {
208
- const forId = beginEventById.get(event.id) ?? [];
209
- forId.push(event);
210
- beginEventById.set(event.id, forId);
211
- }
212
- else if (Types.Events.isEventTimingEnd(event)) {
213
- const beginEvents = beginEventById.get(event.id) ?? [];
214
- const beginEvent = beginEvents.pop();
215
- if (!beginEvent) {
216
- continue;
217
- }
218
- const { type, interactionId, timeStamp, processingStart, processingEnd } = beginEvent.args.data;
219
- if (!type || !interactionId || !timeStamp || !processingStart || !processingEnd) {
220
- // A valid interaction event that we care about has to have a type (e.g. pointerdown, keyup).
221
- // We also need to ensure it has an interactionId and various timings. There are edge cases where these aren't included in the trace event.
222
- continue;
223
- }
224
- // In the future we will add microsecond timestamps to the trace events…
225
- // (See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/window_performance.cc;l=900-901;drc=b503c262e425eae59ced4a80d59d176ed07152c7 )
226
- // …but until then we can use the millisecond precision values that are in
227
- // the trace event. To adjust them to be relative to the event.ts and the
228
- // trace timestamps, for both processingStart and processingEnd we subtract
229
- // the event timestamp (NOT event.ts, but the timeStamp millisecond value
230
- // emitted in args.data), and then add that value to the event.ts. This
231
- // will give us a processingStart and processingEnd time in microseconds
232
- // that is relative to event.ts, and can be used when drawing boxes.
233
- // There is some inaccuracy here as we are converting milliseconds to
234
- // microseconds, but it is good enough until the backend emits more
235
- // accurate numbers.
236
- const processingStartRelativeToTraceTime = Types.Timing.Micro(Helpers.Timing.milliToMicro(processingStart) - Helpers.Timing.milliToMicro(timeStamp) + beginEvent.ts);
237
- const processingEndRelativeToTraceTime = Types.Timing.Micro((Helpers.Timing.milliToMicro(processingEnd) - Helpers.Timing.milliToMicro(timeStamp)) + beginEvent.ts);
238
- // Ultimate frameId fallback only needed for TSC, see comments in the type.
239
- const frameId = beginEvent.args.frame ?? beginEvent.args.data.frame ?? '';
240
- const navigation = Helpers.Trace.getNavigationForTraceEvent(beginEvent, frameId, navigationsByFrameId);
241
- const navigationId = navigation?.args.data?.navigationId;
242
- const interactionEvent = Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent({
243
- // Use the start event to define the common fields.
244
- rawSourceEvent: beginEvent,
245
- cat: beginEvent.cat,
246
- name: beginEvent.name,
247
- pid: beginEvent.pid,
248
- tid: beginEvent.tid,
249
- ph: beginEvent.ph,
250
- processingStart: processingStartRelativeToTraceTime,
251
- processingEnd: processingEndRelativeToTraceTime,
252
- // These will be set in writeSyntheticTimespans()
253
- inputDelay: Types.Timing.Micro(-1),
254
- mainThreadHandling: Types.Timing.Micro(-1),
255
- presentationDelay: Types.Timing.Micro(-1),
256
- args: {
257
- data: {
258
- beginEvent,
259
- endEvent: event,
260
- frame: frameId,
261
- navigationId,
262
- },
263
- },
264
- ts: beginEvent.ts,
265
- dur: Types.Timing.Micro(event.ts - beginEvent.ts),
266
- type: beginEvent.args.data.type,
267
- interactionId: beginEvent.args.data.interactionId,
268
- });
269
- writeSyntheticTimespans(interactionEvent);
270
- interactionEvents.push(interactionEvent);
271
- }
272
- }
273
- // Once we gather up all the interactions, we want to remove nested
274
- // interactions. Interactions can be nested because one user action (e.g. a
275
- // click) will cause a pointerdown, pointerup and click. But we don't want to
276
- // fill the interactions track with lots of noise. To fix this, we go through
277
- // all the events and remove any nested ones so on the timeline we focus the
278
- // user on the most important events, which we define as the longest one. But
279
- // this algorithm assumes the events are in ASC order, so we first sort the
280
- // set of interactions.
281
- Helpers.Trace.sortTraceEventsInPlace(interactionEvents);
282
- interactionEventsWithNoNesting.push(...removeNestedInteractionsAndSetProcessingTime(interactionEvents));
283
- // Pick the longest interactions from the set that were not nested, as we
284
- // know those are the set of the largest interactions.
285
- for (const interactionEvent of interactionEventsWithNoNesting) {
286
- if (!longestInteractionEvent || longestInteractionEvent.dur < interactionEvent.dur) {
287
- longestInteractionEvent = interactionEvent;
288
- }
289
- }
290
- }
291
- export function data() {
292
- return {
293
- beginCommitCompositorFrameEvents,
294
- parseMetaViewportEvents,
295
- interactionEvents,
296
- interactionEventsWithNoNesting,
297
- longestInteractionEvent,
298
- interactionsOverThreshold: new Set(interactionEvents.filter(event => {
299
- return event.dur > LONG_INTERACTION_THRESHOLD;
300
- })),
301
- };
302
- }
303
- export function deps() {
304
- return ['Meta'];
305
- }
306
- /**
307
- * Classifications sourced from
308
- * https://web.dev/articles/inp#good-score
309
- */
310
- export function scoreClassificationForInteractionToNextPaint(timing) {
311
- if (timing <= INP_GOOD_TIMING) {
312
- return ScoreClassification.GOOD;
313
- }
314
- if (timing <= INP_MEDIUM_TIMING) {
315
- return ScoreClassification.OK;
316
- }
317
- return ScoreClassification.BAD;
318
- }
319
- //# sourceMappingURL=UserInteractionsHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserInteractionsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/UserInteractionsHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAGhE,4EAA4E;AAC5E,4EAA4E;AAE5E,IAAI,gCAAgC,GAA8C,EAAE,CAAC;AACrF,IAAI,uBAAuB,GAAqC,EAAE,CAAC;AAEnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/F,MAAM,eAAe,GAAG,0BAA0B,CAAC;AACnD,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAkC/E,IAAI,uBAAuB,GAA+C,IAAI,CAAC;AAE/E,IAAI,iBAAiB,GAA4C,EAAE,CAA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E,CAAC;QAC9D,IAAI,CAAC,uBAAuB,IAAI,uBAAuB,CAAC,GAAG,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC;YACnF,uBAAuB,GAAG,gBAAgB,CAAC;QAC7C,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO;QACL,gCAAgC;QAChC,uBAAuB;QACvB,iBAAiB;QACjB,8BAA8B;QAC9B,uBAAuB;QACvB,yBAAyB,EAAE,IAAI,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAClE,OAAO,KAAK,CAAC,GAAG,GAAG,0BAA0B,CAAC;QAChD,CAAC,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4CAA4C,CAAC,MAA0B;IACrF,IAAI,MAAM,IAAI,eAAe,EAAE,CAAC;QAC9B,OAAO,mBAAmB,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,IAAI,MAAM,IAAI,iBAAiB,EAAE,CAAC;QAChC,OAAO,mBAAmB,CAAC,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,mBAAmB,CAAC,GAAG,CAAC;AACjC,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors\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 Platform from '../../../core/platform/platform.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as metaHandlerData} from './MetaHandler.js';\nimport {ScoreClassification} from './PageLoadMetricsHandler.js';\nimport type {HandlerName} from './types.js';\n\n// This handler gathers EventTimings into Interactions, which we use to show\n// interactions and highlight long interactions to the user, along with INP.\n\nlet beginCommitCompositorFrameEvents: Types.Events.BeginCommitCompositorFrame[] = [];\nlet parseMetaViewportEvents: Types.Events.ParseMetaViewport[] = [];\n\nexport const LONG_INTERACTION_THRESHOLD = Helpers.Timing.milliToMicro(Types.Timing.Milli(200));\n\nconst INP_GOOD_TIMING = LONG_INTERACTION_THRESHOLD;\nconst INP_MEDIUM_TIMING = Helpers.Timing.milliToMicro(Types.Timing.Milli(500));\n\nexport interface UserInteractionsData {\n /** All the BeginCommitCompositorFrame events we found in the trace */\n beginCommitCompositorFrameEvents: readonly Types.Events.BeginCommitCompositorFrame[];\n /** All the ParseMetaViewport events we found in the trace */\n parseMetaViewportEvents: readonly Types.Events.ParseMetaViewport[];\n /**\n * All the interaction events we found in the trace that had an\n * interactionId and a duration > 0\n **/\n interactionEvents: readonly Types.Events.SyntheticInteractionPair[];\n /**\n * If the user rapidly generates interaction events (think typing into a\n * text box), in the UI we only really want to show the user the longest\n * interaction in that set.\n * For example picture interactions like this:\n * ===[interaction A]==========\n * =[interaction B]======\n * =[interaction C]=\n *\n * These events all end at the same time, and so in this instance we only want\n * to show the first interaction A on the timeline, as that is the longest one\n * and the one the developer should be focusing on. So this array of events is\n * all the interaction events filtered down, removing any nested interactions\n * entirely.\n **/\n interactionEventsWithNoNesting: readonly Types.Events.SyntheticInteractionPair[];\n // The longest duration interaction event. Can be null if the trace has no interaction events.\n longestInteractionEvent: Readonly<Types.Events.SyntheticInteractionPair>|null;\n // All interactions that went over the interaction threshold (200ms, see https://web.dev/inp/)\n interactionsOverThreshold: Readonly<Set<Types.Events.SyntheticInteractionPair>>;\n}\n\nlet longestInteractionEvent: Types.Events.SyntheticInteractionPair|null = null;\n\nlet interactionEvents: Types.Events.SyntheticInteractionPair[] = [];\nlet interactionEventsWithNoNesting: Types.Events.SyntheticInteractionPair[] = [];\nlet eventTimingStartEventsForInteractions: Types.Events.EventTimingBegin[] = [];\nlet eventTimingEndEventsForInteractions: Types.Events.EventTimingEnd[] = [];\n\nexport function reset(): void {\n beginCommitCompositorFrameEvents = [];\n parseMetaViewportEvents = [];\n interactionEvents = [];\n eventTimingStartEventsForInteractions = [];\n eventTimingEndEventsForInteractions = [];\n interactionEventsWithNoNesting = [];\n longestInteractionEvent = null;\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (Types.Events.isBeginCommitCompositorFrame(event)) {\n beginCommitCompositorFrameEvents.push(event);\n return;\n }\n\n if (Types.Events.isParseMetaViewport(event)) {\n parseMetaViewportEvents.push(event);\n return;\n }\n\n if (!Types.Events.isEventTiming(event)) {\n return;\n }\n\n if (Types.Events.isEventTimingEnd(event)) {\n // Store the end event; for each start event that is an interaction, we need the matching end event to calculate the duration correctly.\n eventTimingEndEventsForInteractions.push(event);\n }\n\n // From this point on we want to find events that represent interactions.\n // These events are always start events - those are the ones that contain all\n // the metadata about the interaction.\n if (!event.args.data || !Types.Events.isEventTimingStart(event)) {\n return;\n }\n const {duration, interactionId} = event.args.data;\n // We exclude events for the sake of interactions if:\n // 1. They have no duration.\n // 2. They have no interactionId\n // 3. They have an interactionId of 0: this indicates that it's not an\n // interaction that we care about because it hasn't had its own interactionId\n // set (0 is the default on the backend).\n // See: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/responsiveness_metrics.cc;l=133;drc=40c209a9c365ebb9f16fb99dfe78c7fe768b9594\n\n if (duration < 1 || interactionId === undefined || interactionId === 0) {\n return;\n }\n\n // Store the start event. In the finalize() function we will pair this with\n // its end event and create the synthetic interaction event.\n eventTimingStartEventsForInteractions.push(event);\n}\n\n/**\n * See https://web.dev/better-responsiveness-metric/#interaction-types for the\n * table that defines these sets.\n **/\nconst pointerEventTypes = new Set([\n 'pointerdown',\n 'touchstart',\n 'pointerup',\n 'touchend',\n 'mousedown',\n 'mouseup',\n 'click',\n]);\n\nconst keyboardEventTypes = new Set([\n 'keydown',\n 'keypress',\n 'keyup',\n]);\n\nexport type InteractionCategory = 'KEYBOARD'|'POINTER'|'OTHER';\nexport function categoryOfInteraction(interaction: Types.Events.SyntheticInteractionPair): InteractionCategory {\n if (pointerEventTypes.has(interaction.type)) {\n return 'POINTER';\n }\n if (keyboardEventTypes.has(interaction.type)) {\n return 'KEYBOARD';\n }\n\n return 'OTHER';\n}\n\n/**\n * We define a set of interactions as nested where:\n * 1. Their end times align.\n * 2. The longest interaction's start time is earlier than all other\n * interactions with the same end time.\n * 3. The interactions are of the same category [each interaction is either\n * categorised as keyboard, or pointer.]\n *\n * =============A=[pointerup]=\n * ====B=[pointerdown]=\n * ===C=[pointerdown]==\n * ===D=[pointerup]===\n *\n * In this example, B, C and D are all nested and therefore should not be\n * returned from this function.\n *\n * However, in this example we would only consider B nested (under A) and D\n * nested (under C). A and C both stay because they are of different types.\n * ========A=[keydown]====\n * =======B=[keyup]=====\n * ====C=[pointerdown]=\n * =D=[pointerup]=\n *\n * Additionally, this method will also maximise the processing duration of the\n * events that we keep as non-nested. We want to make sure we give an accurate\n * representation of main thread activity, so if we keep an event + hide its\n * nested children, we set the top level event's processing start &\n * processing end to be the earliest processing start & the latest processing\n * end of its children. This ensures we report a more accurate main thread\n * activity time which is important as we want developers to focus on fixing\n * this.\n **/\nexport function removeNestedInteractionsAndSetProcessingTime(\n interactions: readonly Types.Events.SyntheticInteractionPair[]): readonly Types.Events.SyntheticInteractionPair[] {\n /**\n * Because we nest events only that are in the same category, we store the\n * longest event for a given end time by category.\n **/\n const earliestEventForEndTimePerCategory:\n Record<InteractionCategory, Map<Types.Timing.Micro, Types.Events.SyntheticInteractionPair>> = {\n POINTER: new Map(),\n KEYBOARD: new Map(),\n OTHER: new Map(),\n };\n\n function storeEventIfEarliestForCategoryAndEndTime(interaction: Types.Events.SyntheticInteractionPair): void {\n const category = categoryOfInteraction(interaction);\n const earliestEventForEndTime = earliestEventForEndTimePerCategory[category];\n const endTime = Types.Timing.Micro(interaction.ts + interaction.dur);\n\n const earliestCurrentEvent = earliestEventForEndTime.get(endTime);\n if (!earliestCurrentEvent) {\n earliestEventForEndTime.set(endTime, interaction);\n return;\n }\n if (interaction.ts < earliestCurrentEvent.ts) {\n earliestEventForEndTime.set(endTime, interaction);\n } else if (\n interaction.ts === earliestCurrentEvent.ts &&\n interaction.interactionId === earliestCurrentEvent.interactionId) {\n // We have seen in traces that the same interaction can have multiple\n // events (e.g. a 'click' and a 'pointerdown'). Often only one of these\n // events will have an event handler bound to it which caused delay on\n // the main thread, and the others will not. This leads to a situation\n // where if we pick one of the events that had no event handler, its\n // processing duration (processingEnd - processingStart) will be 0, but if we\n // had picked the event that had the slow event handler, we would show\n // correctly the main thread delay due to the event handler.\n // So, if we find events with the same interactionId and the same\n // begin/end times, we pick the one with the largest (processingEnd -\n // processingStart) time in order to make sure we find the event with the\n // worst main thread delay, as that is the one the user should care\n // about.\n const currentProcessingDuration = earliestCurrentEvent.processingEnd - earliestCurrentEvent.processingStart;\n const newProcessingDuration = interaction.processingEnd - interaction.processingStart;\n\n // Use the new interaction if it has a longer processing duration than the existing one.\n if (newProcessingDuration > currentProcessingDuration) {\n earliestEventForEndTime.set(endTime, interaction);\n }\n }\n\n // Maximize the processing duration based on the \"children\" interactions.\n // We pick the earliest start processing duration, and the latest end\n // processing duration to avoid under-reporting.\n if (interaction.processingStart < earliestCurrentEvent.processingStart) {\n earliestCurrentEvent.processingStart = interaction.processingStart;\n writeSyntheticTimespans(earliestCurrentEvent);\n }\n if (interaction.processingEnd > earliestCurrentEvent.processingEnd) {\n earliestCurrentEvent.processingEnd = interaction.processingEnd;\n writeSyntheticTimespans(earliestCurrentEvent);\n }\n }\n\n for (const interaction of interactions) {\n storeEventIfEarliestForCategoryAndEndTime(interaction);\n }\n\n // Combine all the events that we have kept from all the per-category event\n // maps back into an array and sort them by timestamp.\n const keptEvents = Object.values(earliestEventForEndTimePerCategory)\n .flatMap(eventsByEndTime => Array.from(eventsByEndTime.values()));\n keptEvents.sort((eventA, eventB) => {\n return eventA.ts - eventB.ts;\n });\n return keptEvents;\n}\n\nfunction writeSyntheticTimespans(event: Types.Events.SyntheticInteractionPair): void {\n const startEvent = event.args.data.beginEvent;\n const endEvent = event.args.data.endEvent;\n\n event.inputDelay = Types.Timing.Micro(event.processingStart - startEvent.ts);\n event.mainThreadHandling = Types.Timing.Micro(event.processingEnd - event.processingStart);\n event.presentationDelay = Types.Timing.Micro(endEvent.ts - event.processingEnd);\n}\n\nexport async function finalize(): Promise<void> {\n const {navigationsByFrameId} = metaHandlerData();\n\n const beginAndEndEvents = Platform.ArrayUtilities.mergeOrdered(\n eventTimingStartEventsForInteractions, eventTimingEndEventsForInteractions,\n Helpers.Trace.eventTimeComparator) as Types.Events.EventTimingBeginOrEnd[];\n\n // Pair up the begin & end events and create synthetic user timing events.\n const beginEventById = new Map<string, Types.Events.EventTimingBegin[]>();\n for (const event of beginAndEndEvents) {\n if (Types.Events.isEventTimingStart(event)) {\n const forId = beginEventById.get(event.id) ?? [];\n forId.push(event);\n beginEventById.set(event.id, forId);\n } else if (Types.Events.isEventTimingEnd(event)) {\n const beginEvents = beginEventById.get(event.id) ?? [];\n const beginEvent = beginEvents.pop();\n if (!beginEvent) {\n continue;\n }\n const {type, interactionId, timeStamp, processingStart, processingEnd} = beginEvent.args.data;\n if (!type || !interactionId || !timeStamp || !processingStart || !processingEnd) {\n // A valid interaction event that we care about has to have a type (e.g. pointerdown, keyup).\n // We also need to ensure it has an interactionId and various timings. There are edge cases where these aren't included in the trace event.\n continue;\n }\n // In the future we will add microsecond timestamps to the trace events…\n // (See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/window_performance.cc;l=900-901;drc=b503c262e425eae59ced4a80d59d176ed07152c7 )\n // …but until then we can use the millisecond precision values that are in\n // the trace event. To adjust them to be relative to the event.ts and the\n // trace timestamps, for both processingStart and processingEnd we subtract\n // the event timestamp (NOT event.ts, but the timeStamp millisecond value\n // emitted in args.data), and then add that value to the event.ts. This\n // will give us a processingStart and processingEnd time in microseconds\n // that is relative to event.ts, and can be used when drawing boxes.\n // There is some inaccuracy here as we are converting milliseconds to\n // microseconds, but it is good enough until the backend emits more\n // accurate numbers.\n const processingStartRelativeToTraceTime = Types.Timing.Micro(\n Helpers.Timing.milliToMicro(processingStart) - Helpers.Timing.milliToMicro(timeStamp) + beginEvent.ts,\n );\n\n const processingEndRelativeToTraceTime = Types.Timing.Micro(\n (Helpers.Timing.milliToMicro(processingEnd) - Helpers.Timing.milliToMicro(timeStamp)) + beginEvent.ts);\n\n // Ultimate frameId fallback only needed for TSC, see comments in the type.\n const frameId = beginEvent.args.frame ?? beginEvent.args.data.frame ?? '';\n const navigation = Helpers.Trace.getNavigationForTraceEvent(beginEvent, frameId, navigationsByFrameId);\n const navigationId = navigation?.args.data?.navigationId;\n const interactionEvent =\n Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticInteractionPair>({\n // Use the start event to define the common fields.\n rawSourceEvent: beginEvent,\n cat: beginEvent.cat,\n name: beginEvent.name,\n pid: beginEvent.pid,\n tid: beginEvent.tid,\n ph: beginEvent.ph,\n processingStart: processingStartRelativeToTraceTime,\n processingEnd: processingEndRelativeToTraceTime,\n // These will be set in writeSyntheticTimespans()\n inputDelay: Types.Timing.Micro(-1),\n mainThreadHandling: Types.Timing.Micro(-1),\n presentationDelay: Types.Timing.Micro(-1),\n args: {\n data: {\n beginEvent,\n endEvent: event,\n frame: frameId,\n navigationId,\n },\n },\n ts: beginEvent.ts,\n dur: Types.Timing.Micro(event.ts - beginEvent.ts),\n type: beginEvent.args.data.type,\n interactionId: beginEvent.args.data.interactionId,\n });\n writeSyntheticTimespans(interactionEvent);\n interactionEvents.push(interactionEvent);\n }\n }\n\n // Once we gather up all the interactions, we want to remove nested\n // interactions. Interactions can be nested because one user action (e.g. a\n // click) will cause a pointerdown, pointerup and click. But we don't want to\n // fill the interactions track with lots of noise. To fix this, we go through\n // all the events and remove any nested ones so on the timeline we focus the\n // user on the most important events, which we define as the longest one. But\n // this algorithm assumes the events are in ASC order, so we first sort the\n // set of interactions.\n Helpers.Trace.sortTraceEventsInPlace(interactionEvents);\n interactionEventsWithNoNesting.push(...removeNestedInteractionsAndSetProcessingTime(interactionEvents));\n\n // Pick the longest interactions from the set that were not nested, as we\n // know those are the set of the largest interactions.\n for (const interactionEvent of interactionEventsWithNoNesting) {\n if (!longestInteractionEvent || longestInteractionEvent.dur < interactionEvent.dur) {\n longestInteractionEvent = interactionEvent;\n }\n }\n}\n\nexport function data(): UserInteractionsData {\n return {\n beginCommitCompositorFrameEvents,\n parseMetaViewportEvents,\n interactionEvents,\n interactionEventsWithNoNesting,\n longestInteractionEvent,\n interactionsOverThreshold: new Set(interactionEvents.filter(event => {\n return event.dur > LONG_INTERACTION_THRESHOLD;\n })),\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['Meta'];\n}\n\n/**\n * Classifications sourced from\n * https://web.dev/articles/inp#good-score\n */\nexport function scoreClassificationForInteractionToNextPaint(timing: Types.Timing.Micro): ScoreClassification {\n if (timing <= INP_GOOD_TIMING) {\n return ScoreClassification.GOOD;\n }\n\n if (timing <= INP_MEDIUM_TIMING) {\n return ScoreClassification.OK;\n }\n\n return ScoreClassification.BAD;\n}\n"]}
@@ -1,184 +0,0 @@
1
- // Copyright 2022 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
- import * as Helpers from '../helpers/helpers.js';
5
- import * as Types from '../types/types.js';
6
- /**
7
- * IMPORTANT!
8
- * See UserTimings.md in this directory for some handy documentation on
9
- * UserTimings and the trace events we parse currently.
10
- **/
11
- let syntheticEvents = [];
12
- // There are two events dispatched for performance.measure calls: one to
13
- // represent the measured timing in the tracing clock (which we type as
14
- // PerformanceMeasure) and another one for the call itself (which we
15
- // type as UserTimingMeasure). The two events corresponding to the same
16
- // call are linked together by a common trace_id. The reason two events
17
- // are dispatched is because the first was originally added with the
18
- // implementation of the performance.measure API and it uses an
19
- // overridden timestamp and duration. To prevent breaking potential deps
20
- // created since then, a second event was added instead of changing the
21
- // params of the first.
22
- let measureTraceByTraceId = new Map();
23
- let performanceMeasureEvents = [];
24
- let performanceMarkEvents = [];
25
- let consoleTimings = [];
26
- let timestampEvents = [];
27
- export function reset() {
28
- syntheticEvents = [];
29
- performanceMeasureEvents = [];
30
- performanceMarkEvents = [];
31
- consoleTimings = [];
32
- timestampEvents = [];
33
- measureTraceByTraceId = new Map();
34
- }
35
- const resourceTimingNames = [
36
- 'workerStart',
37
- 'redirectStart',
38
- 'redirectEnd',
39
- 'fetchStart',
40
- 'domainLookupStart',
41
- 'domainLookupEnd',
42
- 'connectStart',
43
- 'connectEnd',
44
- 'secureConnectionStart',
45
- 'requestStart',
46
- 'responseStart',
47
- 'responseEnd',
48
- ];
49
- const navTimingNames = [
50
- 'navigationStart',
51
- 'unloadEventStart',
52
- 'unloadEventEnd',
53
- 'redirectStart',
54
- 'redirectEnd',
55
- 'fetchStart',
56
- 'commitNavigationEnd',
57
- 'domainLookupStart',
58
- 'domainLookupEnd',
59
- 'connectStart',
60
- 'connectEnd',
61
- 'secureConnectionStart',
62
- 'requestStart',
63
- 'responseStart',
64
- 'responseEnd',
65
- 'domLoading',
66
- 'domInteractive',
67
- 'domContentLoadedEventStart',
68
- 'domContentLoadedEventEnd',
69
- 'domComplete',
70
- 'loadEventStart',
71
- 'loadEventEnd',
72
- ];
73
- // These are events dispatched under the blink.user_timing category
74
- // but that the user didn't add. Filter them out so that they do not
75
- // Appear in the timings track (they still appear in the main thread
76
- // flame chart).
77
- const ignoredNames = [...resourceTimingNames, ...navTimingNames];
78
- function getEventTimings(event) {
79
- if ('dur' in event) {
80
- // It's a SyntheticEventPair.
81
- return { start: event.ts, end: Types.Timing.Micro(event.ts + (event.dur ?? 0)) };
82
- }
83
- if (Types.Events.isConsoleTimeStamp(event)) {
84
- const { start, end } = event.args.data || {};
85
- if (typeof start === 'number' && typeof end === 'number') {
86
- return { start: Types.Timing.Micro(start), end: Types.Timing.Micro(end) };
87
- }
88
- }
89
- // A ConsoleTimeStamp without start/end is just a point in time, so dur is 0.
90
- return { start: event.ts, end: event.ts };
91
- }
92
- function getEventTrack(event) {
93
- if (event.cat === 'blink.user_timing') {
94
- // This is a SyntheticUserTimingPair
95
- const detailString = event.args.data.beginEvent.args?.detail;
96
- if (detailString) {
97
- const details = Helpers.Trace.parseDevtoolsDetails(detailString, 'devtools');
98
- if (details && 'track' in details) {
99
- return details.track;
100
- }
101
- }
102
- }
103
- else if (Types.Events.isConsoleTimeStamp(event)) {
104
- const track = event.args.data?.track;
105
- return typeof track === 'string' ? track : undefined;
106
- }
107
- // SyntheticConsoleTimingPair does not have track info.
108
- return undefined;
109
- }
110
- /**
111
- * Similar to the default {@link Helpers.Trace.eventTimeComparator}
112
- * but with a twist:
113
- * In case of equal start and end times, put the second event (within a
114
- * track) first.
115
- *
116
- * Explanation:
117
- * User timing entries come as trace events dispatched when
118
- * performance.measure/mark is called. The trace events buffered in
119
- * devtools frontend are sorted by the start time. If their start time
120
- * is the same, then the event for the first call will appear first.
121
- *
122
- * When entries are meant to be stacked, the corresponding
123
- * performance.measure calls usually are done in bottom-up direction:
124
- * calls for children first and for parent later (because the call
125
- * is usually done when the measured task is over). This means that
126
- * when two user timing events have the same start and end time, usually
127
- * the second event is the parent of the first. Hence the switch.
128
- *
129
- */
130
- export function userTimingComparator(a, b, originalArray) {
131
- const { start: aStart, end: aEnd } = getEventTimings(a);
132
- const { start: bStart, end: bEnd } = getEventTimings(b);
133
- const timeDifference = Helpers.Trace.compareBeginAndEnd(aStart, bStart, aEnd, bEnd);
134
- if (timeDifference) {
135
- return timeDifference;
136
- }
137
- // Never re-order entries across different tracks.
138
- const aTrack = getEventTrack(a);
139
- const bTrack = getEventTrack(b);
140
- if (aTrack !== bTrack) {
141
- return 0; // Preserve current positions.
142
- }
143
- // Prefer the event located in a further position in the original array.
144
- const aIndex = originalArray.indexOf(a);
145
- const bIndex = originalArray.indexOf(b);
146
- return bIndex - aIndex;
147
- }
148
- export function handleEvent(event) {
149
- if (ignoredNames.includes(event.name)) {
150
- return;
151
- }
152
- if (Types.Events.isUserTimingMeasure(event)) {
153
- measureTraceByTraceId.set(event.args.traceId, event);
154
- }
155
- if (Types.Events.isPerformanceMeasure(event)) {
156
- performanceMeasureEvents.push(event);
157
- return;
158
- }
159
- if (Types.Events.isPerformanceMark(event)) {
160
- performanceMarkEvents.push(event);
161
- }
162
- if (Types.Events.isConsoleTime(event)) {
163
- consoleTimings.push(event);
164
- }
165
- if (Types.Events.isConsoleTimeStamp(event)) {
166
- timestampEvents.push(event);
167
- }
168
- }
169
- export async function finalize() {
170
- const asyncEvents = [...performanceMeasureEvents, ...consoleTimings];
171
- syntheticEvents = Helpers.Trace.createMatchedSortedSyntheticEvents(asyncEvents);
172
- syntheticEvents = syntheticEvents.sort((a, b) => userTimingComparator(a, b, [...syntheticEvents]));
173
- timestampEvents = timestampEvents.sort((a, b) => userTimingComparator(a, b, [...timestampEvents]));
174
- }
175
- export function data() {
176
- return {
177
- consoleTimings: syntheticEvents.filter(e => e.cat === 'blink.console'),
178
- performanceMeasures: syntheticEvents.filter(e => e.cat === 'blink.user_timing'),
179
- performanceMarks: performanceMarkEvents,
180
- timestampEvents,
181
- measureTraceByTraceId,
182
- };
183
- }
184
- //# sourceMappingURL=UserTimingsHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserTimingsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/UserTimingsHandler.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C;;;;IAII;AACJ,IAAI,eAAe,GAAuE,EAAE,CAAC;AAE7F,wEAAwE;AACxE,uEAAuE;AACvE,oEAAoE;AACpE,uEAAuE;AACvE,uEAAuE;AACvE,oEAAoE;AACpE,+DAA+D;AAC/D,wEAAwE;AACxE,uEAAuE;AACvE,uBAAuB;AACvB,IAAI,qBAAqB,GAAG,IAAI,GAAG,EAA0C,CAAC;AAC9E,IAAI,wBAAwB,GAAsC,EAAE,CAAC;AACrE,IAAI,qBAAqB,G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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,eAAe,CAA8C;QACnH,mBAAmB,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,mBAAmB,CACpC;QAC1C,gBAAgB,EAAE,qBAAqB;QACvC,eAAe;QACf,qBAAqB;KACtB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors\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 Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\n/**\n * IMPORTANT!\n * See UserTimings.md in this directory for some handy documentation on\n * UserTimings and the trace events we parse currently.\n **/\nlet syntheticEvents: Array<Types.Events.SyntheticEventPair<Types.Events.PairableAsync>> = [];\n\n// There are two events dispatched for performance.measure calls: one to\n// represent the measured timing in the tracing clock (which we type as\n// PerformanceMeasure) and another one for the call itself (which we\n// type as UserTimingMeasure). The two events corresponding to the same\n// call are linked together by a common trace_id. The reason two events\n// are dispatched is because the first was originally added with the\n// implementation of the performance.measure API and it uses an\n// overridden timestamp and duration. To prevent breaking potential deps\n// created since then, a second event was added instead of changing the\n// params of the first.\nlet measureTraceByTraceId = new Map<number, Types.Events.UserTimingMeasure>();\nlet performanceMeasureEvents: Types.Events.PerformanceMeasure[] = [];\nlet performanceMarkEvents: Types.Events.PerformanceMark[] = [];\n\nlet consoleTimings: Array<Types.Events.ConsoleTimeBegin|Types.Events.ConsoleTimeEnd> = [];\n\nlet timestampEvents: Types.Events.ConsoleTimeStamp[] = [];\n\nexport interface UserTimingsData {\n /**\n * Events triggered with the performance.measure() API.\n * https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure\n */\n performanceMeasures: readonly Types.Events.SyntheticUserTimingPair[];\n /**\n * Events triggered with the performance.mark() API.\n * https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark\n */\n performanceMarks: readonly Types.Events.PerformanceMark[];\n /**\n * Events triggered with the console.time(), console.timeEnd() and\n * console.timeLog() API.\n * https://developer.mozilla.org/en-US/docs/Web/API/console/time\n */\n consoleTimings: readonly Types.Events.SyntheticConsoleTimingPair[];\n /**\n * Events triggered with the console.timeStamp() API\n * https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp\n */\n timestampEvents: readonly Types.Events.ConsoleTimeStamp[];\n /**\n * Events triggered to trace the call to performance.measure itself,\n * cached by trace_id.\n */\n measureTraceByTraceId: Map<number, Types.Events.UserTimingMeasure>;\n}\n\nexport function reset(): void {\n syntheticEvents = [];\n performanceMeasureEvents = [];\n performanceMarkEvents = [];\n consoleTimings = [];\n timestampEvents = [];\n measureTraceByTraceId = new Map();\n}\n\nconst resourceTimingNames = [\n 'workerStart',\n 'redirectStart',\n 'redirectEnd',\n 'fetchStart',\n 'domainLookupStart',\n 'domainLookupEnd',\n 'connectStart',\n 'connectEnd',\n 'secureConnectionStart',\n 'requestStart',\n 'responseStart',\n 'responseEnd',\n];\nconst navTimingNames = [\n 'navigationStart',\n 'unloadEventStart',\n 'unloadEventEnd',\n 'redirectStart',\n 'redirectEnd',\n 'fetchStart',\n 'commitNavigationEnd',\n 'domainLookupStart',\n 'domainLookupEnd',\n 'connectStart',\n 'connectEnd',\n 'secureConnectionStart',\n 'requestStart',\n 'responseStart',\n 'responseEnd',\n 'domLoading',\n 'domInteractive',\n 'domContentLoadedEventStart',\n 'domContentLoadedEventEnd',\n 'domComplete',\n 'loadEventStart',\n 'loadEventEnd',\n];\n// These are events dispatched under the blink.user_timing category\n// but that the user didn't add. Filter them out so that they do not\n// Appear in the timings track (they still appear in the main thread\n// flame chart).\nconst ignoredNames = [...resourceTimingNames, ...navTimingNames];\n\nfunction getEventTimings(event: Types.Events.SyntheticEventPair|Types.Events.ConsoleTimeStamp):\n {start: Types.Timing.Micro, end: Types.Timing.Micro} {\n if ('dur' in event) {\n // It's a SyntheticEventPair.\n return {start: event.ts, end: Types.Timing.Micro(event.ts + (event.dur ?? 0))};\n }\n\n if (Types.Events.isConsoleTimeStamp(event)) {\n const {start, end} = event.args.data || {};\n if (typeof start === 'number' && typeof end === 'number') {\n return {start: Types.Timing.Micro(start), end: Types.Timing.Micro(end)};\n }\n }\n\n // A ConsoleTimeStamp without start/end is just a point in time, so dur is 0.\n return {start: event.ts, end: event.ts};\n}\n\nfunction getEventTrack(event: Types.Events.SyntheticEventPair|Types.Events.ConsoleTimeStamp): string|undefined {\n if (event.cat === 'blink.user_timing') {\n // This is a SyntheticUserTimingPair\n const detailString =\n ((event as Types.Events.SyntheticUserTimingPair).args.data.beginEvent.args as {detail?: string})?.detail;\n if (detailString) {\n const details = Helpers.Trace.parseDevtoolsDetails(detailString, 'devtools');\n if (details && 'track' in details) {\n return details.track;\n }\n }\n } else if (Types.Events.isConsoleTimeStamp(event)) {\n const track = event.args.data?.track;\n return typeof track === 'string' ? track : undefined;\n }\n\n // SyntheticConsoleTimingPair does not have track info.\n return undefined;\n}\n\n/**\n * Similar to the default {@link Helpers.Trace.eventTimeComparator}\n * but with a twist:\n * In case of equal start and end times, put the second event (within a\n * track) first.\n *\n * Explanation:\n * User timing entries come as trace events dispatched when\n * performance.measure/mark is called. The trace events buffered in\n * devtools frontend are sorted by the start time. If their start time\n * is the same, then the event for the first call will appear first.\n *\n * When entries are meant to be stacked, the corresponding\n * performance.measure calls usually are done in bottom-up direction:\n * calls for children first and for parent later (because the call\n * is usually done when the measured task is over). This means that\n * when two user timing events have the same start and end time, usually\n * the second event is the parent of the first. Hence the switch.\n *\n */\nexport function userTimingComparator<T extends Types.Events.SyntheticEventPair|Types.Events.ConsoleTimeStamp>(\n a: T, b: T, originalArray: readonly T[]): number {\n const {start: aStart, end: aEnd} = getEventTimings(a);\n const {start: bStart, end: bEnd} = getEventTimings(b);\n const timeDifference = Helpers.Trace.compareBeginAndEnd(aStart, bStart, aEnd, bEnd);\n if (timeDifference) {\n return timeDifference;\n }\n\n // Never re-order entries across different tracks.\n const aTrack = getEventTrack(a);\n const bTrack = getEventTrack(b);\n if (aTrack !== bTrack) {\n return 0; // Preserve current positions.\n }\n\n // Prefer the event located in a further position in the original array.\n const aIndex = originalArray.indexOf(a);\n const bIndex = originalArray.indexOf(b);\n return bIndex - aIndex;\n}\n\nexport function handleEvent(event: Types.Events.Event): void {\n if (ignoredNames.includes(event.name)) {\n return;\n }\n if (Types.Events.isUserTimingMeasure(event)) {\n measureTraceByTraceId.set(event.args.traceId, event);\n }\n if (Types.Events.isPerformanceMeasure(event)) {\n performanceMeasureEvents.push(event);\n return;\n }\n if (Types.Events.isPerformanceMark(event)) {\n performanceMarkEvents.push(event);\n }\n if (Types.Events.isConsoleTime(event)) {\n consoleTimings.push(event);\n }\n if (Types.Events.isConsoleTimeStamp(event)) {\n timestampEvents.push(event);\n }\n}\n\nexport async function finalize(): Promise<void> {\n const asyncEvents = [...performanceMeasureEvents, ...consoleTimings];\n syntheticEvents = Helpers.Trace.createMatchedSortedSyntheticEvents(asyncEvents);\n syntheticEvents = syntheticEvents.sort((a, b) => userTimingComparator(a, b, [...syntheticEvents]));\n timestampEvents = timestampEvents.sort((a, b) => userTimingComparator(a, b, [...timestampEvents]));\n}\n\nexport function data(): UserTimingsData {\n return {\n consoleTimings: syntheticEvents.filter(e => e.cat === 'blink.console') as Types.Events.SyntheticConsoleTimingPair[],\n performanceMeasures: syntheticEvents.filter(e => e.cat === 'blink.user_timing') as\n Types.Events.SyntheticUserTimingPair[],\n performanceMarks: performanceMarkEvents,\n timestampEvents,\n measureTraceByTraceId,\n };\n}\n"]}