@paulirish/trace_engine 0.0.54 → 0.0.55

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 (187) hide show
  1. package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +4 -0
  2. package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +1 -0
  3. package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
  4. package/core/platform/MimeType.d.ts +3 -2
  5. package/core/platform/MimeType.js +4 -3
  6. package/core/platform/MimeType.js.map +1 -1
  7. package/generated/protocol.d.ts +115 -16
  8. package/locales/af.json +52 -10
  9. package/locales/am.json +52 -10
  10. package/locales/ar.json +51 -9
  11. package/locales/as.json +52 -10
  12. package/locales/az.json +52 -10
  13. package/locales/be.json +52 -10
  14. package/locales/bg.json +52 -10
  15. package/locales/bn.json +52 -10
  16. package/locales/bs.json +52 -10
  17. package/locales/ca.json +52 -10
  18. package/locales/cs.json +52 -10
  19. package/locales/cy.json +52 -10
  20. package/locales/da.json +52 -10
  21. package/locales/de.json +52 -10
  22. package/locales/el.json +52 -10
  23. package/locales/en-GB.json +52 -10
  24. package/locales/en-US.json +12 -12
  25. package/locales/en-XL.json +12 -12
  26. package/locales/es-419.json +52 -10
  27. package/locales/es.json +50 -8
  28. package/locales/et.json +52 -10
  29. package/locales/eu.json +52 -10
  30. package/locales/fa.json +51 -9
  31. package/locales/fi.json +52 -10
  32. package/locales/fil.json +52 -10
  33. package/locales/fr-CA.json +52 -10
  34. package/locales/fr.json +52 -10
  35. package/locales/gl.json +52 -10
  36. package/locales/gu.json +52 -10
  37. package/locales/he.json +52 -10
  38. package/locales/hi.json +52 -10
  39. package/locales/hr.json +52 -10
  40. package/locales/hu.json +51 -9
  41. package/locales/hy.json +51 -9
  42. package/locales/id.json +52 -10
  43. package/locales/is.json +53 -11
  44. package/locales/it.json +51 -9
  45. package/locales/ja.json +52 -10
  46. package/locales/ka.json +53 -11
  47. package/locales/kk.json +51 -9
  48. package/locales/km.json +52 -10
  49. package/locales/kn.json +52 -10
  50. package/locales/ko.json +52 -10
  51. package/locales/ky.json +51 -9
  52. package/locales/lo.json +52 -10
  53. package/locales/lt.json +52 -10
  54. package/locales/lv.json +51 -9
  55. package/locales/mk.json +52 -10
  56. package/locales/ml.json +53 -11
  57. package/locales/mn.json +52 -10
  58. package/locales/mr.json +52 -10
  59. package/locales/ms.json +52 -10
  60. package/locales/my.json +51 -9
  61. package/locales/ne.json +52 -10
  62. package/locales/nl.json +52 -10
  63. package/locales/no.json +52 -10
  64. package/locales/or.json +53 -11
  65. package/locales/pa.json +53 -11
  66. package/locales/pl.json +51 -9
  67. package/locales/pt-PT.json +52 -10
  68. package/locales/pt.json +52 -10
  69. package/locales/ro.json +52 -10
  70. package/locales/ru.json +53 -11
  71. package/locales/si.json +52 -10
  72. package/locales/sk.json +51 -9
  73. package/locales/sl.json +51 -9
  74. package/locales/sq.json +52 -10
  75. package/locales/sr-Latn.json +52 -10
  76. package/locales/sr.json +52 -10
  77. package/locales/sv.json +52 -10
  78. package/locales/sw.json +51 -9
  79. package/locales/ta.json +52 -10
  80. package/locales/te.json +52 -10
  81. package/locales/th.json +51 -9
  82. package/locales/tr.json +52 -10
  83. package/locales/uk.json +52 -10
  84. package/locales/ur.json +52 -10
  85. package/locales/uz.json +51 -9
  86. package/locales/vi.json +52 -10
  87. package/locales/zh-HK.json +52 -10
  88. package/locales/zh-TW.json +51 -9
  89. package/locales/zh.json +52 -10
  90. package/locales/zu.json +52 -10
  91. package/models/cpu_profile/CPUProfileDataModel.d.ts +4 -2
  92. package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
  93. package/models/cpu_profile/ProfileTreeModel.d.ts +0 -1
  94. package/models/cpu_profile/ProfileTreeModel.js +0 -2
  95. package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
  96. package/models/trace/LanternComputationData.js +7 -6
  97. package/models/trace/LanternComputationData.js.map +1 -1
  98. package/models/trace/Processor.js +23 -16
  99. package/models/trace/Processor.js.map +1 -1
  100. package/models/trace/extras/extras-tsconfig.json +0 -2
  101. package/models/trace/extras/extras.js.map +1 -1
  102. package/models/trace/handlers/MetaHandler.js +2 -0
  103. package/models/trace/handlers/MetaHandler.js.map +1 -1
  104. package/models/trace/handlers/NetworkRequestsHandler.d.ts +0 -5
  105. package/models/trace/handlers/NetworkRequestsHandler.js +0 -19
  106. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  107. package/models/trace/handlers/SamplesHandler.js +7 -2
  108. package/models/trace/handlers/SamplesHandler.js.map +1 -1
  109. package/models/trace/handlers/ScriptsHandler.js.map +1 -1
  110. package/models/trace/helpers/SamplesIntegrator.js +8 -13
  111. package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
  112. package/models/trace/helpers/Trace.js +0 -7
  113. package/models/trace/helpers/Trace.js.map +1 -1
  114. package/models/trace/insights/CLSCulprits.d.ts +24 -4
  115. package/models/trace/insights/CLSCulprits.js +30 -11
  116. package/models/trace/insights/CLSCulprits.js.map +1 -1
  117. package/models/trace/insights/DocumentLatency.d.ts +2 -2
  118. package/models/trace/insights/DocumentLatency.js +2 -2
  119. package/models/trace/insights/DocumentLatency.js.map +1 -1
  120. package/models/trace/insights/NetworkDependencyTree.d.ts +31 -5
  121. package/models/trace/insights/NetworkDependencyTree.js +135 -10
  122. package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
  123. package/models/trace/insights/Viewport.d.ts +8 -2
  124. package/models/trace/insights/Viewport.js +16 -1
  125. package/models/trace/insights/Viewport.js.map +1 -1
  126. package/models/trace/lantern/graph/BaseNode.d.ts +5 -2
  127. package/models/trace/lantern/graph/BaseNode.js +8 -5
  128. package/models/trace/lantern/graph/BaseNode.js.map +1 -1
  129. package/models/trace/lantern/graph/PageDependencyGraph.js +46 -3
  130. package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -1
  131. package/models/trace/lantern/simulation/Simulator.js +1 -1
  132. package/models/trace/lantern/simulation/Simulator.js.map +1 -1
  133. package/models/trace/trace-tsconfig.json +0 -1
  134. package/models/trace/trace.d.ts +1 -2
  135. package/models/trace/trace.js +1 -2
  136. package/models/trace/trace.js.map +1 -1
  137. package/models/trace/types/Extensions.d.ts +6 -1
  138. package/models/trace/types/Extensions.js.map +1 -1
  139. package/models/trace/types/File.d.ts +15 -1
  140. package/models/trace/types/File.js.map +1 -1
  141. package/models/trace/types/TraceEvents.d.ts +7 -4
  142. package/models/trace/types/TraceEvents.js +4 -3
  143. package/models/trace/types/TraceEvents.js.map +1 -1
  144. package/package.json +1 -1
  145. package/core/platform/ServerTiming.d.ts +0 -31
  146. package/core/platform/ServerTiming.js +0 -212
  147. package/core/platform/ServerTiming.js.map +0 -1
  148. package/models/trace/TracingManager.js.map +0 -1
  149. package/models/trace/extras/FetchNodes.d.ts +0 -61
  150. package/models/trace/extras/FetchNodes.js +0 -214
  151. package/models/trace/extras/FetchNodes.js.map +0 -1
  152. package/models/trace/extras/Metadata.d.ts +0 -3
  153. package/models/trace/extras/Metadata.js +0 -71
  154. package/models/trace/extras/Metadata.js.map +0 -1
  155. package/models/trace/extras/TimelineJSProfile.d.ts +0 -13
  156. package/models/trace/extras/TimelineJSProfile.js +0 -55
  157. package/models/trace/extras/TimelineJSProfile.js.map +0 -1
  158. package/models/trace/extras/URLForEntry.d.ts +0 -12
  159. package/models/trace/extras/URLForEntry.js +0 -43
  160. package/models/trace/extras/URLForEntry.js.map +0 -1
  161. package/models/trace/handlers/ServerTimingsHandler.d.ts +0 -9
  162. package/models/trace/handlers/ServerTimingsHandler.js +0 -106
  163. package/models/trace/handlers/ServerTimingsHandler.js.map +0 -1
  164. package/models/trace/insights/CumulativeLayoutShift.d.ts +0 -57
  165. package/models/trace/insights/CumulativeLayoutShift.js +0 -335
  166. package/models/trace/insights/CumulativeLayoutShift.js.map +0 -1
  167. package/models/trace/insights/InsightRunners.d.ts +0 -9
  168. package/models/trace/insights/InsightRunners.js +0 -13
  169. package/models/trace/insights/InsightRunners.js.map +0 -1
  170. package/models/trace/insights/LargestContentfulPaint.d.ts +0 -38
  171. package/models/trace/insights/LargestContentfulPaint.js +0 -113
  172. package/models/trace/insights/LargestContentfulPaint.js.map +0 -1
  173. package/models/trace/insights/ThirdPartyWeb.d.ts +0 -13
  174. package/models/trace/insights/ThirdPartyWeb.js +0 -42
  175. package/models/trace/insights/ThirdPartyWeb.js.map +0 -1
  176. package/models/trace/root-causes/LayoutShift.d.ts +0 -125
  177. package/models/trace/root-causes/LayoutShift.js +0 -519
  178. package/models/trace/root-causes/LayoutShift.js.map +0 -1
  179. package/models/trace/root-causes/RootCauses.d.ts +0 -15
  180. package/models/trace/root-causes/RootCauses.js +0 -12
  181. package/models/trace/root-causes/RootCauses.js.map +0 -1
  182. package/models/trace/root-causes/bundle-tsconfig.json +0 -1
  183. package/models/trace/root-causes/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -42
  184. package/models/trace/root-causes/root-causes-tsconfig.json +0 -55
  185. package/models/trace/root-causes/root-causes.d.ts +0 -1
  186. package/models/trace/root-causes/root-causes.js +0 -5
  187. package/models/trace/root-causes/root-causes.js.map +0 -1
package/locales/zu.json CHANGED
@@ -35,9 +35,6 @@
35
35
  "generated/Deprecation.ts | CrossOriginWindowConfirm": {
36
36
  "message": "Ukucupha i-window.confirm ukusuka kuma-iframe omsuka ophambene kuhoxisiwe futhi kuzosuswa ngokuzayo."
37
37
  },
38
- "generated/Deprecation.ts | DOMMutationEvents": {
39
- "message": "Imicimbi Yokuguqulwa Kwe-DOM, kufaka phakathi i-DOMSubtreeModified, i-DOMNodeInserted, i-DOMNodeRemoved, i-DOMNodeRemovedFromDocument, i-DOMNodeInsertedIntoDocument, ne-DOMCharacterDataModified zihoxisiwe (https://w3c.github.io/uievents/#legacy-event-types) futhi zizosuswa. Kunalokho sicela usebenzise i-MutationObserver."
40
- },
41
38
  "generated/Deprecation.ts | DataUrlInSvgUse": {
42
39
  "message": "Ukusekela idatha: Ama-URL ku-SVGUseElement ayahoxiswa futhi azosuswa esikhathini esizayo."
43
40
  },
@@ -167,6 +164,9 @@
167
164
  "generated/Deprecation.ts | V8SharedArrayBufferConstructedInExtensionWithoutIsolation": {
168
165
  "message": "Izandiso kufanele zingene ekuhlukaniseni imvelaphi ehlukene ukuze ziqhubeke nokusebenzisa i-SharedArrayBuffer. Bheka i-https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/."
169
166
  },
167
+ "generated/Deprecation.ts | WebGPUAdapterIsFallbackAdapter": {
168
+ "message": "Isibaluli seGPUAdapter isFallbackAdapter sihoxisiwe, sebenzisa isibaluli seGPUAdapterInfo isFallbackAdapter esikhundleni saso."
169
+ },
170
170
  "generated/Deprecation.ts | XHRJSONEncodingDetection": {
171
171
  "message": "I-UTF-16 ayisekelwe yimpendulo ye-json ku-XMLHttpRequest"
172
172
  },
@@ -255,10 +255,10 @@
255
255
  "message": "Isicelo sakho sokuqala senethiwekhi sibaluleke kakhulu. Nciphisa ukubambezeleka kwayo ngokugwema ukuqondiswa kabusha, okuqinisekisa impendulo esheshayo yeseva, nokunika amandla ukuminyaniswa kombhalo."
256
256
  },
257
257
  "models/trace/insights/DocumentLatency.ts | failedRedirects": {
258
- "message": "Kuye kwaqondiswa kabusha"
258
+ "message": "Ibe nokuqondisa kabusha ({PH1} ukuqondisa kabusha, +{PH2})"
259
259
  },
260
260
  "models/trace/insights/DocumentLatency.ts | failedServerResponseTime": {
261
- "message": "Iseva ayisabelanga ngokushesha"
261
+ "message": "Iseva iphendule kancane (kuqashiwe {PH1}) "
262
262
  },
263
263
  "models/trace/insights/DocumentLatency.ts | failedTextCompression": {
264
264
  "message": "Akukho ukuminyanisa okusetshenzisiwe"
@@ -267,7 +267,7 @@
267
267
  "message": "Kugwema ukuqondisa kabusha"
268
268
  },
269
269
  "models/trace/insights/DocumentLatency.ts | passingServerResponseTime": {
270
- "message": "Iseva isabela ngokushesha"
270
+ "message": "Iseva iphendule ngokushesha (kuqashiwe {PH1}) "
271
271
  },
272
272
  "models/trace/insights/DocumentLatency.ts | passingTextCompression": {
273
273
  "message": "Ifaka ukuminyaniswa kombhalo"
@@ -420,7 +420,7 @@
420
420
  "message": "Ukwephuza kokunikeza isakhi"
421
421
  },
422
422
  "models/trace/insights/LCPPhases.ts | fieldDuration": {
423
- "message": "Amaphesenti angu-75 enkundla"
423
+ "message": "Inkambu i-p75"
424
424
  },
425
425
  "models/trace/insights/LCPPhases.ts | noLcp": {
426
426
  "message": "Ayikho i-LCP etholakele"
@@ -447,7 +447,7 @@
447
447
  "message": "Amabhayithi amoshiwe"
448
448
  },
449
449
  "models/trace/insights/LegacyJavaScript.ts | description": {
450
- "message": "Ama-polyfill neziguquli kuvumela amabhrawuza wefa ukuthi asebenzise izakhi zeJavaScript ezintsha. Nokho, okuningi akudingekile kumabhrawuza wesimanje. Cabangela ukulungisa inqubo yokwakhiwa kweJavaScript yakho ukuze ingaguquli izakhi [zeBaseline](https://web.dev/articles/baseline-and-polyfills), ngaphandle uma wazi ukuthi kumele usekele amabhrawuza efa. [Funda ukuthi kungani iningi lamasayithi lingathumela ikhodi ye-ES6+ ngaphandle kokuguqula](https://philipwalton.com/articles/the-state-of-es5-on-the-web/)"
450
+ "message": "Ama-polyfill neziguquli kuvumela amabhrawuza amadala ukuthi asebenzise izakhi zeJavaScript ezintsha. Nokho, okuningi akudingekile kumabhrawuza esimanje. Cabangela ukulungisa inqubo yokwakhiwa kweJavaScript yakho ukuze ingaguquli izakhi [zeBaseline](https://web.dev/articles/baseline-and-polyfills), ngaphandle uma wazi ukuthi kumele usekele amabhrawuza amadala. [Funda ukuthi kungani iningi lamasayithi lingathumela ikhodi ye-ES6+ ngaphandle kokuguqula](https://philipwalton.com/articles/the-state-of-es5-on-the-web/)"
451
451
  },
452
452
  "models/trace/insights/LegacyJavaScript.ts | title": {
453
453
  "message": "IJavaScript eyifa"
@@ -467,23 +467,65 @@
467
467
  "models/trace/insights/ModernHTTP.ts | title": {
468
468
  "message": "I-HTTP yesimanje"
469
469
  },
470
+ "models/trace/insights/NetworkDependencyTree.ts | columnOrigin": {
471
+ "message": "Umsuka"
472
+ },
473
+ "models/trace/insights/NetworkDependencyTree.ts | columnRequest": {
474
+ "message": "Isicelo"
475
+ },
476
+ "models/trace/insights/NetworkDependencyTree.ts | columnSource": {
477
+ "message": "Umthombo"
478
+ },
479
+ "models/trace/insights/NetworkDependencyTree.ts | columnTime": {
480
+ "message": "Isikhathi"
481
+ },
482
+ "models/trace/insights/NetworkDependencyTree.ts | columnWastedMs": {
483
+ "message": "Isungula izilondolozi ze-LCP"
484
+ },
485
+ "models/trace/insights/NetworkDependencyTree.ts | crossoriginWarning": {
486
+ "message": "Ukuxhuma kwangaphambili okungasentshenzisiwe. Hlola ukuthi isibaluli se-crossorigin sisetshenziswa ngendlela efanele."
487
+ },
470
488
  "models/trace/insights/NetworkDependencyTree.ts | description": {
471
489
  "message": "[Gwema ukulandelanisa eduze izicelo ezibucayi](https://developer.chrome.com/docs/lighthouse/performance/critical-request-chains) ngokunciphisa ubude bokulandelana, ukunciphisa usayizi wezinsiza ezidawunilodwayo, noma ukuhlehliswa kokudawunilodwa kwezinsiza ezingadingeki ukuze uthuthukise ukulayisha kwekhasi."
472
490
  },
491
+ "models/trace/insights/NetworkDependencyTree.ts | estSavingTableDescription": {
492
+ "message": "Faka izibonisi [zokuxhuma ngaphambilini](https://developer.chrome.com/docs/lighthouse/performance/uses-rel-preconnect/) emisukeni yakho ebaluleke kakhulu, kodwa zama ukusebenzisa ezingaphansi kwezi-4."
493
+ },
494
+ "models/trace/insights/NetworkDependencyTree.ts | estSavingTableTitle": {
495
+ "message": "Amakhandidethi okuxhuma ngaphambilini"
496
+ },
473
497
  "models/trace/insights/NetworkDependencyTree.ts | maxCriticalPathLatency": {
474
498
  "message": "Ukubambezeleka kwendlela ebalulekile enkulu:"
475
499
  },
476
500
  "models/trace/insights/NetworkDependencyTree.ts | noNetworkDependencyTree": {
477
501
  "message": "Ayikho imisebenzi enikeziwe ethintwe okuncike kunethiwekhi"
478
502
  },
503
+ "models/trace/insights/NetworkDependencyTree.ts | noPreconnectCandidates": {
504
+ "message": "Ayisekho imisuka eyengeziwe efanelekayo ekuxhumeni kwangaphambili"
505
+ },
506
+ "models/trace/insights/NetworkDependencyTree.ts | noPreconnectOrigins": {
507
+ "message": "ayisekho imisuka exhunywe ngaphambilini"
508
+ },
509
+ "models/trace/insights/NetworkDependencyTree.ts | preconnectOriginsTableDescription": {
510
+ "message": "Izibonisi [zokuxhuma ngaphambili](https://developer.chrome.com/docs/lighthouse/performance/uses-rel-preconnect/) zisiza ibhrawuza ukuthi ibone ukuxhuma ngaphambi kokulayisha ikhasi, okonga isikhathi uma isicelo sokuqala salowo msuka senziwe. Okulandelayo imisuka ikhasi elixhunywe kuyo ngaphambili."
511
+ },
512
+ "models/trace/insights/NetworkDependencyTree.ts | preconnectOriginsTableTitle": {
513
+ "message": "Imisuka exhunywe kusengaphambili"
514
+ },
479
515
  "models/trace/insights/NetworkDependencyTree.ts | title": {
480
516
  "message": "Isihlahla sokuncika kunethiwekhi"
481
517
  },
518
+ "models/trace/insights/NetworkDependencyTree.ts | tooManyPreconnectLinksWarning": {
519
+ "message": "Kutholakale uxhumano lwe-preconnect olungaphezu kolu-4. Lezi kufanele zisetshenziswe kahle futhi ngokwemisuka ebalulekile kuphela."
520
+ },
521
+ "models/trace/insights/NetworkDependencyTree.ts | unusedWarning": {
522
+ "message": "Ukuxhuma kwangaphambili okungasentshenzisiwe. Sebenzisa kuphela i-preconnect yemisuka ikhasi elingathanda ukuyicela."
523
+ },
482
524
  "models/trace/insights/NetworkDependencyTree.ts | warningDescription": {
483
525
  "message": "Gwema ukuxhumanisa izicelo ezibucayi ngokunciphisa ubude bokuxhumanisa, ukwehlisa usayizi wokudawuniloda wezinsiza, noma ukuhlehlisa ukudawunilodwa kwezinsiza ezingadingekile ukuze kuthuthukiswe ukulayishwa kwekhasi."
484
526
  },
485
527
  "models/trace/insights/RenderBlocking.ts | description": {
486
- "message": "Izicelo zivimbela umnikezi wasekuqaleni wekhasi, okungase kubambezele i-LCP. [Ukuhlehlisa noma ukuqondanisa](https://web.dev/learn/performance/understanding-the-critical-path#render-blocking_resources/) kungasusa lezi zicelo zenethiwekhi emzileni obucayi."
528
+ "message": "Izicelo zivimbela umnikezi wasekuqaleni wekhasi, okungase kubambezele i-LCP. [Ukuhlehlisa noma ukuqondanisa](https://web.dev/learn/performance/understanding-the-critical-path#render-blocking_resources) kungasusa lezi zicelo zenethiwekhi emzileni obucayi."
487
529
  },
488
530
  "models/trace/insights/RenderBlocking.ts | duration": {
489
531
  "message": "Ubude besikhathi"
@@ -531,7 +573,7 @@
531
573
  "message": "Usayizi wokudlulisela"
532
574
  },
533
575
  "models/trace/insights/ThirdParties.ts | description": {
534
- "message": "Ikhodi yenkampani engahlangene ngqo ingathinta ukusebenza kokulayisha. [Nciphisa uphinde uhlehlise ukulayishwa kwekhodi yenkampani engahlangene ngqo](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript/) ukuze wenze kubaluleke ikhontenti yekhasi lakho."
576
+ "message": "Ikhodi yenkampani engahlangene ngqo ingathinta ukusebenza kokulayisha. [Nciphisa uphinde uhlehlise ukulayishwa kwekhodi yenkampani engahlangene ngqo](https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript/) ukuze wenze kubaluleke ikhontenti yekhasi lakho."
535
577
  },
536
578
  "models/trace/insights/ThirdParties.ts | noThirdParties": {
537
579
  "message": "Ayikho inhlangano engahlangene ngqo etholakele"
@@ -85,8 +85,10 @@ export type ExtendedProfile = Protocol.Profiler.Profile & {
85
85
  * When this is done an id (trace id) can be passed to the API to
86
86
  * identify the collected sample in the resulting CPU profile. We
87
87
  * do this for several trace events, to efficiently calculate their
88
- * stack trace and improve the JS flamechart we build. This property
89
- * contains the mapping of the trace ids with the shape traceId -> nodeId
88
+ * stack trace and improve the JS flamechart we build.
89
+ *
90
+ * This property, only present if there's any trace id provided within profileChunks,
91
+ * contains the mapping of the trace ids with the shape traceId -> nodeId.
90
92
  */
91
93
  traceIds?: Record<string, number>;
92
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CPUProfileDataModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/CPUProfileDataModel.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,OAAO,cAAe,SAAQ,WAAW;IACpC,EAAE,CAAS;IACX,IAAI,CAAS;IACtB,gEAAgE;IAChE,kEAAkE;IAClE,qEAAqE;IACrE,+DAA+D;IAC/D,yBAAyB;IACzB,aAAa,CAAiD;IACrD,WAAW,CAAc;IAElC,YAAY,IAAmC,EAAE,gBAAwB,CAAC,kBAAkB;QAC1F,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAK;YACjB,mEAAmE;YACnE,mBAAmB;YACnB,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC;YAClC,mEAAmE;YACnE,mBAAmB;YACnB,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;YAC1B,mEAAmE;YACnE,mBAAmB;YACnB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;YAChB,mEAAmE;YACnE,mBAAmB;YACnB,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;YAClC,mEAAmE;YACnE,mBAAmB;YACnB,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;SACR,CAAC;QACnD,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,gBAAgB,CAAC;QACpD,IAAI,CAAC,aAAa,GA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AK,EAAE,QAAQ,EAAE,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC5G,EAAE,QAAQ,CAAC;YACX,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC;QAC3B,CAAC;QACD,KAAK,IAAI,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACvE,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;YACxC,MAAM,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC;YACpC,qBAAqB,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC;YAChD,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC/G,EAAE,QAAQ,CAAC;QACb,CAAC;IACH,CAAC;IACD;;OAEG;IACH,WAAW,CAAC,KAAa;QACvB,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/E,CAAC;IACD;;OAEG;IACH,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IAClD,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["// Copyright 2014 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../core/platform/platform.js';\nimport type * as Protocol from '../../generated/protocol.js';\n\nimport {ProfileNode, ProfileTreeModel} from './ProfileTreeModel.js';\n\nexport class CPUProfileNode extends ProfileNode {\n override id: number;\n override self: number;\n // Position ticks are available in profile nodes coming from CDP\n // profiles and not in those coming from tracing. They are used to\n // calculate the line level execution time shown in the Sources panel\n // after recording a profile. For trace CPU profiles we use the\n // `lines` array instead.\n positionTicks: Protocol.Profiler.PositionTickInfo[]|undefined;\n override deoptReason: string|null;\n\n constructor(node: Protocol.Profiler.ProfileNode, samplingInterval: number /* milliseconds */) {\n const callFrame = node.callFrame || ({\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n functionName: node['functionName'],\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n scriptId: node['scriptId'],\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n url: node['url'],\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n lineNumber: node['lineNumber'] - 1,\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n columnNumber: node['columnNumber'] - 1,\n } as Protocol.Runtime.CallFrame);\n super(callFrame);\n this.id = node.id;\n this.self = (node.hitCount || 0) * samplingInterval;\n this.positionTicks = node.positionTicks;\n // Compatibility: legacy backends could provide \"no reason\" for optimized functions.\n this.deoptReason = node.deoptReason && node.deoptReason !== 'no reason' ? node.deoptReason : null;\n }\n}\n\nexport class CPUProfileDataModel extends ProfileTreeModel {\n profileStartTime: number /* milliseconds */;\n profileEndTime: number /* milliseconds */;\n timestamps: number[];\n samples: number[]|undefined;\n /**\n * Contains trace ids assigned to samples, if any. Trace ids are\n * keyed by the sample index in the profile. These are only created\n * for CPU profiles coming from traces.\n */\n traceIds?: Record<string, number>;\n lines?: number[];\n totalHitCount: number;\n profileHead: CPUProfileNode;\n /**\n * A cache for the nodes we have parsed.\n * Note: \"Parsed\" nodes are different from the \"Protocol\" nodes, the\n * latter being the raw data we receive from the backend.\n */\n #idToParsedNode!: Map<number, ProfileNode>;\n gcNode?: ProfileNode;\n programNode?: ProfileNode;\n idleNode?: ProfileNode;\n #stackStartTimes?: number[];\n #stackChildrenDuration?: number[];\n constructor(profile: ExtendedProfile) {\n super();\n // @ts-expect-error Legacy types\n const isLegacyFormat = Boolean(profile['head']);\n if (isLegacyFormat) {\n // Legacy format contains raw timestamps and start/stop times are in seconds.\n this.profileStartTime = profile.startTime * 1000;\n this.profileEndTime = profile.endTime * 1000;\n // @ts-expect-error Legacy types\n this.timestamps = profile.timestamps;\n this.compatibilityConversionHeadToNodes(profile);\n } else {\n // Current format encodes timestamps as deltas. Start/stop times are in microseconds.\n this.profileStartTime = profile.startTime / 1000;\n this.profileEndTime = profile.endTime / 1000;\n this.timestamps = this.convertTimeDeltas(profile);\n }\n this.traceIds = profile.traceIds;\n this.samples = profile.samples;\n\n // Lines are available only in profiles coming from tracing.\n // Elements in the lines array have a 1 to 1 correspondence with\n // samples, by array position. They can be 1 or 0 and indicate if\n // there is line data for a given sample, i.e. if a given sample\n // needs to be included to calculate the line level execution time\n // data, which we show in the sources panel after recording a\n // profile.\n this.lines = profile.lines;\n this.totalHitCount = 0;\n this.profileHead = this.translateProfileTree(profile.nodes);\n this.initialize(this.profileHead);\n this.extractMetaNodes();\n if (this.samples?.length) {\n this.sortSamples();\n this.normalizeTimestamps();\n this.fixMissingSamples();\n }\n }\n\n private compatibilityConversionHeadToNodes(profile: Protocol.Profiler.Profile): void {\n // @ts-expect-error Legacy types\n if (!profile.head || profile.nodes) {\n return;\n }\n const nodes: Protocol.Profiler.ProfileNode[] = [];\n // @ts-expect-error Legacy types\n convertNodesTree(profile.head);\n profile.nodes = nodes;\n // @ts-expect-error Legacy types\n delete profile.head;\n function convertNodesTree(node: Protocol.Profiler.ProfileNode): number {\n nodes.push(node);\n // @ts-expect-error Legacy types\n node.children = (node.children as Protocol.Profiler.ProfileNode[]).map(convertNodesTree);\n return node.id;\n }\n }\n\n /**\n * Calculate timestamps using timeDeltas. Some CPU profile formats,\n * like the ones contained in traces have timeDeltas instead of\n * timestamps.\n */\n private convertTimeDeltas(profile: Protocol.Profiler.Profile): number[] {\n if (!profile.timeDeltas) {\n return [];\n }\n let lastTimeMicroSec = profile.startTime;\n const timestamps = new Array(profile.timeDeltas.length);\n for (let i = 0; i < profile.timeDeltas.length; ++i) {\n lastTimeMicroSec += profile.timeDeltas[i];\n timestamps[i] = lastTimeMicroSec;\n }\n return timestamps;\n }\n\n /**\n * Creates a Tree of CPUProfileNodes using the Protocol.Profiler.ProfileNodes.\n * As the tree is built, samples of native code (prefixed with \"native \") are\n * filtered out. Samples of filtered nodes are replaced with the parent of the\n * node being filtered.\n *\n * This function supports legacy and new definitions of the CDP Profiler.Profile\n * type.\n */\n private translateProfileTree(nodes: Protocol.Profiler.ProfileNode[]): CPUProfileNode {\n function buildChildrenFromParents(nodes: Protocol.Profiler.ProfileNode[]): void {\n if (nodes[0].children) {\n return;\n }\n nodes[0].children = [];\n for (let i = 1; i < nodes.length; ++i) {\n const node = nodes[i];\n // @ts-expect-error Legacy types\n const parentNode = protocolNodeById.get(node.parent);\n if (!parentNode) {\n continue;\n }\n if (parentNode.children) {\n parentNode.children.push(node.id);\n } else {\n parentNode.children = [node.id];\n }\n }\n }\n\n /**\n * Calculate how many times each node was sampled in the profile, if\n * not available in the profile data.\n */\n function buildHitCountFromSamples(nodes: Protocol.Profiler.ProfileNode[], samples: number[]|undefined): void {\n // If hit count is available, this profile has the new format, so\n // no need to continue.`\n if (typeof (nodes[0].hitCount) === 'number') {\n return;\n }\n if (!samples) {\n throw new Error('Error: Neither hitCount nor samples are present in profile.');\n }\n for (let i = 0; i < nodes.length; ++i) {\n nodes[i].hitCount = 0;\n }\n for (let i = 0; i < samples.length; ++i) {\n const node = protocolNodeById.get(samples[i]);\n if (node?.hitCount === undefined) {\n continue;\n }\n node.hitCount++;\n }\n }\n\n // A cache for the raw nodes received from the traces / CDP.\n const protocolNodeById = new Map<number, Protocol.Profiler.ProfileNode>();\n for (let i = 0; i < nodes.length; ++i) {\n const node = nodes[i];\n protocolNodeById.set(node.id, node);\n }\n\n buildHitCountFromSamples(nodes, this.samples);\n buildChildrenFromParents(nodes);\n this.totalHitCount = nodes.reduce((acc, node) => acc + (node.hitCount || 0), 0);\n const sampleTime = (this.profileEndTime - this.profileStartTime) / this.totalHitCount;\n const root = nodes[0];\n // If a node is filtered out, its samples are replaced with its parent,\n // so we keep track of the which id to use in the samples data.\n const idToUseForRemovedNode = new Map<number, number>([[root.id, root.id]]);\n this.#idToParsedNode = new Map();\n\n const resultRoot = new CPUProfileNode(root, sampleTime);\n this.#idToParsedNode.set(root.id, resultRoot);\n if (!root.children) {\n throw new Error('Missing children for root');\n }\n const parentNodeStack = root.children.map(() => resultRoot);\n const sourceNodeStack = root.children.map(id => protocolNodeById.get(id));\n while (sourceNodeStack.length) {\n let parentNode = parentNodeStack.pop();\n const sourceNode = sourceNodeStack.pop();\n if (!sourceNode || !parentNode) {\n continue;\n }\n if (!sourceNode.children) {\n sourceNode.children = [];\n }\n const targetNode = new CPUProfileNode(sourceNode, sampleTime);\n parentNode.children.push(targetNode);\n parentNode = targetNode;\n\n idToUseForRemovedNode.set(sourceNode.id, parentNode.id);\n parentNodeStack.push.apply(parentNodeStack, sourceNode.children.map(() => parentNode));\n sourceNodeStack.push.apply(sourceNodeStack, sourceNode.children.map(id => protocolNodeById.get(id)));\n this.#idToParsedNode.set(sourceNode.id, targetNode);\n }\n if (this.samples) {\n this.samples = this.samples.map(id => idToUseForRemovedNode.get(id) as number);\n }\n return resultRoot;\n }\n\n /**\n * Sorts the samples array using the timestamps array (there is a one\n * to one matching by index between the two).\n */\n private sortSamples(): void {\n if (!this.timestamps || !this.samples) {\n return;\n }\n\n const timestamps = this.timestamps;\n const samples = this.samples;\n const orderedIndices = timestamps.map((_x, index) => index);\n orderedIndices.sort((a, b) => timestamps[a] - timestamps[b]);\n\n this.timestamps = [];\n this.samples = [];\n\n for (let i = 0; i < orderedIndices.length; i++) {\n const orderedIndex = orderedIndices[i];\n this.timestamps.push(timestamps[orderedIndex]);\n this.samples.push(samples[orderedIndex]);\n }\n }\n\n /**\n * Fills in timestamps and/or time deltas from legacy profiles where\n * they could be missing.\n */\n private normalizeTimestamps(): void {\n if (!this.samples) {\n return;\n }\n let timestamps: number[] = this.timestamps;\n if (!timestamps) {\n // Support loading CPU profiles that are missing timestamps and\n // timedeltas\n const profileStartTime = this.profileStartTime;\n const interval = (this.profileEndTime - profileStartTime) / this.samples.length;\n // Add an extra timestamp used to calculate the last sample duration.\n timestamps = new Array(this.samples.length + 1);\n for (let i = 0; i < timestamps.length; ++i) {\n timestamps[i] = profileStartTime + i * interval;\n }\n this.timestamps = timestamps;\n return;\n }\n\n // Convert samples from micro to milliseconds\n for (let i = 0; i < timestamps.length; ++i) {\n timestamps[i] /= 1000;\n }\n if (this.samples.length === timestamps.length) {\n // Add an extra timestamp used to calculate the last sample duration.\n const lastTimestamp = timestamps.at(-1) || 0;\n const averageIntervalTime = (lastTimestamp - timestamps[0]) / (timestamps.length - 1);\n this.timestamps.push(lastTimestamp + averageIntervalTime);\n }\n this.profileStartTime = timestamps.at(0) || this.profileStartTime;\n this.profileEndTime = timestamps.at(-1) || this.profileEndTime;\n }\n\n /**\n * Some nodes do not refer to JS samples but to V8 system tasks, AKA\n * \"meta\" nodes. This function extracts those nodes from the profile.\n */\n private extractMetaNodes(): void {\n const topLevelNodes = this.profileHead.children;\n for (let i = 0; i < topLevelNodes.length && !(this.gcNode && this.programNode && this.idleNode); i++) {\n const node = topLevelNodes[i];\n if (node.functionName === '(garbage collector)') {\n this.gcNode = node;\n } else if (node.functionName === '(program)') {\n this.programNode = node;\n } else if (node.functionName === '(idle)') {\n this.idleNode = node;\n }\n }\n }\n\n private fixMissingSamples(): void {\n // Sometimes the V8 sampler is not able to parse the JS stack and returns\n // a (program) sample instead. The issue leads to call frames being split\n // apart when they shouldn't.\n // Here's a workaround for that. When there's a single (program) sample\n // between two call stacks sharing the same bottom node, it is replaced\n // with the preceding sample.\n const samples = this.samples;\n if (!samples) {\n return;\n }\n const samplesCount = samples.length;\n if (!this.programNode || samplesCount < 3) {\n return;\n }\n const idToNode = this.#idToParsedNode;\n const programNodeId = this.programNode.id;\n const gcNodeId = this.gcNode ? this.gcNode.id : -1;\n const idleNodeId = this.idleNode ? this.idleNode.id : -1;\n let prevNodeId: number = samples[0];\n let nodeId: number = samples[1];\n for (let sampleIndex = 1; sampleIndex < samplesCount - 1; sampleIndex++) {\n const nextNodeId = samples[sampleIndex + 1];\n const prevNode = idToNode.get(prevNodeId);\n const nextNode = idToNode.get(nextNodeId);\n if (prevNodeId === undefined || nextNodeId === undefined || !prevNode || !nextNode) {\n console.error(`Unexpectedly found undefined nodes: ${prevNodeId} ${nextNodeId}`);\n continue;\n }\n if (nodeId === programNodeId && !isSystemNode(prevNodeId) && !isSystemNode(nextNodeId) &&\n bottomNode(prevNode) === bottomNode(nextNode)) {\n samples[sampleIndex] = prevNodeId;\n }\n prevNodeId = nodeId;\n nodeId = nextNodeId;\n }\n function bottomNode(node: ProfileNode): ProfileNode {\n while (node.parent?.parent) {\n node = node.parent;\n }\n return node;\n }\n function isSystemNode(nodeId: number): boolean {\n return nodeId === programNodeId || nodeId === gcNodeId || nodeId === idleNodeId;\n }\n }\n\n /**\n * Traverses the call tree derived from the samples calling back when a call is opened\n * and when it's closed\n */\n forEachFrame(\n openFrameCallback: (depth: number, node: ProfileNode, sampleIndex: number, timestamp: number) => void,\n closeFrameCallback:\n (depth: number, node: ProfileNode, sampleIndex: number, timestamp: number, dur: number,\n selfTime: number) => void,\n startTime?: number, stopTime?: number): void {\n if (!this.profileHead || !this.samples) {\n return;\n }\n\n startTime = startTime || 0;\n stopTime = stopTime || Infinity;\n const samples = this.samples;\n const timestamps = this.timestamps;\n const idToNode = this.#idToParsedNode;\n const gcNode = this.gcNode;\n const samplesCount = samples.length;\n const startIndex =\n Platform.ArrayUtilities.lowerBound(timestamps, startTime, Platform.ArrayUtilities.DEFAULT_COMPARATOR);\n let stackTop = 0;\n const stackNodes: ProfileNode[] = [];\n let prevId: number = this.profileHead.id;\n let sampleTime;\n let gcParentNode: ProfileNode|null = null;\n\n // Extra slots for gc being put on top,\n // and one at the bottom to allow safe stackTop-1 access.\n const stackDepth = this.maxDepth + 3;\n if (!this.#stackStartTimes) {\n this.#stackStartTimes = new Array(stackDepth);\n }\n const stackStartTimes = this.#stackStartTimes;\n if (!this.#stackChildrenDuration) {\n this.#stackChildrenDuration = new Array(stackDepth);\n }\n const stackChildrenDuration = this.#stackChildrenDuration;\n\n let node;\n let sampleIndex;\n for (sampleIndex = startIndex; sampleIndex < samplesCount; sampleIndex++) {\n sampleTime = timestamps[sampleIndex];\n if (sampleTime >= stopTime) {\n break;\n }\n const id = samples[sampleIndex];\n if (id === prevId) {\n continue;\n }\n node = idToNode.get(id);\n let prevNode: ProfileNode|null = idToNode.get(prevId) || null;\n if (!prevNode) {\n continue;\n }\n\n if (gcNode && node === gcNode) {\n // GC samples have no stack, so we just put GC node on top of the last recorded sample.\n gcParentNode = prevNode;\n openFrameCallback(gcParentNode.depth + 1, gcNode, sampleIndex, sampleTime);\n stackStartTimes[++stackTop] = sampleTime;\n stackChildrenDuration[stackTop] = 0;\n prevId = id;\n continue;\n }\n if (gcNode && prevNode === gcNode && gcParentNode) {\n // end of GC frame\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(\n gcParentNode.depth + 1, gcNode, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n prevNode = gcParentNode;\n prevId = prevNode.id;\n gcParentNode = null;\n }\n\n // If the depth of this node is greater than the depth of the\n // previous one, new calls happened in between and we need to open\n // them, so track all of them in stackNodes.\n while (node && node.depth > prevNode.depth) {\n stackNodes.push(node);\n node = node.parent;\n }\n\n // If `prevNode` differs from `node`, the current sample was taken\n // after a change in the call stack, meaning that frames in the\n // path of `prevNode` that differ from those in the path of `node`\n // can be closed. So go down to the lowest common ancestor and\n // close current intervals.\n //\n // For example:\n //\n // prevNode node\n // | |\n // v v\n // [---D--]\n // [---C--][--E--]\n // [------B------] <- LCA\n // [------A------]\n //\n // Because a sample was taken with A, B and E in the stack, it\n // means C and D finished and we can close them.\n while (prevNode && prevNode !== node) {\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(\n prevNode.depth, prevNode, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n // Track calls to open after previous calls were closed\n // In the example above, this would add E to the tracking stack.\n if (node && node.depth === prevNode.depth) {\n stackNodes.push(node);\n node = node.parent;\n }\n prevNode = prevNode.parent;\n }\n\n // Go up the nodes stack and open new intervals.\n while (stackNodes.length) {\n const currentNode = stackNodes.pop();\n if (!currentNode) {\n break;\n }\n node = currentNode;\n openFrameCallback(currentNode.depth, currentNode, sampleIndex, sampleTime);\n stackStartTimes[++stackTop] = sampleTime;\n stackChildrenDuration[stackTop] = 0;\n }\n\n prevId = id;\n }\n\n // Close remaining intervals.\n sampleTime = timestamps[sampleIndex] || this.profileEndTime;\n if (node && gcParentNode && idToNode.get(prevId) === gcNode) {\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(\n gcParentNode.depth + 1, node, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n prevId = gcParentNode.id;\n }\n for (let node = idToNode.get(prevId); node?.parent; node = node.parent) {\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(node.depth, node, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n }\n }\n /**\n * Returns the node that corresponds to a given index of a sample.\n */\n nodeByIndex(index: number): ProfileNode|null {\n return this.samples && this.#idToParsedNode.get(this.samples[index]) || null;\n }\n /**\n * Returns the node that corresponds to a given node id.\n */\n nodeById(nodeId: number): ProfileNode|null {\n return this.#idToParsedNode.get(nodeId) || null;\n }\n\n nodes(): ProfileNode[]|null {\n if (!this.#idToParsedNode) {\n return null;\n }\n return [...this.#idToParsedNode.values()];\n }\n}\n\n// Format used by profiles coming from traces.\nexport type ExtendedProfileNode = Protocol.Profiler.ProfileNode&{parent?: number};\nexport type ExtendedProfile = Protocol.Profiler.Profile&{\n nodes: Protocol.Profiler.ProfileNode[] | ExtendedProfileNode[],\n lines?: number[],\n /**\n * A sample can be manually collected with v8::CpuProfiler::collectSample.\n * When this is done an id (trace id) can be passed to the API to\n * identify the collected sample in the resulting CPU profile. We\n * do this for several trace events, to efficiently calculate their\n * stack trace and improve the JS flamechart we build. This property\n * contains the mapping of the trace ids with the shape traceId -> nodeId\n */\n traceIds?: Record<string, number>,\n};\n"]}
1
+ {"version":3,"file":"CPUProfileDataModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/CPUProfileDataModel.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAEpE,MAAM,OAAO,cAAe,SAAQ,WAAW;IACpC,EAAE,CAAS;IACX,IAAI,CAAS;IACtB,gEAAgE;IAChE,kEAAkE;IAClE,qEAAqE;IACrE,+DAA+D;IAC/D,yBAAyB;IACzB,aAAa,CAAiD;IACrD,WAAW,CAAc;IAElC,YAAY,IAAmC,EAAE,gBAAwB,CAAC,kBAAkB;QAC1F,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAK;YACjB,mEAAmE;YACnE,mBAAmB;YACnB,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC;YAClC,mEAAmE;YAC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,OAAO,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/E,CAAC;IACD;;OAEG;IACH,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IAClD,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["// Copyright 2014 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../core/platform/platform.js';\nimport type * as Protocol from '../../generated/protocol.js';\n\nimport {ProfileNode, ProfileTreeModel} from './ProfileTreeModel.js';\n\nexport class CPUProfileNode extends ProfileNode {\n override id: number;\n override self: number;\n // Position ticks are available in profile nodes coming from CDP\n // profiles and not in those coming from tracing. They are used to\n // calculate the line level execution time shown in the Sources panel\n // after recording a profile. For trace CPU profiles we use the\n // `lines` array instead.\n positionTicks: Protocol.Profiler.PositionTickInfo[]|undefined;\n override deoptReason: string|null;\n\n constructor(node: Protocol.Profiler.ProfileNode, samplingInterval: number /* milliseconds */) {\n const callFrame = node.callFrame || ({\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n functionName: node['functionName'],\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n scriptId: node['scriptId'],\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n url: node['url'],\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n lineNumber: node['lineNumber'] - 1,\n // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration\n // @ts-expect-error\n columnNumber: node['columnNumber'] - 1,\n } as Protocol.Runtime.CallFrame);\n super(callFrame);\n this.id = node.id;\n this.self = (node.hitCount || 0) * samplingInterval;\n this.positionTicks = node.positionTicks;\n // Compatibility: legacy backends could provide \"no reason\" for optimized functions.\n this.deoptReason = node.deoptReason && node.deoptReason !== 'no reason' ? node.deoptReason : null;\n }\n}\n\nexport class CPUProfileDataModel extends ProfileTreeModel {\n profileStartTime: number /* milliseconds */;\n profileEndTime: number /* milliseconds */;\n timestamps: number[];\n samples: number[]|undefined;\n /**\n * Contains trace ids assigned to samples, if any. Trace ids are\n * keyed by the sample index in the profile. These are only created\n * for CPU profiles coming from traces.\n */\n traceIds?: Record<string, number>;\n lines?: number[];\n totalHitCount: number;\n profileHead: CPUProfileNode;\n /**\n * A cache for the nodes we have parsed.\n * Note: \"Parsed\" nodes are different from the \"Protocol\" nodes, the\n * latter being the raw data we receive from the backend.\n */\n #idToParsedNode!: Map<number, ProfileNode>;\n gcNode?: ProfileNode;\n programNode?: ProfileNode;\n idleNode?: ProfileNode;\n #stackStartTimes?: number[];\n #stackChildrenDuration?: number[];\n constructor(profile: ExtendedProfile) {\n super();\n // @ts-expect-error Legacy types\n const isLegacyFormat = Boolean(profile['head']);\n if (isLegacyFormat) {\n // Legacy format contains raw timestamps and start/stop times are in seconds.\n this.profileStartTime = profile.startTime * 1000;\n this.profileEndTime = profile.endTime * 1000;\n // @ts-expect-error Legacy types\n this.timestamps = profile.timestamps;\n this.compatibilityConversionHeadToNodes(profile);\n } else {\n // Current format encodes timestamps as deltas. Start/stop times are in microseconds.\n this.profileStartTime = profile.startTime / 1000;\n this.profileEndTime = profile.endTime / 1000;\n this.timestamps = this.convertTimeDeltas(profile);\n }\n this.traceIds = profile.traceIds;\n this.samples = profile.samples;\n\n // Lines are available only in profiles coming from tracing.\n // Elements in the lines array have a 1 to 1 correspondence with\n // samples, by array position. They can be 1 or 0 and indicate if\n // there is line data for a given sample, i.e. if a given sample\n // needs to be included to calculate the line level execution time\n // data, which we show in the sources panel after recording a\n // profile.\n this.lines = profile.lines;\n this.totalHitCount = 0;\n this.profileHead = this.translateProfileTree(profile.nodes);\n this.initialize(this.profileHead);\n this.extractMetaNodes();\n if (this.samples?.length) {\n this.sortSamples();\n this.normalizeTimestamps();\n this.fixMissingSamples();\n }\n }\n\n private compatibilityConversionHeadToNodes(profile: Protocol.Profiler.Profile): void {\n // @ts-expect-error Legacy types\n if (!profile.head || profile.nodes) {\n return;\n }\n const nodes: Protocol.Profiler.ProfileNode[] = [];\n // @ts-expect-error Legacy types\n convertNodesTree(profile.head);\n profile.nodes = nodes;\n // @ts-expect-error Legacy types\n delete profile.head;\n function convertNodesTree(node: Protocol.Profiler.ProfileNode): number {\n nodes.push(node);\n // @ts-expect-error Legacy types\n node.children = (node.children as Protocol.Profiler.ProfileNode[]).map(convertNodesTree);\n return node.id;\n }\n }\n\n /**\n * Calculate timestamps using timeDeltas. Some CPU profile formats,\n * like the ones contained in traces have timeDeltas instead of\n * timestamps.\n */\n private convertTimeDeltas(profile: Protocol.Profiler.Profile): number[] {\n if (!profile.timeDeltas) {\n return [];\n }\n let lastTimeMicroSec = profile.startTime;\n const timestamps = new Array(profile.timeDeltas.length);\n for (let i = 0; i < profile.timeDeltas.length; ++i) {\n lastTimeMicroSec += profile.timeDeltas[i];\n timestamps[i] = lastTimeMicroSec;\n }\n return timestamps;\n }\n\n /**\n * Creates a Tree of CPUProfileNodes using the Protocol.Profiler.ProfileNodes.\n * As the tree is built, samples of native code (prefixed with \"native \") are\n * filtered out. Samples of filtered nodes are replaced with the parent of the\n * node being filtered.\n *\n * This function supports legacy and new definitions of the CDP Profiler.Profile\n * type.\n */\n private translateProfileTree(nodes: Protocol.Profiler.ProfileNode[]): CPUProfileNode {\n function buildChildrenFromParents(nodes: Protocol.Profiler.ProfileNode[]): void {\n if (nodes[0].children) {\n return;\n }\n nodes[0].children = [];\n for (let i = 1; i < nodes.length; ++i) {\n const node = nodes[i];\n // @ts-expect-error Legacy types\n const parentNode = protocolNodeById.get(node.parent);\n if (!parentNode) {\n continue;\n }\n if (parentNode.children) {\n parentNode.children.push(node.id);\n } else {\n parentNode.children = [node.id];\n }\n }\n }\n\n /**\n * Calculate how many times each node was sampled in the profile, if\n * not available in the profile data.\n */\n function buildHitCountFromSamples(nodes: Protocol.Profiler.ProfileNode[], samples: number[]|undefined): void {\n // If hit count is available, this profile has the new format, so\n // no need to continue.`\n if (typeof (nodes[0].hitCount) === 'number') {\n return;\n }\n if (!samples) {\n throw new Error('Error: Neither hitCount nor samples are present in profile.');\n }\n for (let i = 0; i < nodes.length; ++i) {\n nodes[i].hitCount = 0;\n }\n for (let i = 0; i < samples.length; ++i) {\n const node = protocolNodeById.get(samples[i]);\n if (node?.hitCount === undefined) {\n continue;\n }\n node.hitCount++;\n }\n }\n\n // A cache for the raw nodes received from the traces / CDP.\n const protocolNodeById = new Map<number, Protocol.Profiler.ProfileNode>();\n for (let i = 0; i < nodes.length; ++i) {\n const node = nodes[i];\n protocolNodeById.set(node.id, node);\n }\n\n buildHitCountFromSamples(nodes, this.samples);\n buildChildrenFromParents(nodes);\n this.totalHitCount = nodes.reduce((acc, node) => acc + (node.hitCount || 0), 0);\n const sampleTime = (this.profileEndTime - this.profileStartTime) / this.totalHitCount;\n const root = nodes[0];\n // If a node is filtered out, its samples are replaced with its parent,\n // so we keep track of the which id to use in the samples data.\n const idToUseForRemovedNode = new Map<number, number>([[root.id, root.id]]);\n this.#idToParsedNode = new Map();\n\n const resultRoot = new CPUProfileNode(root, sampleTime);\n this.#idToParsedNode.set(root.id, resultRoot);\n if (!root.children) {\n throw new Error('Missing children for root');\n }\n const parentNodeStack = root.children.map(() => resultRoot);\n const sourceNodeStack = root.children.map(id => protocolNodeById.get(id));\n while (sourceNodeStack.length) {\n let parentNode = parentNodeStack.pop();\n const sourceNode = sourceNodeStack.pop();\n if (!sourceNode || !parentNode) {\n continue;\n }\n if (!sourceNode.children) {\n sourceNode.children = [];\n }\n const targetNode = new CPUProfileNode(sourceNode, sampleTime);\n parentNode.children.push(targetNode);\n parentNode = targetNode;\n\n idToUseForRemovedNode.set(sourceNode.id, parentNode.id);\n parentNodeStack.push.apply(parentNodeStack, sourceNode.children.map(() => parentNode));\n sourceNodeStack.push.apply(sourceNodeStack, sourceNode.children.map(id => protocolNodeById.get(id)));\n this.#idToParsedNode.set(sourceNode.id, targetNode);\n }\n if (this.samples) {\n this.samples = this.samples.map(id => idToUseForRemovedNode.get(id) as number);\n }\n return resultRoot;\n }\n\n /**\n * Sorts the samples array using the timestamps array (there is a one\n * to one matching by index between the two).\n */\n private sortSamples(): void {\n if (!this.timestamps || !this.samples) {\n return;\n }\n\n const timestamps = this.timestamps;\n const samples = this.samples;\n const orderedIndices = timestamps.map((_x, index) => index);\n orderedIndices.sort((a, b) => timestamps[a] - timestamps[b]);\n\n this.timestamps = [];\n this.samples = [];\n\n for (let i = 0; i < orderedIndices.length; i++) {\n const orderedIndex = orderedIndices[i];\n this.timestamps.push(timestamps[orderedIndex]);\n this.samples.push(samples[orderedIndex]);\n }\n }\n\n /**\n * Fills in timestamps and/or time deltas from legacy profiles where\n * they could be missing.\n */\n private normalizeTimestamps(): void {\n if (!this.samples) {\n return;\n }\n let timestamps: number[] = this.timestamps;\n if (!timestamps) {\n // Support loading CPU profiles that are missing timestamps and\n // timedeltas\n const profileStartTime = this.profileStartTime;\n const interval = (this.profileEndTime - profileStartTime) / this.samples.length;\n // Add an extra timestamp used to calculate the last sample duration.\n timestamps = new Array(this.samples.length + 1);\n for (let i = 0; i < timestamps.length; ++i) {\n timestamps[i] = profileStartTime + i * interval;\n }\n this.timestamps = timestamps;\n return;\n }\n\n // Convert samples from micro to milliseconds\n for (let i = 0; i < timestamps.length; ++i) {\n timestamps[i] /= 1000;\n }\n if (this.samples.length === timestamps.length) {\n // Add an extra timestamp used to calculate the last sample duration.\n const lastTimestamp = timestamps.at(-1) || 0;\n const averageIntervalTime = (lastTimestamp - timestamps[0]) / (timestamps.length - 1);\n this.timestamps.push(lastTimestamp + averageIntervalTime);\n }\n this.profileStartTime = timestamps.at(0) || this.profileStartTime;\n this.profileEndTime = timestamps.at(-1) || this.profileEndTime;\n }\n\n /**\n * Some nodes do not refer to JS samples but to V8 system tasks, AKA\n * \"meta\" nodes. This function extracts those nodes from the profile.\n */\n private extractMetaNodes(): void {\n const topLevelNodes = this.profileHead.children;\n for (let i = 0; i < topLevelNodes.length && !(this.gcNode && this.programNode && this.idleNode); i++) {\n const node = topLevelNodes[i];\n if (node.functionName === '(garbage collector)') {\n this.gcNode = node;\n } else if (node.functionName === '(program)') {\n this.programNode = node;\n } else if (node.functionName === '(idle)') {\n this.idleNode = node;\n }\n }\n }\n\n private fixMissingSamples(): void {\n // Sometimes the V8 sampler is not able to parse the JS stack and returns\n // a (program) sample instead. The issue leads to call frames being split\n // apart when they shouldn't.\n // Here's a workaround for that. When there's a single (program) sample\n // between two call stacks sharing the same bottom node, it is replaced\n // with the preceding sample.\n const samples = this.samples;\n if (!samples) {\n return;\n }\n const samplesCount = samples.length;\n if (!this.programNode || samplesCount < 3) {\n return;\n }\n const idToNode = this.#idToParsedNode;\n const programNodeId = this.programNode.id;\n const gcNodeId = this.gcNode ? this.gcNode.id : -1;\n const idleNodeId = this.idleNode ? this.idleNode.id : -1;\n let prevNodeId: number = samples[0];\n let nodeId: number = samples[1];\n for (let sampleIndex = 1; sampleIndex < samplesCount - 1; sampleIndex++) {\n const nextNodeId = samples[sampleIndex + 1];\n const prevNode = idToNode.get(prevNodeId);\n const nextNode = idToNode.get(nextNodeId);\n if (prevNodeId === undefined || nextNodeId === undefined || !prevNode || !nextNode) {\n console.error(`Unexpectedly found undefined nodes: ${prevNodeId} ${nextNodeId}`);\n continue;\n }\n if (nodeId === programNodeId && !isSystemNode(prevNodeId) && !isSystemNode(nextNodeId) &&\n bottomNode(prevNode) === bottomNode(nextNode)) {\n samples[sampleIndex] = prevNodeId;\n }\n prevNodeId = nodeId;\n nodeId = nextNodeId;\n }\n function bottomNode(node: ProfileNode): ProfileNode {\n while (node.parent?.parent) {\n node = node.parent;\n }\n return node;\n }\n function isSystemNode(nodeId: number): boolean {\n return nodeId === programNodeId || nodeId === gcNodeId || nodeId === idleNodeId;\n }\n }\n\n /**\n * Traverses the call tree derived from the samples calling back when a call is opened\n * and when it's closed\n */\n forEachFrame(\n openFrameCallback: (depth: number, node: ProfileNode, sampleIndex: number, timestamp: number) => void,\n closeFrameCallback:\n (depth: number, node: ProfileNode, sampleIndex: number, timestamp: number, dur: number,\n selfTime: number) => void,\n startTime?: number, stopTime?: number): void {\n if (!this.profileHead || !this.samples) {\n return;\n }\n\n startTime = startTime || 0;\n stopTime = stopTime || Infinity;\n const samples = this.samples;\n const timestamps = this.timestamps;\n const idToNode = this.#idToParsedNode;\n const gcNode = this.gcNode;\n const samplesCount = samples.length;\n const startIndex =\n Platform.ArrayUtilities.lowerBound(timestamps, startTime, Platform.ArrayUtilities.DEFAULT_COMPARATOR);\n let stackTop = 0;\n const stackNodes: ProfileNode[] = [];\n let prevId: number = this.profileHead.id;\n let sampleTime;\n let gcParentNode: ProfileNode|null = null;\n\n // Extra slots for gc being put on top,\n // and one at the bottom to allow safe stackTop-1 access.\n const stackDepth = this.maxDepth + 3;\n if (!this.#stackStartTimes) {\n this.#stackStartTimes = new Array(stackDepth);\n }\n const stackStartTimes = this.#stackStartTimes;\n if (!this.#stackChildrenDuration) {\n this.#stackChildrenDuration = new Array(stackDepth);\n }\n const stackChildrenDuration = this.#stackChildrenDuration;\n\n let node;\n let sampleIndex;\n for (sampleIndex = startIndex; sampleIndex < samplesCount; sampleIndex++) {\n sampleTime = timestamps[sampleIndex];\n if (sampleTime >= stopTime) {\n break;\n }\n const id = samples[sampleIndex];\n if (id === prevId) {\n continue;\n }\n node = idToNode.get(id);\n let prevNode: ProfileNode|null = idToNode.get(prevId) || null;\n if (!prevNode) {\n continue;\n }\n\n if (gcNode && node === gcNode) {\n // GC samples have no stack, so we just put GC node on top of the last recorded sample.\n gcParentNode = prevNode;\n openFrameCallback(gcParentNode.depth + 1, gcNode, sampleIndex, sampleTime);\n stackStartTimes[++stackTop] = sampleTime;\n stackChildrenDuration[stackTop] = 0;\n prevId = id;\n continue;\n }\n if (gcNode && prevNode === gcNode && gcParentNode) {\n // end of GC frame\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(\n gcParentNode.depth + 1, gcNode, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n prevNode = gcParentNode;\n prevId = prevNode.id;\n gcParentNode = null;\n }\n\n // If the depth of this node is greater than the depth of the\n // previous one, new calls happened in between and we need to open\n // them, so track all of them in stackNodes.\n while (node && node.depth > prevNode.depth) {\n stackNodes.push(node);\n node = node.parent;\n }\n\n // If `prevNode` differs from `node`, the current sample was taken\n // after a change in the call stack, meaning that frames in the\n // path of `prevNode` that differ from those in the path of `node`\n // can be closed. So go down to the lowest common ancestor and\n // close current intervals.\n //\n // For example:\n //\n // prevNode node\n // | |\n // v v\n // [---D--]\n // [---C--][--E--]\n // [------B------] <- LCA\n // [------A------]\n //\n // Because a sample was taken with A, B and E in the stack, it\n // means C and D finished and we can close them.\n while (prevNode && prevNode !== node) {\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(\n prevNode.depth, prevNode, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n // Track calls to open after previous calls were closed\n // In the example above, this would add E to the tracking stack.\n if (node && node.depth === prevNode.depth) {\n stackNodes.push(node);\n node = node.parent;\n }\n prevNode = prevNode.parent;\n }\n\n // Go up the nodes stack and open new intervals.\n while (stackNodes.length) {\n const currentNode = stackNodes.pop();\n if (!currentNode) {\n break;\n }\n node = currentNode;\n openFrameCallback(currentNode.depth, currentNode, sampleIndex, sampleTime);\n stackStartTimes[++stackTop] = sampleTime;\n stackChildrenDuration[stackTop] = 0;\n }\n\n prevId = id;\n }\n\n // Close remaining intervals.\n sampleTime = timestamps[sampleIndex] || this.profileEndTime;\n if (node && gcParentNode && idToNode.get(prevId) === gcNode) {\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(\n gcParentNode.depth + 1, node, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n prevId = gcParentNode.id;\n }\n for (let node = idToNode.get(prevId); node?.parent; node = node.parent) {\n const start = stackStartTimes[stackTop];\n const duration = sampleTime - start;\n stackChildrenDuration[stackTop - 1] += duration;\n closeFrameCallback(node.depth, node, sampleIndex, start, duration, duration - stackChildrenDuration[stackTop]);\n --stackTop;\n }\n }\n /**\n * Returns the node that corresponds to a given index of a sample.\n */\n nodeByIndex(index: number): ProfileNode|null {\n return this.samples && this.#idToParsedNode.get(this.samples[index]) || null;\n }\n /**\n * Returns the node that corresponds to a given node id.\n */\n nodeById(nodeId: number): ProfileNode|null {\n return this.#idToParsedNode.get(nodeId) || null;\n }\n\n nodes(): ProfileNode[]|null {\n if (!this.#idToParsedNode) {\n return null;\n }\n return [...this.#idToParsedNode.values()];\n }\n}\n\n// Format used by profiles coming from traces.\nexport type ExtendedProfileNode = Protocol.Profiler.ProfileNode&{parent?: number};\nexport type ExtendedProfile = Protocol.Profiler.Profile&{\n nodes: Protocol.Profiler.ProfileNode[] | ExtendedProfileNode[],\n lines?: number[],\n /**\n * A sample can be manually collected with v8::CpuProfiler::collectSample.\n * When this is done an id (trace id) can be passed to the API to\n * identify the collected sample in the resulting CPU profile. We\n * do this for several trace events, to efficiently calculate their\n * stack trace and improve the JS flamechart we build.\n *\n * This property, only present if there's any trace id provided within profileChunks,\n * contains the mapping of the trace ids with the shape traceId -> nodeId.\n */\n traceIds?: Record<string, number>,\n};\n"]}
@@ -22,7 +22,6 @@ export declare class ProfileTreeModel {
22
22
  root: ProfileNode;
23
23
  total: number;
24
24
  maxDepth: number;
25
- constructor();
26
25
  initialize(root: ProfileNode): void;
27
26
  private assignDepthsAndParents;
28
27
  private calculateTotals;
@@ -45,8 +45,6 @@ export class ProfileTreeModel {
45
45
  root;
46
46
  total;
47
47
  maxDepth;
48
- constructor() {
49
- }
50
48
  initialize(root) {
51
49
  this.root = root;
52
50
  this.assignDepthsAndParents();
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileTreeModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/ProfileTreeModel.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAK7B,MAAM,OAAO,WAAW;IACtB,SAAS,CAA6B;IACtC,OAAO,CAAS;IAChB,IAAI,CAAS;IACb,KAAK,CAAS;IACd,EAAE,CAAS;IACX,MAAM,CAAmB;IACzB,QAAQ,CAAgB;IACxB,YAAY,CAAS;IACrB,KAAK,CAAU;IACf,WAAW,CAAe;IAC1B,YAAY,SAAqC;QAC/C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,GAAG,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;QACnH,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAA8B,CAAC;IACtE,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,GAAsC,CAAC;IAC/D,CAAC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KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;gBACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;gBACtB,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;IAEO,eAAe,CAAC,IAAiB;QACvC,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,OAAO,eAAe,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAI,eAAe,CAAC,GAAG,EAAkB,CAAC;YACpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAI,OAAO,CAAC,GAAG,EAAkB,CAAC;YAC5C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;YAClC,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF","sourcesContent":["// Copyright 2016 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Platform from '../../core/platform/platform.js';\nimport type * as Protocol from '../../generated/protocol.js';\n\nexport class ProfileNode {\n callFrame: Protocol.Runtime.CallFrame;\n callUID: string;\n self: number;\n total: number;\n id: number;\n parent: ProfileNode|null;\n children: ProfileNode[];\n functionName: string;\n depth!: number;\n deoptReason!: string|null;\n constructor(callFrame: Protocol.Runtime.CallFrame) {\n this.callFrame = callFrame;\n this.callUID = `${callFrame.functionName}@${callFrame.scriptId}:${callFrame.lineNumber}:${callFrame.columnNumber}`;\n this.self = 0;\n this.total = 0;\n this.id = 0;\n this.functionName = callFrame.functionName;\n this.parent = null;\n this.children = [];\n }\n\n get scriptId(): Protocol.Runtime.ScriptId {\n return String(this.callFrame.scriptId) as Protocol.Runtime.ScriptId;\n }\n\n get url(): Platform.DevToolsPath.UrlString {\n return this.callFrame.url as Platform.DevToolsPath.UrlString;\n }\n\n get lineNumber(): number {\n return this.callFrame.lineNumber;\n }\n\n get columnNumber(): number {\n return this.callFrame.columnNumber;\n }\n\n setFunctionName(name: string|null): void {\n if (name === null) {\n return;\n }\n this.functionName = name;\n }\n}\n\nexport class ProfileTreeModel {\n root!: ProfileNode;\n total!: number;\n maxDepth!: number;\n constructor() {\n }\n\n initialize(root: ProfileNode): void {\n this.root = root;\n this.assignDepthsAndParents();\n this.total = this.calculateTotals(this.root);\n }\n\n private assignDepthsAndParents(): void {\n const root = this.root;\n root.depth = -1;\n root.parent = null;\n this.maxDepth = 0;\n const nodesToTraverse = [root];\n while (nodesToTraverse.length) {\n const parent = (nodesToTraverse.pop() as ProfileNode);\n const depth = parent.depth + 1;\n if (depth > this.maxDepth) {\n this.maxDepth = depth;\n }\n const children = parent.children;\n for (const child of children) {\n child.depth = depth;\n child.parent = parent;\n nodesToTraverse.push(child);\n }\n }\n }\n\n private calculateTotals(root: ProfileNode): number {\n const nodesToTraverse = [root];\n const dfsList = [];\n while (nodesToTraverse.length) {\n const node = (nodesToTraverse.pop() as ProfileNode);\n node.total = node.self;\n dfsList.push(node);\n nodesToTraverse.push(...node.children);\n }\n while (dfsList.length > 1) {\n const node = (dfsList.pop() as ProfileNode);\n if (node.parent) {\n node.parent.total += node.total;\n }\n }\n return root.total;\n }\n}\n"]}
1
+ {"version":3,"file":"ProfileTreeModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/ProfileTreeModel.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAK7B,MAAM,OAAO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AAI,CAAC,IAAI,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAI,OAAO,CAAC,GAAG,EAAkB,CAAC;YAC5C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;YAClC,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF","sourcesContent":["// Copyright 2016 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Platform from '../../core/platform/platform.js';\nimport type * as Protocol from '../../generated/protocol.js';\n\nexport class ProfileNode {\n callFrame: Protocol.Runtime.CallFrame;\n callUID: string;\n self: number;\n total: number;\n id: number;\n parent: ProfileNode|null;\n children: ProfileNode[];\n functionName: string;\n depth!: number;\n deoptReason!: string|null;\n constructor(callFrame: Protocol.Runtime.CallFrame) {\n this.callFrame = callFrame;\n this.callUID = `${callFrame.functionName}@${callFrame.scriptId}:${callFrame.lineNumber}:${callFrame.columnNumber}`;\n this.self = 0;\n this.total = 0;\n this.id = 0;\n this.functionName = callFrame.functionName;\n this.parent = null;\n this.children = [];\n }\n\n get scriptId(): Protocol.Runtime.ScriptId {\n return String(this.callFrame.scriptId) as Protocol.Runtime.ScriptId;\n }\n\n get url(): Platform.DevToolsPath.UrlString {\n return this.callFrame.url as Platform.DevToolsPath.UrlString;\n }\n\n get lineNumber(): number {\n return this.callFrame.lineNumber;\n }\n\n get columnNumber(): number {\n return this.callFrame.columnNumber;\n }\n\n setFunctionName(name: string|null): void {\n if (name === null) {\n return;\n }\n this.functionName = name;\n }\n}\n\nexport class ProfileTreeModel {\n root!: ProfileNode;\n total!: number;\n maxDepth!: number;\n\n initialize(root: ProfileNode): void {\n this.root = root;\n this.assignDepthsAndParents();\n this.total = this.calculateTotals(this.root);\n }\n\n private assignDepthsAndParents(): void {\n const root = this.root;\n root.depth = -1;\n root.parent = null;\n this.maxDepth = 0;\n const nodesToTraverse = [root];\n while (nodesToTraverse.length) {\n const parent = (nodesToTraverse.pop() as ProfileNode);\n const depth = parent.depth + 1;\n if (depth > this.maxDepth) {\n this.maxDepth = depth;\n }\n const children = parent.children;\n for (const child of children) {\n child.depth = depth;\n child.parent = parent;\n nodesToTraverse.push(child);\n }\n }\n }\n\n private calculateTotals(root: ProfileNode): number {\n const nodesToTraverse = [root];\n const dfsList = [];\n while (nodesToTraverse.length) {\n const node = (nodesToTraverse.pop() as ProfileNode);\n node.total = node.self;\n dfsList.push(node);\n nodesToTraverse.push(...node.children);\n }\n while (dfsList.length > 1) {\n const node = (dfsList.pop() as ProfileNode);\n if (node.parent) {\n node.parent.total += node.total;\n }\n }\n return root.total;\n }\n}\n"]}
@@ -239,23 +239,25 @@ function linkInitiators(lanternRequests) {
239
239
  }
240
240
  function createNetworkRequests(trace, parsedTrace, startTime = 0, endTime = Number.POSITIVE_INFINITY) {
241
241
  const workerThreads = findWorkerThreads(trace);
242
- const lanternRequests = [];
242
+ const lanternRequestsNoRedirects = [];
243
243
  for (const request of parsedTrace.NetworkRequests.byTime) {
244
244
  if (request.ts >= startTime && request.ts < endTime) {
245
245
  const lanternRequest = createLanternRequest(parsedTrace, workerThreads, request);
246
246
  if (lanternRequest) {
247
- lanternRequests.push(lanternRequest);
247
+ lanternRequestsNoRedirects.push(lanternRequest);
248
248
  }
249
249
  }
250
250
  }
251
+ const lanternRequests = [];
251
252
  // Trace Engine consolidates all redirects into a single request object, but lantern needs
252
253
  // an entry for each redirected request.
253
- for (const request of [...lanternRequests]) {
254
+ for (const request of [...lanternRequestsNoRedirects]) {
254
255
  if (!request.rawRequest) {
255
256
  continue;
256
257
  }
257
258
  const redirects = request.rawRequest.args.data.redirects;
258
259
  if (!redirects.length) {
260
+ lanternRequests.push(request);
259
261
  continue;
260
262
  }
261
263
  const requestChain = [];
@@ -297,6 +299,7 @@ function createNetworkRequests(trace, parsedTrace, startTime = 0, endTime = Numb
297
299
  lanternRequests.push(redirectedRequest);
298
300
  }
299
301
  requestChain.push(request);
302
+ lanternRequests.push(request);
300
303
  for (let i = 0; i < requestChain.length; i++) {
301
304
  const request = requestChain[i];
302
305
  if (i > 0) {
@@ -314,9 +317,7 @@ function createNetworkRequests(trace, parsedTrace, startTime = 0, endTime = Numb
314
317
  }
315
318
  }
316
319
  linkInitiators(lanternRequests);
317
- // This would already be sorted by rendererStartTime, if not for the redirect unwrapping done
318
- // above.
319
- return lanternRequests.sort((a, b) => a.rendererStartTime - b.rendererStartTime);
320
+ return lanternRequests;
320
321
  }
321
322
  function collectMainThreadEvents(trace, parsedTrace) {
322
323
  const Meta = parsedTrace.Meta;
@@ -1 +1 @@
1
- {"version":3,"file":"LanternComputationData.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/LanternComputationData.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAKhD,SAAS,yBAAyB,CAAC,WAAuC,EAAE,OAAe,EAAE,YAAoB;IAE/G,MAAM,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,iCAAiC,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAA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mBAAmB,EAAE,CAAC;YACnC,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACxC,CAAC;QACD,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,gBAAgB,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;AACxF,CAAC;AAED,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,yBAAyB,GAC1B,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Protocol from '../../generated/protocol.js';\n\nimport * as Handlers from './handlers/handlers.js';\nimport * as Lantern from './lantern/lantern.js';\nimport type * as Types from './types/types.js';\n\ntype NetworkRequest = Lantern.Types.NetworkRequest<Types.Events.SyntheticNetworkRequest>;\n\nfunction createProcessedNavigation(parsedTrace: Handlers.Types.ParsedTrace, frameId: string, navigationId: string):\n Lantern.Types.Simulation.ProcessedNavigation {\n const scoresByNav = parsedTrace.PageLoadMetrics.metricScoresByFrameId.get(frameId);\n if (!scoresByNav) {\n throw new Lantern.Core.LanternError('missing metric scores for frame');\n }\n\n const scores = scoresByNav.get(navigationId);\n if (!scores) {\n throw new Lantern.Core.LanternError('missing metric scores for specified navigation');\n }\n\n const getTimestampOrUndefined =\n (metric: Handlers.ModelHandlers.PageLoadMetrics.MetricName): Types.Timing.Micro|undefined => {\n const metricScore = scores.get(metric);\n if (!metricScore?.event) {\n return;\n }\n return metricScore.event.ts;\n };\n const getTimestamp = (metric: Handlers.ModelHandlers.PageLoadMetrics.MetricName): Types.Timing.Micro => {\n const metricScore = scores.get(metric);\n if (!metricScore?.event) {\n throw new Lantern.Core.LanternError(`missing metric: ${metric}`);\n }\n return metricScore.event.ts;\n };\n return {\n timestamps: {\n firstContentfulPaint: getTimestamp(Handlers.ModelHandlers.PageLoadMetrics.MetricName.FCP),\n largestContentfulPaint: getTimestampOrUndefined(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP),\n },\n };\n}\n\nfunction createParsedUrl(url: URL|string): Lantern.Types.ParsedURL {\n if (typeof url === 'string') {\n url = new URL(url);\n }\n return {\n scheme: url.protocol.split(':')[0],\n // Intentional, DevTools uses different terminology\n host: url.hostname,\n securityOrigin: url.origin,\n };\n}\n\n/**\n * Returns a map of `pid` -> `tid[]`.\n */\nfunction findWorkerThreads(trace: Lantern.Types.Trace): Map<number, number[]> {\n // TODO: WorkersHandler in Trace Engine needs to be updated to also include `pid` (only had `tid`).\n const workerThreads = new Map();\n const workerCreationEvents = ['ServiceWorker thread', 'DedicatedWorker thread'];\n\n for (const event of trace.traceEvents) {\n if (event.name !== 'thread_name' || !event.args.name) {\n continue;\n }\n if (!workerCreationEvents.includes(event.args.name)) {\n continue;\n }\n\n const tids = workerThreads.get(event.pid);\n if (tids) {\n tids.push(event.tid);\n } else {\n workerThreads.set(event.pid, [event.tid]);\n }\n }\n\n return workerThreads;\n}\n\nfunction createLanternRequest(\n parsedTrace: Readonly<Handlers.Types.ParsedTrace>, workerThreads: Map<number, number[]>,\n request: Types.Events.SyntheticNetworkRequest): NetworkRequest|undefined {\n if (request.args.data.hasResponse && request.args.data.connectionId === undefined) {\n throw new Lantern.Core.LanternError('Trace is too old');\n }\n\n let url;\n try {\n url = new URL(request.args.data.url);\n } catch {\n return;\n }\n\n const timing = request.args.data.timing ? {\n // These two timings are not included in the trace.\n workerFetchStart: -1,\n workerRespondWithSettled: -1,\n ...request.args.data.timing,\n } :\n undefined;\n\n const networkRequestTime = timing ? timing.requestTime * 1000 : request.args.data.syntheticData.downloadStart / 1000;\n\n let fromWorker = false;\n const tids = workerThreads.get(request.pid);\n if (tids?.includes(request.tid)) {\n fromWorker = true;\n }\n\n // Trace Engine collects worker thread ids in a different manner than `workerThreads` does.\n // AFAIK these should be equivalent, but in case they are not let's also check this for now.\n if (parsedTrace.Workers.workerIdByThread.has(request.tid)) {\n fromWorker = true;\n }\n\n // `initiator` in the trace does not contain the stack trace for JS-initiated\n // requests. Instead, that is stored in the `stackTrace` property of the SyntheticNetworkRequest.\n // There are some minor differences in the fields, accounted for here.\n // Most importantly, there seems to be fewer frames in the trace than the equivalent\n // events over the CDP. This results in less accuracy in determining the initiator request,\n // which means less edges in the graph, which mean worse results.\n // TODO: Should fix in Chromium.\n const initiator: Lantern.Types.NetworkRequest['initiator'] =\n request.args.data.initiator ?? {type: Protocol.Network.InitiatorType.Other};\n if (request.args.data.stackTrace) {\n const callFrames = request.args.data.stackTrace.map(f => {\n return {\n scriptId: String(f.scriptId) as Protocol.Runtime.ScriptId,\n url: f.url,\n lineNumber: f.lineNumber - 1,\n columnNumber: f.columnNumber - 1,\n functionName: f.functionName,\n };\n });\n initiator.stack = {callFrames};\n // Note: there is no `parent` to set ...\n }\n\n let resourceType = request.args.data.resourceType;\n if (request.args.data.initiator?.fetchType === 'xmlhttprequest') {\n // @ts-expect-error yes XHR is a valid ResourceType. TypeScript const enums are so unhelpful.\n resourceType = 'XHR';\n } else if (request.args.data.initiator?.fetchType === 'fetch') {\n // @ts-expect-error yes Fetch is a valid ResourceType. TypeScript const enums are so unhelpful.\n resourceType = 'Fetch';\n }\n\n // TODO: set decodedBodyLength for data urls in Trace Engine.\n let resourceSize = request.args.data.decodedBodyLength ?? 0;\n if (url.protocol === 'data:' && resourceSize === 0) {\n const commaIndex = url.pathname.indexOf(',');\n if (url.pathname.substring(0, commaIndex).includes(';base64')) {\n resourceSize = atob(url.pathname.substring(commaIndex + 1)).length;\n } else {\n resourceSize = url.pathname.length - commaIndex - 1;\n }\n }\n\n return {\n rawRequest: request,\n requestId: request.args.data.requestId,\n connectionId: request.args.data.connectionId ?? 0,\n connectionReused: request.args.data.connectionReused ?? false,\n url: request.args.data.url,\n protocol: request.args.data.protocol,\n parsedURL: createParsedUrl(url),\n documentURL: request.args.data.requestingFrameUrl,\n rendererStartTime: request.ts / 1000,\n networkRequestTime,\n responseHeadersEndTime: request.args.data.syntheticData.downloadStart / 1000,\n networkEndTime: request.args.data.syntheticData.finishTime / 1000,\n transferSize: request.args.data.encodedDataLength,\n resourceSize,\n fromDiskCache: request.args.data.syntheticData.isDiskCached,\n fromMemoryCache: request.args.data.syntheticData.isMemoryCached,\n isLinkPreload: request.args.data.isLinkPreload,\n finished: request.args.data.finished,\n failed: request.args.data.failed,\n statusCode: request.args.data.statusCode,\n initiator,\n timing,\n resourceType,\n mimeType: request.args.data.mimeType,\n priority: request.args.data.priority,\n frameId: request.args.data.frame,\n fromWorker,\n // Set later.\n redirects: undefined,\n redirectSource: undefined,\n redirectDestination: undefined,\n initiatorRequest: undefined,\n };\n}\n\n/**\n * @param request The request to find the initiator of\n */\nfunction chooseInitiatorRequest(request: NetworkRequest, requestsByURL: Map<string, NetworkRequest[]>): NetworkRequest|\n null {\n if (request.redirectSource) {\n return request.redirectSource;\n }\n\n const initiatorURL = Lantern.Graph.PageDependencyGraph.getNetworkInitiators(request)[0];\n let candidates = requestsByURL.get(initiatorURL) || [];\n // The (valid) initiator must come before the initiated request.\n candidates = candidates.filter(c => {\n return c.responseHeadersEndTime <= request.rendererStartTime && c.finished && !c.failed;\n });\n if (candidates.length > 1) {\n // Disambiguate based on prefetch. Prefetch requests have type 'Other' and cannot\n // initiate requests, so we drop them here.\n const nonPrefetchCandidates =\n candidates.filter(cand => cand.resourceType !== Lantern.Types.NetworkRequestTypes.Other);\n if (nonPrefetchCandidates.length) {\n candidates = nonPrefetchCandidates;\n }\n }\n if (candidates.length > 1) {\n // Disambiguate based on frame. It's likely that the initiator comes from the same frame.\n const sameFrameCandidates = candidates.filter(cand => cand.frameId === request.frameId);\n if (sameFrameCandidates.length) {\n candidates = sameFrameCandidates;\n }\n }\n if (candidates.length > 1 && request.initiator.type === 'parser') {\n // Filter to just Documents when initiator type is parser.\n const documentCandidates =\n candidates.filter(cand => cand.resourceType === Lantern.Types.NetworkRequestTypes.Document);\n if (documentCandidates.length) {\n candidates = documentCandidates;\n }\n }\n if (candidates.length > 1) {\n // If all real loads came from successful preloads (url preloaded and\n // loads came from the cache), filter to link rel=preload request(s).\n const linkPreloadCandidates = candidates.filter(c => c.isLinkPreload);\n if (linkPreloadCandidates.length) {\n const nonPreloadCandidates = candidates.filter(c => !c.isLinkPreload);\n const allPreloaded = nonPreloadCandidates.every(c => c.fromDiskCache || c.fromMemoryCache);\n if (nonPreloadCandidates.length && allPreloaded) {\n candidates = linkPreloadCandidates;\n }\n }\n }\n\n // Only return an initiator if the result is unambiguous.\n return candidates.length === 1 ? candidates[0] : null;\n}\n\nfunction linkInitiators(lanternRequests: NetworkRequest[]): void {\n const requestsByURL = new Map<string, NetworkRequest[]>();\n for (const request of lanternRequests) {\n const requests = requestsByURL.get(request.url) || [];\n requests.push(request);\n requestsByURL.set(request.url, requests);\n }\n\n for (const request of lanternRequests) {\n const initiatorRequest = chooseInitiatorRequest(request, requestsByURL);\n if (initiatorRequest) {\n request.initiatorRequest = initiatorRequest;\n }\n }\n}\n\nfunction createNetworkRequests(\n trace: Lantern.Types.Trace, parsedTrace: Handlers.Types.ParsedTrace, startTime = 0,\n endTime = Number.POSITIVE_INFINITY): NetworkRequest[] {\n const workerThreads = findWorkerThreads(trace);\n\n const lanternRequests: NetworkRequest[] = [];\n for (const request of parsedTrace.NetworkRequests.byTime) {\n if (request.ts >= startTime && request.ts < endTime) {\n const lanternRequest = createLanternRequest(parsedTrace, workerThreads, request);\n if (lanternRequest) {\n lanternRequests.push(lanternRequest);\n }\n }\n }\n\n // Trace Engine consolidates all redirects into a single request object, but lantern needs\n // an entry for each redirected request.\n for (const request of [...lanternRequests]) {\n if (!request.rawRequest) {\n continue;\n }\n\n const redirects = request.rawRequest.args.data.redirects;\n if (!redirects.length) {\n continue;\n }\n\n const requestChain = [];\n for (const redirect of redirects) {\n const redirectedRequest = structuredClone(request);\n\n redirectedRequest.networkRequestTime = redirect.ts / 1000;\n redirectedRequest.rendererStartTime = redirectedRequest.networkRequestTime;\n\n redirectedRequest.networkEndTime = (redirect.ts + redirect.dur) / 1000;\n redirectedRequest.responseHeadersEndTime = redirectedRequest.networkEndTime;\n\n redirectedRequest.timing = {\n requestTime: redirectedRequest.networkRequestTime / 1000,\n receiveHeadersStart: redirectedRequest.responseHeadersEndTime,\n receiveHeadersEnd: redirectedRequest.responseHeadersEndTime,\n proxyStart: -1,\n proxyEnd: -1,\n dnsStart: -1,\n dnsEnd: -1,\n connectStart: -1,\n connectEnd: -1,\n sslStart: -1,\n sslEnd: -1,\n sendStart: -1,\n sendEnd: -1,\n workerStart: -1,\n workerReady: -1,\n workerFetchStart: -1,\n workerRespondWithSettled: -1,\n pushStart: -1,\n pushEnd: -1,\n };\n\n redirectedRequest.url = redirect.url;\n redirectedRequest.parsedURL = createParsedUrl(redirect.url);\n // TODO: Trace Engine is not retaining the actual status code.\n redirectedRequest.statusCode = 302;\n redirectedRequest.resourceType = undefined;\n // TODO: Trace Engine is not retaining transfer size of redirected request.\n redirectedRequest.transferSize = 400;\n requestChain.push(redirectedRequest);\n lanternRequests.push(redirectedRequest);\n }\n requestChain.push(request);\n\n for (let i = 0; i < requestChain.length; i++) {\n const request = requestChain[i];\n if (i > 0) {\n request.redirectSource = requestChain[i - 1];\n request.redirects = requestChain.slice(0, i);\n }\n if (i !== requestChain.length - 1) {\n request.redirectDestination = requestChain[i + 1];\n }\n }\n\n // Apply the `:redirect` requestId convention: only redirects[0].requestId is the actual\n // requestId, all the rest have n occurrences of `:redirect` as a suffix.\n for (let i = 1; i < requestChain.length; i++) {\n requestChain[i].requestId = `${requestChain[i - 1].requestId}:redirect`;\n }\n }\n\n linkInitiators(lanternRequests);\n\n // This would already be sorted by rendererStartTime, if not for the redirect unwrapping done\n // above.\n return lanternRequests.sort((a, b) => a.rendererStartTime - b.rendererStartTime);\n}\n\nfunction collectMainThreadEvents(\n trace: Lantern.Types.Trace, parsedTrace: Handlers.Types.ParsedTrace): Lantern.Types.TraceEvent[] {\n const Meta = parsedTrace.Meta;\n const mainFramePids = Meta.mainFrameNavigations.length ? new Set(Meta.mainFrameNavigations.map(nav => nav.pid)) :\n Meta.topLevelRendererIds;\n\n const rendererPidToTid = new Map();\n for (const pid of mainFramePids) {\n const threads = Meta.threadsInProcess.get(pid) ?? [];\n\n let found = false;\n for (const [tid, thread] of threads) {\n if (thread.args.name === 'CrRendererMain') {\n rendererPidToTid.set(pid, tid);\n found = true;\n break;\n }\n }\n\n if (found) {\n continue;\n }\n\n // `CrRendererMain` can be missing if chrome is launched with the `--single-process` flag.\n // In this case, page tasks will be run in the browser thread.\n for (const [tid, thread] of threads) {\n if (thread.args.name === 'CrBrowserMain') {\n rendererPidToTid.set(pid, tid);\n found = true;\n break;\n }\n }\n }\n\n return trace.traceEvents.filter(e => rendererPidToTid.get(e.pid) === e.tid);\n}\n\nfunction createGraph(\n requests: Lantern.Types.NetworkRequest[], trace: Lantern.Types.Trace, parsedTrace: Handlers.Types.ParsedTrace,\n url?: Lantern.Types.Simulation.URL): Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest> {\n const mainThreadEvents = collectMainThreadEvents(trace, parsedTrace);\n\n // url defines the initial request that the Lantern graph starts at (the root node) and the\n // main document request. These are equal if there are no redirects.\n if (!url) {\n url = {\n requestedUrl: requests[0].url,\n mainDocumentUrl: '',\n };\n\n let request = requests[0];\n while (request.redirectDestination) {\n request = request.redirectDestination;\n }\n url.mainDocumentUrl = request.url;\n }\n\n return Lantern.Graph.PageDependencyGraph.createGraph(mainThreadEvents, requests, url);\n}\n\nexport {\n createGraph,\n createNetworkRequests,\n createProcessedNavigation,\n};\n"]}
1
+ {"version":3,"file":"LanternComputationData.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/LanternComputationData.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAKhD,SAAS,y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,CAChB,QAAwC,EAAE,KAA0B,EAAE,WAAuC,EAC7G,GAAkC;IACpC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAErE,2FAA2F;IAC3F,oEAAoE;IACpE,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG;YACJ,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG;YAC7B,eAAe,EAAE,EAAE;SACpB,CAAC;QAEF,IAAI,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1B,OAAO,OAAO,CAAC,mBAAmB,EAAE,CAAC;YACnC,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACxC,CAAC;QACD,GAAG,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,gBAAgB,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;AACxF,CAAC;AAED,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,yBAAyB,GAC1B,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Protocol from '../../generated/protocol.js';\n\nimport * as Handlers from './handlers/handlers.js';\nimport * as Lantern from './lantern/lantern.js';\nimport type * as Types from './types/types.js';\n\ntype NetworkRequest = Lantern.Types.NetworkRequest<Types.Events.SyntheticNetworkRequest>;\n\nfunction createProcessedNavigation(parsedTrace: Handlers.Types.ParsedTrace, frameId: string, navigationId: string):\n Lantern.Types.Simulation.ProcessedNavigation {\n const scoresByNav = parsedTrace.PageLoadMetrics.metricScoresByFrameId.get(frameId);\n if (!scoresByNav) {\n throw new Lantern.Core.LanternError('missing metric scores for frame');\n }\n\n const scores = scoresByNav.get(navigationId);\n if (!scores) {\n throw new Lantern.Core.LanternError('missing metric scores for specified navigation');\n }\n\n const getTimestampOrUndefined =\n (metric: Handlers.ModelHandlers.PageLoadMetrics.MetricName): Types.Timing.Micro|undefined => {\n const metricScore = scores.get(metric);\n if (!metricScore?.event) {\n return;\n }\n return metricScore.event.ts;\n };\n const getTimestamp = (metric: Handlers.ModelHandlers.PageLoadMetrics.MetricName): Types.Timing.Micro => {\n const metricScore = scores.get(metric);\n if (!metricScore?.event) {\n throw new Lantern.Core.LanternError(`missing metric: ${metric}`);\n }\n return metricScore.event.ts;\n };\n return {\n timestamps: {\n firstContentfulPaint: getTimestamp(Handlers.ModelHandlers.PageLoadMetrics.MetricName.FCP),\n largestContentfulPaint: getTimestampOrUndefined(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP),\n },\n };\n}\n\nfunction createParsedUrl(url: URL|string): Lantern.Types.ParsedURL {\n if (typeof url === 'string') {\n url = new URL(url);\n }\n return {\n scheme: url.protocol.split(':')[0],\n // Intentional, DevTools uses different terminology\n host: url.hostname,\n securityOrigin: url.origin,\n };\n}\n\n/**\n * Returns a map of `pid` -> `tid[]`.\n */\nfunction findWorkerThreads(trace: Lantern.Types.Trace): Map<number, number[]> {\n // TODO: WorkersHandler in Trace Engine needs to be updated to also include `pid` (only had `tid`).\n const workerThreads = new Map();\n const workerCreationEvents = ['ServiceWorker thread', 'DedicatedWorker thread'];\n\n for (const event of trace.traceEvents) {\n if (event.name !== 'thread_name' || !event.args.name) {\n continue;\n }\n if (!workerCreationEvents.includes(event.args.name)) {\n continue;\n }\n\n const tids = workerThreads.get(event.pid);\n if (tids) {\n tids.push(event.tid);\n } else {\n workerThreads.set(event.pid, [event.tid]);\n }\n }\n\n return workerThreads;\n}\n\nfunction createLanternRequest(\n parsedTrace: Readonly<Handlers.Types.ParsedTrace>, workerThreads: Map<number, number[]>,\n request: Types.Events.SyntheticNetworkRequest): NetworkRequest|undefined {\n if (request.args.data.hasResponse && request.args.data.connectionId === undefined) {\n throw new Lantern.Core.LanternError('Trace is too old');\n }\n\n let url;\n try {\n url = new URL(request.args.data.url);\n } catch {\n return;\n }\n\n const timing = request.args.data.timing ? {\n // These two timings are not included in the trace.\n workerFetchStart: -1,\n workerRespondWithSettled: -1,\n ...request.args.data.timing,\n } :\n undefined;\n\n const networkRequestTime = timing ? timing.requestTime * 1000 : request.args.data.syntheticData.downloadStart / 1000;\n\n let fromWorker = false;\n const tids = workerThreads.get(request.pid);\n if (tids?.includes(request.tid)) {\n fromWorker = true;\n }\n\n // Trace Engine collects worker thread ids in a different manner than `workerThreads` does.\n // AFAIK these should be equivalent, but in case they are not let's also check this for now.\n if (parsedTrace.Workers.workerIdByThread.has(request.tid)) {\n fromWorker = true;\n }\n\n // `initiator` in the trace does not contain the stack trace for JS-initiated\n // requests. Instead, that is stored in the `stackTrace` property of the SyntheticNetworkRequest.\n // There are some minor differences in the fields, accounted for here.\n // Most importantly, there seems to be fewer frames in the trace than the equivalent\n // events over the CDP. This results in less accuracy in determining the initiator request,\n // which means less edges in the graph, which mean worse results.\n // TODO: Should fix in Chromium.\n const initiator: Lantern.Types.NetworkRequest['initiator'] =\n request.args.data.initiator ?? {type: Protocol.Network.InitiatorType.Other};\n if (request.args.data.stackTrace) {\n const callFrames = request.args.data.stackTrace.map(f => {\n return {\n scriptId: String(f.scriptId) as Protocol.Runtime.ScriptId,\n url: f.url,\n lineNumber: f.lineNumber - 1,\n columnNumber: f.columnNumber - 1,\n functionName: f.functionName,\n };\n });\n initiator.stack = {callFrames};\n // Note: there is no `parent` to set ...\n }\n\n let resourceType = request.args.data.resourceType;\n if (request.args.data.initiator?.fetchType === 'xmlhttprequest') {\n // @ts-expect-error yes XHR is a valid ResourceType. TypeScript const enums are so unhelpful.\n resourceType = 'XHR';\n } else if (request.args.data.initiator?.fetchType === 'fetch') {\n // @ts-expect-error yes Fetch is a valid ResourceType. TypeScript const enums are so unhelpful.\n resourceType = 'Fetch';\n }\n\n // TODO: set decodedBodyLength for data urls in Trace Engine.\n let resourceSize = request.args.data.decodedBodyLength ?? 0;\n if (url.protocol === 'data:' && resourceSize === 0) {\n const commaIndex = url.pathname.indexOf(',');\n if (url.pathname.substring(0, commaIndex).includes(';base64')) {\n resourceSize = atob(url.pathname.substring(commaIndex + 1)).length;\n } else {\n resourceSize = url.pathname.length - commaIndex - 1;\n }\n }\n\n return {\n rawRequest: request,\n requestId: request.args.data.requestId,\n connectionId: request.args.data.connectionId ?? 0,\n connectionReused: request.args.data.connectionReused ?? false,\n url: request.args.data.url,\n protocol: request.args.data.protocol,\n parsedURL: createParsedUrl(url),\n documentURL: request.args.data.requestingFrameUrl,\n rendererStartTime: request.ts / 1000,\n networkRequestTime,\n responseHeadersEndTime: request.args.data.syntheticData.downloadStart / 1000,\n networkEndTime: request.args.data.syntheticData.finishTime / 1000,\n transferSize: request.args.data.encodedDataLength,\n resourceSize,\n fromDiskCache: request.args.data.syntheticData.isDiskCached,\n fromMemoryCache: request.args.data.syntheticData.isMemoryCached,\n isLinkPreload: request.args.data.isLinkPreload,\n finished: request.args.data.finished,\n failed: request.args.data.failed,\n statusCode: request.args.data.statusCode,\n initiator,\n timing,\n resourceType,\n mimeType: request.args.data.mimeType,\n priority: request.args.data.priority,\n frameId: request.args.data.frame,\n fromWorker,\n // Set later.\n redirects: undefined,\n redirectSource: undefined,\n redirectDestination: undefined,\n initiatorRequest: undefined,\n };\n}\n\n/**\n * @param request The request to find the initiator of\n */\nfunction chooseInitiatorRequest(request: NetworkRequest, requestsByURL: Map<string, NetworkRequest[]>): NetworkRequest|\n null {\n if (request.redirectSource) {\n return request.redirectSource;\n }\n\n const initiatorURL = Lantern.Graph.PageDependencyGraph.getNetworkInitiators(request)[0];\n let candidates = requestsByURL.get(initiatorURL) || [];\n // The (valid) initiator must come before the initiated request.\n candidates = candidates.filter(c => {\n return c.responseHeadersEndTime <= request.rendererStartTime && c.finished && !c.failed;\n });\n if (candidates.length > 1) {\n // Disambiguate based on prefetch. Prefetch requests have type 'Other' and cannot\n // initiate requests, so we drop them here.\n const nonPrefetchCandidates =\n candidates.filter(cand => cand.resourceType !== Lantern.Types.NetworkRequestTypes.Other);\n if (nonPrefetchCandidates.length) {\n candidates = nonPrefetchCandidates;\n }\n }\n if (candidates.length > 1) {\n // Disambiguate based on frame. It's likely that the initiator comes from the same frame.\n const sameFrameCandidates = candidates.filter(cand => cand.frameId === request.frameId);\n if (sameFrameCandidates.length) {\n candidates = sameFrameCandidates;\n }\n }\n if (candidates.length > 1 && request.initiator.type === 'parser') {\n // Filter to just Documents when initiator type is parser.\n const documentCandidates =\n candidates.filter(cand => cand.resourceType === Lantern.Types.NetworkRequestTypes.Document);\n if (documentCandidates.length) {\n candidates = documentCandidates;\n }\n }\n if (candidates.length > 1) {\n // If all real loads came from successful preloads (url preloaded and\n // loads came from the cache), filter to link rel=preload request(s).\n const linkPreloadCandidates = candidates.filter(c => c.isLinkPreload);\n if (linkPreloadCandidates.length) {\n const nonPreloadCandidates = candidates.filter(c => !c.isLinkPreload);\n const allPreloaded = nonPreloadCandidates.every(c => c.fromDiskCache || c.fromMemoryCache);\n if (nonPreloadCandidates.length && allPreloaded) {\n candidates = linkPreloadCandidates;\n }\n }\n }\n\n // Only return an initiator if the result is unambiguous.\n return candidates.length === 1 ? candidates[0] : null;\n}\n\nfunction linkInitiators(lanternRequests: NetworkRequest[]): void {\n const requestsByURL = new Map<string, NetworkRequest[]>();\n for (const request of lanternRequests) {\n const requests = requestsByURL.get(request.url) || [];\n requests.push(request);\n requestsByURL.set(request.url, requests);\n }\n\n for (const request of lanternRequests) {\n const initiatorRequest = chooseInitiatorRequest(request, requestsByURL);\n if (initiatorRequest) {\n request.initiatorRequest = initiatorRequest;\n }\n }\n}\n\nfunction createNetworkRequests(\n trace: Lantern.Types.Trace, parsedTrace: Handlers.Types.ParsedTrace, startTime = 0,\n endTime = Number.POSITIVE_INFINITY): NetworkRequest[] {\n const workerThreads = findWorkerThreads(trace);\n\n const lanternRequestsNoRedirects: NetworkRequest[] = [];\n for (const request of parsedTrace.NetworkRequests.byTime) {\n if (request.ts >= startTime && request.ts < endTime) {\n const lanternRequest = createLanternRequest(parsedTrace, workerThreads, request);\n if (lanternRequest) {\n lanternRequestsNoRedirects.push(lanternRequest);\n }\n }\n }\n\n const lanternRequests: NetworkRequest[] = [];\n\n // Trace Engine consolidates all redirects into a single request object, but lantern needs\n // an entry for each redirected request.\n for (const request of [...lanternRequestsNoRedirects]) {\n if (!request.rawRequest) {\n continue;\n }\n\n const redirects = request.rawRequest.args.data.redirects;\n if (!redirects.length) {\n lanternRequests.push(request);\n continue;\n }\n\n const requestChain = [];\n for (const redirect of redirects) {\n const redirectedRequest = structuredClone(request);\n\n redirectedRequest.networkRequestTime = redirect.ts / 1000;\n redirectedRequest.rendererStartTime = redirectedRequest.networkRequestTime;\n\n redirectedRequest.networkEndTime = (redirect.ts + redirect.dur) / 1000;\n redirectedRequest.responseHeadersEndTime = redirectedRequest.networkEndTime;\n\n redirectedRequest.timing = {\n requestTime: redirectedRequest.networkRequestTime / 1000,\n receiveHeadersStart: redirectedRequest.responseHeadersEndTime,\n receiveHeadersEnd: redirectedRequest.responseHeadersEndTime,\n proxyStart: -1,\n proxyEnd: -1,\n dnsStart: -1,\n dnsEnd: -1,\n connectStart: -1,\n connectEnd: -1,\n sslStart: -1,\n sslEnd: -1,\n sendStart: -1,\n sendEnd: -1,\n workerStart: -1,\n workerReady: -1,\n workerFetchStart: -1,\n workerRespondWithSettled: -1,\n pushStart: -1,\n pushEnd: -1,\n };\n\n redirectedRequest.url = redirect.url;\n redirectedRequest.parsedURL = createParsedUrl(redirect.url);\n // TODO: Trace Engine is not retaining the actual status code.\n redirectedRequest.statusCode = 302;\n redirectedRequest.resourceType = undefined;\n // TODO: Trace Engine is not retaining transfer size of redirected request.\n redirectedRequest.transferSize = 400;\n requestChain.push(redirectedRequest);\n lanternRequests.push(redirectedRequest);\n }\n requestChain.push(request);\n lanternRequests.push(request);\n\n for (let i = 0; i < requestChain.length; i++) {\n const request = requestChain[i];\n if (i > 0) {\n request.redirectSource = requestChain[i - 1];\n request.redirects = requestChain.slice(0, i);\n }\n if (i !== requestChain.length - 1) {\n request.redirectDestination = requestChain[i + 1];\n }\n }\n\n // Apply the `:redirect` requestId convention: only redirects[0].requestId is the actual\n // requestId, all the rest have n occurrences of `:redirect` as a suffix.\n for (let i = 1; i < requestChain.length; i++) {\n requestChain[i].requestId = `${requestChain[i - 1].requestId}:redirect`;\n }\n }\n\n linkInitiators(lanternRequests);\n\n return lanternRequests;\n}\n\nfunction collectMainThreadEvents(\n trace: Lantern.Types.Trace, parsedTrace: Handlers.Types.ParsedTrace): Lantern.Types.TraceEvent[] {\n const Meta = parsedTrace.Meta;\n const mainFramePids = Meta.mainFrameNavigations.length ? new Set(Meta.mainFrameNavigations.map(nav => nav.pid)) :\n Meta.topLevelRendererIds;\n\n const rendererPidToTid = new Map();\n for (const pid of mainFramePids) {\n const threads = Meta.threadsInProcess.get(pid) ?? [];\n\n let found = false;\n for (const [tid, thread] of threads) {\n if (thread.args.name === 'CrRendererMain') {\n rendererPidToTid.set(pid, tid);\n found = true;\n break;\n }\n }\n\n if (found) {\n continue;\n }\n\n // `CrRendererMain` can be missing if chrome is launched with the `--single-process` flag.\n // In this case, page tasks will be run in the browser thread.\n for (const [tid, thread] of threads) {\n if (thread.args.name === 'CrBrowserMain') {\n rendererPidToTid.set(pid, tid);\n found = true;\n break;\n }\n }\n }\n\n return trace.traceEvents.filter(e => rendererPidToTid.get(e.pid) === e.tid);\n}\n\nfunction createGraph(\n requests: Lantern.Types.NetworkRequest[], trace: Lantern.Types.Trace, parsedTrace: Handlers.Types.ParsedTrace,\n url?: Lantern.Types.Simulation.URL): Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest> {\n const mainThreadEvents = collectMainThreadEvents(trace, parsedTrace);\n\n // url defines the initial request that the Lantern graph starts at (the root node) and the\n // main document request. These are equal if there are no redirects.\n if (!url) {\n url = {\n requestedUrl: requests[0].url,\n mainDocumentUrl: '',\n };\n\n let request = requests[0];\n while (request.redirectDestination) {\n request = request.redirectDestination;\n }\n url.mainDocumentUrl = request.url;\n }\n\n return Lantern.Graph.PageDependencyGraph.createGraph(mainThreadEvents, requests, url);\n}\n\nexport {\n createGraph,\n createNetworkRequests,\n createProcessedNavigation,\n};\n"]}