@paulirish/trace_engine 0.0.59 → 0.0.61
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.
- package/.tmp/tsbuildinfo/analyze-trace.d.mts +2 -3
- package/.tmp/tsbuildinfo/analyze-trace.d.mts.map +1 -1
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +1 -1
- package/README.md +28 -1
- package/analyze-trace.mjs +5 -3
- package/core/platform/ArrayUtilities.d.ts +1 -0
- package/core/platform/ArrayUtilities.js +2 -2
- package/core/platform/ArrayUtilities.js.map +1 -1
- package/core/platform/Brand.js +1 -1
- package/core/platform/Brand.js.map +1 -1
- package/core/platform/Constructor.js +1 -1
- package/core/platform/Constructor.js.map +1 -1
- package/core/platform/DOMUtilities.js +1 -1
- package/core/platform/DOMUtilities.js.map +1 -1
- package/core/platform/DateUtilities.js +1 -1
- package/core/platform/DateUtilities.js.map +1 -1
- package/core/platform/DevToolsPath.js +1 -1
- package/core/platform/DevToolsPath.js.map +1 -1
- package/core/platform/KeyboardUtilities.js +1 -1
- package/core/platform/KeyboardUtilities.js.map +1 -1
- package/core/platform/MapUtilities.js +1 -1
- package/core/platform/MapUtilities.js.map +1 -1
- package/core/platform/MimeType.js +1 -1
- package/core/platform/MimeType.js.map +1 -1
- package/core/platform/NumberUtilities.js +1 -1
- package/core/platform/NumberUtilities.js.map +1 -1
- package/core/platform/StringUtilities.d.ts +2 -1
- package/core/platform/StringUtilities.js +34 -32
- package/core/platform/StringUtilities.js.map +1 -1
- package/core/platform/Timing.js +1 -1
- package/core/platform/Timing.js.map +1 -1
- package/core/platform/TypedArrayUtilities.js +1 -1
- package/core/platform/TypedArrayUtilities.js.map +1 -1
- package/core/platform/TypescriptUtilities.js +1 -1
- package/core/platform/TypescriptUtilities.js.map +1 -1
- package/core/platform/UIString.js +1 -1
- package/core/platform/UIString.js.map +1 -1
- package/core/platform/UserVisibleError.js +1 -1
- package/core/platform/UserVisibleError.js.map +1 -1
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/core/platform/platform-tsconfig.json +6 -2
- package/core/platform/platform.js +3 -29
- package/core/platform/platform.js.map +1 -1
- package/generated/protocol.d.ts +188 -15
- package/generated/protocol.js +1 -1
- package/locales/af.json +3 -3
- package/locales/am.json +4 -4
- package/locales/ar.json +14 -14
- package/locales/as.json +3 -3
- package/locales/az.json +4 -4
- package/locales/be.json +3 -3
- package/locales/bg.json +3 -3
- package/locales/bn.json +4 -4
- package/locales/bs.json +4 -4
- package/locales/ca.json +3 -3
- package/locales/cs.json +3 -3
- package/locales/cy.json +4 -4
- package/locales/da.json +3 -3
- package/locales/de.json +3 -3
- package/locales/el.json +3 -3
- package/locales/en-GB.json +3 -3
- package/locales/en-US.json +26 -26
- package/locales/en-XL.json +26 -26
- package/locales/es-419.json +3 -3
- package/locales/es.json +3 -3
- package/locales/et.json +3 -3
- package/locales/eu.json +4 -4
- package/locales/fa.json +5 -5
- package/locales/fi.json +3 -3
- package/locales/fil.json +3 -3
- package/locales/fr-CA.json +4 -4
- package/locales/fr.json +3 -3
- package/locales/gl.json +3 -3
- package/locales/gu.json +3 -3
- package/locales/he.json +26 -26
- package/locales/hi.json +3 -3
- package/locales/hr.json +7 -7
- package/locales/hu.json +3 -3
- package/locales/hy.json +3 -3
- package/locales/id.json +3 -3
- package/locales/is.json +3 -3
- package/locales/it.json +3 -3
- package/locales/ja.json +3 -3
- package/locales/ka.json +4 -4
- package/locales/kk.json +3 -3
- package/locales/km.json +4 -4
- package/locales/kn.json +5 -5
- package/locales/ko.json +4 -4
- package/locales/ky.json +3 -3
- package/locales/lo.json +4 -4
- package/locales/lt.json +3 -3
- package/locales/lv.json +4 -4
- package/locales/mk.json +3 -3
- package/locales/ml.json +5 -5
- package/locales/mn.json +3 -3
- package/locales/mr.json +3 -3
- package/locales/ms.json +3 -3
- package/locales/my.json +6 -6
- package/locales/ne.json +25 -25
- package/locales/nl.json +3 -3
- package/locales/no.json +3 -3
- package/locales/or.json +3 -3
- package/locales/pa.json +3 -3
- package/locales/pl.json +3 -3
- package/locales/pt-PT.json +3 -3
- package/locales/pt.json +3 -3
- package/locales/ro.json +4 -4
- package/locales/ru.json +3 -3
- package/locales/si.json +4 -4
- package/locales/sk.json +3 -3
- package/locales/sl.json +3 -3
- package/locales/sq.json +4 -4
- package/locales/sr-Latn.json +3 -3
- package/locales/sr.json +3 -3
- package/locales/sv.json +3 -3
- package/locales/sw.json +3 -3
- package/locales/ta.json +3 -3
- package/locales/te.json +4 -4
- package/locales/th.json +3 -3
- package/locales/tr.json +3 -3
- package/locales/uk.json +3 -3
- package/locales/ur.json +4 -4
- package/locales/uz.json +3 -3
- package/locales/vi.json +3 -3
- package/locales/zh-HK.json +3 -3
- package/locales/zh-TW.json +4 -4
- package/locales/zh.json +3 -3
- package/locales/zu.json +3 -3
- package/models/cpu_profile/CPUProfileDataModel.d.ts +1 -0
- package/models/cpu_profile/CPUProfileDataModel.js +1 -1
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
- package/models/cpu_profile/ProfileTreeModel.d.ts +1 -1
- package/models/cpu_profile/ProfileTreeModel.js +1 -1
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
- package/models/cpu_profile/cpu_profile-tsconfig.json +6 -2
- package/models/cpu_profile/cpu_profile.js +1 -1
- package/models/cpu_profile/cpu_profile.js.map +1 -1
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/EntityMapper.d.ts +33 -0
- package/models/trace/EntityMapper.js +123 -0
- package/models/trace/EntityMapper.js.map +1 -0
- package/models/trace/EventsSerializer.d.ts +11 -0
- package/models/trace/EventsSerializer.js +82 -0
- package/models/trace/EventsSerializer.js.map +1 -0
- package/models/trace/LanternComputationData.d.ts +3 -3
- package/models/trace/LanternComputationData.js +11 -10
- package/models/trace/LanternComputationData.js.map +1 -1
- package/models/trace/ModelImpl.d.ts +7 -14
- package/models/trace/ModelImpl.js +25 -52
- package/models/trace/ModelImpl.js.map +1 -1
- package/models/trace/Name.d.ts +12 -0
- package/models/trace/Name.js +115 -0
- package/models/trace/Name.js.map +1 -0
- package/models/trace/Processor.d.ts +1 -1
- package/models/trace/Processor.js +42 -61
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/Styles.d.ts +50 -0
- package/models/trace/Styles.js +816 -0
- package/models/trace/Styles.js.map +1 -0
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/extras/FilmStrip.d.ts +1 -1
- package/models/trace/extras/FilmStrip.js +7 -7
- package/models/trace/extras/FilmStrip.js.map +1 -1
- package/models/trace/extras/MainThreadActivity.js +1 -1
- package/models/trace/extras/MainThreadActivity.js.map +1 -1
- package/models/trace/extras/ScriptDuplication.js +1 -1
- package/models/trace/extras/ScriptDuplication.js.map +1 -1
- package/models/trace/extras/StackTraceForEvent.d.ts +2 -2
- package/models/trace/extras/StackTraceForEvent.js +21 -21
- package/models/trace/extras/StackTraceForEvent.js.map +1 -1
- package/models/trace/extras/ThirdParties.d.ts +2 -2
- package/models/trace/extras/ThirdParties.js +17 -17
- package/models/trace/extras/ThirdParties.js.map +1 -1
- package/models/trace/extras/TraceFilter.d.ts +1 -1
- package/models/trace/extras/TraceFilter.js +1 -1
- package/models/trace/extras/TraceFilter.js.map +1 -1
- package/models/trace/extras/TraceTree.d.ts +1 -0
- package/models/trace/extras/TraceTree.js +2 -2
- package/models/trace/extras/TraceTree.js.map +1 -1
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/extras/extras-tsconfig.json +6 -2
- package/models/trace/extras/extras.d.ts +0 -3978
- package/models/trace/extras/extras.js +0 -3978
- package/models/trace/extras/extras.js.map +1 -1
- package/models/trace/handlers/AnimationFramesHandler.js +11 -11
- package/models/trace/handlers/AnimationFramesHandler.js.map +1 -1
- package/models/trace/handlers/AnimationHandler.js +5 -5
- package/models/trace/handlers/AnimationHandler.js.map +1 -1
- package/models/trace/handlers/AsyncJSCallsHandler.d.ts +3 -3
- package/models/trace/handlers/AsyncJSCallsHandler.js +9 -9
- package/models/trace/handlers/AsyncJSCallsHandler.js.map +1 -1
- package/models/trace/handlers/AuctionWorkletsHandler.js +12 -12
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -1
- package/models/trace/handlers/DOMStatsHandler.js +3 -3
- package/models/trace/handlers/DOMStatsHandler.js.map +1 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.d.ts +15 -2
- package/models/trace/handlers/ExtensionTraceDataHandler.js +53 -41
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
- package/models/trace/handlers/FlowsHandler.js +11 -11
- package/models/trace/handlers/FlowsHandler.js.map +1 -1
- package/models/trace/handlers/FramesHandler.d.ts +7 -0
- package/models/trace/handlers/FramesHandler.js +12 -10
- package/models/trace/handlers/FramesHandler.js.map +1 -1
- package/models/trace/handlers/GPUHandler.js +3 -3
- package/models/trace/handlers/GPUHandler.js.map +1 -1
- package/models/trace/handlers/ImagePaintingHandler.js +13 -13
- package/models/trace/handlers/ImagePaintingHandler.js.map +1 -1
- package/models/trace/handlers/InitiatorsHandler.js +32 -41
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -1
- package/models/trace/handlers/InvalidationsHandler.js +63 -44
- package/models/trace/handlers/InvalidationsHandler.js.map +1 -1
- package/models/trace/handlers/LargestImagePaintHandler.js +5 -4
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -1
- package/models/trace/handlers/LargestTextPaintHandler.js +3 -3
- package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -1
- package/models/trace/handlers/LayerTreeHandler.js +11 -11
- package/models/trace/handlers/LayerTreeHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +17 -4
- package/models/trace/handlers/LayoutShiftsHandler.js +41 -38
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/MemoryHandler.js +3 -3
- package/models/trace/handlers/MemoryHandler.js.map +1 -1
- package/models/trace/handlers/MetaHandler.d.ts +16 -0
- package/models/trace/handlers/MetaHandler.js +29 -28
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/ModelHandlers.js +1 -1
- package/models/trace/handlers/ModelHandlers.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +10 -0
- package/models/trace/handlers/NetworkRequestsHandler.js +44 -25
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/PageFramesHandler.js +3 -3
- package/models/trace/handlers/PageFramesHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.js +5 -5
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.d.ts +1 -1
- package/models/trace/handlers/RendererHandler.js +22 -22
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.d.ts +2 -2
- package/models/trace/handlers/SamplesHandler.js +7 -9
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScreenshotsHandler.js +9 -10
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.js +9 -8
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/handlers/SelectorStatsHandler.d.ts +2 -2
- package/models/trace/handlers/SelectorStatsHandler.js +13 -13
- package/models/trace/handlers/SelectorStatsHandler.js.map +1 -1
- package/models/trace/handlers/Threads.d.ts +2 -2
- package/models/trace/handlers/Threads.js +9 -9
- package/models/trace/handlers/Threads.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.d.ts +10 -3
- package/models/trace/handlers/UserInteractionsHandler.js +104 -84
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/handlers/UserTimingsHandler.d.ts +1 -1
- package/models/trace/handlers/UserTimingsHandler.js +16 -17
- package/models/trace/handlers/UserTimingsHandler.js.map +1 -1
- package/models/trace/handlers/WarningsHandler.js +14 -14
- package/models/trace/handlers/WarningsHandler.js.map +1 -1
- package/models/trace/handlers/WorkersHandler.js +7 -7
- package/models/trace/handlers/WorkersHandler.js.map +1 -1
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/handlers/handlers-tsconfig.json +6 -2
- package/models/trace/handlers/handlers.js +1 -1
- package/models/trace/handlers/handlers.js.map +1 -1
- package/models/trace/handlers/helpers.d.ts +3 -2
- package/models/trace/handlers/helpers.js +10 -10
- package/models/trace/handlers/helpers.js.map +1 -1
- package/models/trace/handlers/types.d.ts +25 -2
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/helpers/Extensions.js +8 -8
- package/models/trace/helpers/Extensions.js.map +1 -1
- package/models/trace/helpers/Network.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.js +11 -9
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/SyntheticEvents.js +1 -1
- package/models/trace/helpers/SyntheticEvents.js.map +1 -1
- package/models/trace/helpers/Timing.d.ts +4 -0
- package/models/trace/helpers/Timing.js +6 -4
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/Trace.d.ts +19 -20
- package/models/trace/helpers/Trace.js +148 -60
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/TreeHelpers.js +1 -1
- package/models/trace/helpers/TreeHelpers.js.map +1 -1
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/helpers/helpers-tsconfig.json +6 -2
- package/models/trace/helpers/helpers.js +1 -1
- package/models/trace/helpers/helpers.js.map +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +3 -3
- package/models/trace/insights/CLSCulprits.js +16 -15
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/Cache.d.ts +3 -2
- package/models/trace/insights/Cache.js +10 -6
- package/models/trace/insights/Cache.js.map +1 -1
- package/models/trace/insights/Common.d.ts +8 -1
- package/models/trace/insights/Common.js +16 -1
- package/models/trace/insights/Common.js.map +1 -1
- package/models/trace/insights/DOMSize.d.ts +4 -3
- package/models/trace/insights/DOMSize.js +12 -8
- package/models/trace/insights/DOMSize.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +3 -3
- package/models/trace/insights/DocumentLatency.js +20 -18
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/DuplicatedJavaScript.d.ts +3 -3
- package/models/trace/insights/DuplicatedJavaScript.js +7 -6
- package/models/trace/insights/DuplicatedJavaScript.js.map +1 -1
- package/models/trace/insights/FontDisplay.d.ts +3 -2
- package/models/trace/insights/FontDisplay.js +9 -5
- package/models/trace/insights/FontDisplay.js.map +1 -1
- package/models/trace/insights/ForcedReflow.d.ts +3 -2
- package/models/trace/insights/ForcedReflow.js +8 -4
- package/models/trace/insights/ForcedReflow.js.map +1 -1
- package/models/trace/insights/INPBreakdown.d.ts +4 -4
- package/models/trace/insights/INPBreakdown.js +18 -6
- package/models/trace/insights/INPBreakdown.js.map +1 -1
- package/models/trace/insights/ImageDelivery.d.ts +3 -3
- package/models/trace/insights/ImageDelivery.js +15 -14
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/LCPBreakdown.d.ts +4 -3
- package/models/trace/insights/LCPBreakdown.js +19 -8
- package/models/trace/insights/LCPBreakdown.js.map +1 -1
- package/models/trace/insights/LCPDiscovery.d.ts +3 -3
- package/models/trace/insights/LCPDiscovery.js +8 -7
- package/models/trace/insights/LCPDiscovery.js.map +1 -1
- package/models/trace/insights/LegacyJavaScript.d.ts +2 -2
- package/models/trace/insights/LegacyJavaScript.js +7 -5
- package/models/trace/insights/LegacyJavaScript.js.map +1 -1
- package/models/trace/insights/Models.js +1 -1
- package/models/trace/insights/Models.js.map +1 -1
- package/models/trace/insights/ModernHTTP.d.ts +3 -3
- package/models/trace/insights/ModernHTTP.js +8 -7
- package/models/trace/insights/ModernHTTP.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +7 -4
- package/models/trace/insights/NetworkDependencyTree.js +21 -17
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/RenderBlocking.d.ts +2 -2
- package/models/trace/insights/RenderBlocking.js +13 -12
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/SlowCSSSelector.d.ts +4 -3
- package/models/trace/insights/SlowCSSSelector.js +11 -7
- package/models/trace/insights/SlowCSSSelector.js.map +1 -1
- package/models/trace/insights/Statistics.js +1 -1
- package/models/trace/insights/Statistics.js.map +1 -1
- package/models/trace/insights/ThirdParties.d.ts +2 -1
- package/models/trace/insights/ThirdParties.js +10 -6
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +3 -2
- package/models/trace/insights/Viewport.js +10 -6
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/insights/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/insights/insights-tsconfig.json +6 -2
- package/models/trace/insights/insights.d.ts +2 -0
- package/models/trace/insights/insights.js +3 -1
- package/models/trace/insights/insights.js.map +1 -1
- package/models/trace/insights/types.d.ts +6 -2
- package/models/trace/insights/types.js +2 -1
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/core/LanternError.js +1 -1
- package/models/trace/lantern/core/LanternError.js.map +1 -1
- package/models/trace/lantern/core/NetworkAnalyzer.js +1 -1
- package/models/trace/lantern/core/NetworkAnalyzer.js.map +1 -1
- package/models/trace/lantern/core/core-tsconfig.json +6 -2
- package/models/trace/lantern/core/core.js +1 -1
- package/models/trace/lantern/core/core.js.map +1 -1
- package/models/trace/lantern/core/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/graph/BaseNode.js +1 -1
- package/models/trace/lantern/graph/BaseNode.js.map +1 -1
- package/models/trace/lantern/graph/CPUNode.js +1 -1
- package/models/trace/lantern/graph/CPUNode.js.map +1 -1
- package/models/trace/lantern/graph/NetworkNode.js +1 -1
- package/models/trace/lantern/graph/NetworkNode.js.map +1 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js +1 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js.map +1 -1
- package/models/trace/lantern/graph/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/graph/graph-tsconfig.json +6 -2
- package/models/trace/lantern/graph/graph.js +1 -1
- package/models/trace/lantern/graph/graph.js.map +1 -1
- package/models/trace/lantern/lantern-tsconfig.json +6 -2
- package/models/trace/lantern/lantern.js +1 -1
- package/models/trace/lantern/lantern.js.map +1 -1
- package/models/trace/lantern/metrics/FirstContentfulPaint.js +1 -1
- package/models/trace/lantern/metrics/FirstContentfulPaint.js.map +1 -1
- package/models/trace/lantern/metrics/Interactive.js +1 -1
- package/models/trace/lantern/metrics/Interactive.js.map +1 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js +1 -1
- package/models/trace/lantern/metrics/LargestContentfulPaint.js.map +1 -1
- package/models/trace/lantern/metrics/MaxPotentialFID.js +1 -1
- package/models/trace/lantern/metrics/MaxPotentialFID.js.map +1 -1
- package/models/trace/lantern/metrics/Metric.js +1 -1
- package/models/trace/lantern/metrics/Metric.js.map +1 -1
- package/models/trace/lantern/metrics/SpeedIndex.js +1 -1
- package/models/trace/lantern/metrics/SpeedIndex.js.map +1 -1
- package/models/trace/lantern/metrics/TBTUtils.js +1 -1
- package/models/trace/lantern/metrics/TBTUtils.js.map +1 -1
- package/models/trace/lantern/metrics/TotalBlockingTime.js +1 -1
- package/models/trace/lantern/metrics/TotalBlockingTime.js.map +1 -1
- package/models/trace/lantern/metrics/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/metrics/metrics-tsconfig.json +6 -2
- package/models/trace/lantern/metrics/metrics.js +1 -1
- package/models/trace/lantern/metrics/metrics.js.map +1 -1
- package/models/trace/lantern/simulation/ConnectionPool.js +1 -1
- package/models/trace/lantern/simulation/ConnectionPool.js.map +1 -1
- package/models/trace/lantern/simulation/Constants.js +1 -1
- package/models/trace/lantern/simulation/Constants.js.map +1 -1
- package/models/trace/lantern/simulation/DNSCache.js +1 -1
- package/models/trace/lantern/simulation/DNSCache.js.map +1 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js +1 -1
- package/models/trace/lantern/simulation/SimulationTimingMap.js.map +1 -1
- package/models/trace/lantern/simulation/Simulator.js +1 -1
- package/models/trace/lantern/simulation/Simulator.js.map +1 -1
- package/models/trace/lantern/simulation/TCPConnection.js +1 -1
- package/models/trace/lantern/simulation/TCPConnection.js.map +1 -1
- package/models/trace/lantern/simulation/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/simulation/simulation-tsconfig.json +6 -2
- package/models/trace/lantern/simulation/simulation.js +1 -1
- package/models/trace/lantern/simulation/simulation.js.map +1 -1
- package/models/trace/lantern/types/Lantern.js +1 -1
- package/models/trace/lantern/types/Lantern.js.map +1 -1
- package/models/trace/lantern/types/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/lantern/types/types-tsconfig.json +6 -2
- package/models/trace/lantern/types/types.js +1 -1
- package/models/trace/lantern/types/types.js.map +1 -1
- package/models/trace/trace-tsconfig.json +10 -2
- package/models/trace/trace.d.ts +5 -1
- package/models/trace/trace.js +6 -2
- package/models/trace/trace.js.map +1 -1
- package/models/trace/types/Configuration.d.ts +11 -0
- package/models/trace/types/Configuration.js +1 -1
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/Extensions.d.ts +25 -13
- package/models/trace/types/Extensions.js +6 -3
- package/models/trace/types/Extensions.js.map +1 -1
- package/models/trace/types/File.d.ts +12 -0
- package/models/trace/types/File.js +1 -1
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/Overlays.d.ts +1 -2
- package/models/trace/types/Overlays.js +1 -1
- package/models/trace/types/Overlays.js.map +1 -1
- package/models/trace/types/Timing.d.ts +1 -0
- package/models/trace/types/Timing.js +1 -1
- package/models/trace/types/Timing.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +75 -56
- package/models/trace/types/TraceEvents.js +42 -29
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +6 -2
- package/models/trace/types/types-tsconfig.json +6 -2
- package/models/trace/types/types.js +1 -1
- package/models/trace/types/types.js.map +1 -1
- package/package.json +1 -1
- package/test/test-trace-engine.mjs +4 -4
|
@@ -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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AO,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"]}
|
|
1
|
+
{"version":3,"file":"CPUProfileDataModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/CPUProfileDataModel.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM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AAQ,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\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileTreeModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/ProfileTreeModel.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ProfileTreeModel.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/ProfileTreeModel.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,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,CAAS;IACjB,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,Q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AAI,CAAC,QAAQ,EAAE,CAAC;gBAC1B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACxB,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YACjC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;gBAC7B,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\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: this[];\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"]}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
-
"
|
|
11
|
+
"ES2023",
|
|
12
|
+
"ES2024.Promise",
|
|
13
|
+
"ESNext.Iterator",
|
|
14
|
+
"ESNext.Collection",
|
|
15
|
+
"ESNext.Array",
|
|
12
16
|
"dom",
|
|
13
17
|
"dom.iterable"
|
|
14
18
|
],
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
"skipLibCheck": true,
|
|
25
29
|
"sourceMap": true,
|
|
26
30
|
"strict": true,
|
|
27
|
-
"target": "
|
|
31
|
+
"target": "ES2023",
|
|
28
32
|
"tsBuildInfoFile": "cpu_profile-tsconfig.json.tsbuildinfo",
|
|
29
33
|
"typeRoots": [],
|
|
30
34
|
"useUnknownInCatchVariables": false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors
|
|
1
|
+
// Copyright 2023 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
import * as CPUProfileDataModel from './CPUProfileDataModel.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpu_profile.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/cpu_profile.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"cpu_profile.js","sourceRoot":"","sources":["../../../../../../front_end/models/cpu_profile/cpu_profile.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GACjB,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as CPUProfileDataModel from './CPUProfileDataModel.js';\nimport * as ProfileTreeModel from './ProfileTreeModel.js';\n\nexport {\n CPUProfileDataModel,\n ProfileTreeModel,\n};\n"]}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"forceConsistentCasingInFileNames": true,
|
|
9
9
|
"inlineSources": true,
|
|
10
10
|
"lib": [
|
|
11
|
-
"
|
|
11
|
+
"ES2023",
|
|
12
|
+
"ES2024.Promise",
|
|
13
|
+
"ESNext.Iterator",
|
|
14
|
+
"ESNext.Collection",
|
|
15
|
+
"ESNext.Array",
|
|
12
16
|
"dom",
|
|
13
17
|
"dom.iterable"
|
|
14
18
|
],
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
"skipLibCheck": true,
|
|
25
29
|
"sourceMap": true,
|
|
26
30
|
"strict": true,
|
|
27
|
-
"target": "
|
|
31
|
+
"target": "ES2023",
|
|
28
32
|
"tsBuildInfoFile": "devtools_entrypoint-bundle-typescript-tsconfig.json.tsbuildinfo",
|
|
29
33
|
"typeRoots": [],
|
|
30
34
|
"useUnknownInCatchVariables": false
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type * as Platform from '../../core/platform/platform.js';
|
|
2
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
3
|
+
import * as Handlers from './handlers/handlers.js';
|
|
4
|
+
import type { ParsedTrace } from './ModelImpl.js';
|
|
5
|
+
import type * as Types from './types/types.js';
|
|
6
|
+
export declare class EntityMapper {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(parsedTrace: ParsedTrace);
|
|
9
|
+
/**
|
|
10
|
+
* Returns an entity for a given event if any.
|
|
11
|
+
*/
|
|
12
|
+
entityForEvent(event: Types.Events.Event): Handlers.Helpers.Entity | null;
|
|
13
|
+
/**
|
|
14
|
+
* Returns trace events that correspond with a given entity if any.
|
|
15
|
+
*/
|
|
16
|
+
eventsForEntity(entity: Handlers.Helpers.Entity): Types.Events.Event[];
|
|
17
|
+
firstPartyEntity(): Handlers.Helpers.Entity | null;
|
|
18
|
+
thirdPartyEvents(): Types.Events.Event[];
|
|
19
|
+
mappings(): Handlers.Helpers.EntityMappings;
|
|
20
|
+
/**
|
|
21
|
+
* This updates entity mapping given a callFrame and sourceURL (newly resolved),
|
|
22
|
+
* updating both eventsByEntity and entityByEvent. The call frame provides us the
|
|
23
|
+
* URL and sourcemap source location that events map to. This describes the exact events we
|
|
24
|
+
* want to update. We then update the events with the new sourceURL.
|
|
25
|
+
*
|
|
26
|
+
* compiledURLs -> the actual file's url (e.g. my-big-bundle.min.js)
|
|
27
|
+
* sourceURLs -> the resolved urls (e.g. react.development.js, my-app.ts)
|
|
28
|
+
* @param callFrame
|
|
29
|
+
* @param sourceURL
|
|
30
|
+
*/
|
|
31
|
+
updateSourceMapEntities(callFrame: Protocol.Runtime.CallFrame, sourceURL: string): void;
|
|
32
|
+
updateExtensionEntitiesWithName(executionContextNamesByOrigin: Map<Platform.DevToolsPath.UrlString, string>): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
import * as Handlers from './handlers/handlers.js';
|
|
5
|
+
import * as Helpers from './helpers/helpers.js';
|
|
6
|
+
export class EntityMapper {
|
|
7
|
+
#parsedTrace;
|
|
8
|
+
#entityMappings;
|
|
9
|
+
#firstPartyEntity;
|
|
10
|
+
#thirdPartyEvents = [];
|
|
11
|
+
/**
|
|
12
|
+
* When resolving urls and updating our entity mapping in the
|
|
13
|
+
* SourceMapsResolver, a single call frame can appear multiple times
|
|
14
|
+
* as different cpu profile nodes. To avoid duplicate work on the
|
|
15
|
+
* same CallFrame, we can keep track of them.
|
|
16
|
+
*/
|
|
17
|
+
#resolvedCallFrames = new Set();
|
|
18
|
+
constructor(parsedTrace) {
|
|
19
|
+
this.#parsedTrace = parsedTrace;
|
|
20
|
+
this.#entityMappings = this.#parsedTrace.data.Renderer.entityMappings;
|
|
21
|
+
this.#firstPartyEntity = this.#findFirstPartyEntity();
|
|
22
|
+
this.#thirdPartyEvents = this.#getThirdPartyEvents();
|
|
23
|
+
}
|
|
24
|
+
#findFirstPartyEntity() {
|
|
25
|
+
// As a starting point, we consider the first navigation as the 1P.
|
|
26
|
+
const nav = Array.from(this.#parsedTrace.data.Meta.navigationsByNavigationId.values()).sort((a, b) => a.ts - b.ts)[0];
|
|
27
|
+
const firstPartyUrl = nav?.args.data?.documentLoaderURL ?? this.#parsedTrace.data.Meta.mainFrameURL;
|
|
28
|
+
if (!firstPartyUrl) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return Handlers.Helpers.getEntityForUrl(firstPartyUrl, this.#entityMappings) ?? null;
|
|
32
|
+
}
|
|
33
|
+
#getThirdPartyEvents() {
|
|
34
|
+
const entries = Array.from(this.#entityMappings.eventsByEntity.entries());
|
|
35
|
+
const thirdPartyEvents = entries.flatMap(([entity, events]) => {
|
|
36
|
+
return entity !== this.#firstPartyEntity ? events : [];
|
|
37
|
+
});
|
|
38
|
+
return thirdPartyEvents;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns an entity for a given event if any.
|
|
42
|
+
*/
|
|
43
|
+
entityForEvent(event) {
|
|
44
|
+
return this.#entityMappings.entityByEvent.get(event) ?? null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns trace events that correspond with a given entity if any.
|
|
48
|
+
*/
|
|
49
|
+
eventsForEntity(entity) {
|
|
50
|
+
return this.#entityMappings.eventsByEntity.get(entity) ?? [];
|
|
51
|
+
}
|
|
52
|
+
firstPartyEntity() {
|
|
53
|
+
return this.#firstPartyEntity;
|
|
54
|
+
}
|
|
55
|
+
thirdPartyEvents() {
|
|
56
|
+
return this.#thirdPartyEvents;
|
|
57
|
+
}
|
|
58
|
+
mappings() {
|
|
59
|
+
return this.#entityMappings;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* This updates entity mapping given a callFrame and sourceURL (newly resolved),
|
|
63
|
+
* updating both eventsByEntity and entityByEvent. The call frame provides us the
|
|
64
|
+
* URL and sourcemap source location that events map to. This describes the exact events we
|
|
65
|
+
* want to update. We then update the events with the new sourceURL.
|
|
66
|
+
*
|
|
67
|
+
* compiledURLs -> the actual file's url (e.g. my-big-bundle.min.js)
|
|
68
|
+
* sourceURLs -> the resolved urls (e.g. react.development.js, my-app.ts)
|
|
69
|
+
* @param callFrame
|
|
70
|
+
* @param sourceURL
|
|
71
|
+
*/
|
|
72
|
+
updateSourceMapEntities(callFrame, sourceURL) {
|
|
73
|
+
// Avoid the extra work, if we have already resolved this callFrame.
|
|
74
|
+
if (this.#resolvedCallFrames.has(callFrame)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const compiledURL = callFrame.url;
|
|
78
|
+
const currentEntity = Handlers.Helpers.getEntityForUrl(compiledURL, this.#entityMappings);
|
|
79
|
+
const resolvedEntity = Handlers.Helpers.getEntityForUrl(sourceURL, this.#entityMappings);
|
|
80
|
+
// If the entity changed, then we should update our caches. If we don't have a currentEntity,
|
|
81
|
+
// we can't do much with that. Additionally without our current entity, we don't have a reference to the related
|
|
82
|
+
// events so there are no relationships to be made.
|
|
83
|
+
if ((resolvedEntity === currentEntity) || (!currentEntity || !resolvedEntity)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const currentEntityEvents = (currentEntity && this.#entityMappings.eventsByEntity.get(currentEntity)) ?? [];
|
|
87
|
+
// The events of the entity that match said source location.
|
|
88
|
+
const sourceLocationEvents = [];
|
|
89
|
+
// The events that don't match the source location, but that we should keep mapped to its current entity.
|
|
90
|
+
const unrelatedEvents = [];
|
|
91
|
+
currentEntityEvents?.forEach(e => {
|
|
92
|
+
const cf = Helpers.Trace.getStackTraceTopCallFrameInEventPayload(e);
|
|
93
|
+
const matchesCallFrame = cf && Helpers.Trace.isMatchingCallFrame(cf, callFrame);
|
|
94
|
+
if (matchesCallFrame) {
|
|
95
|
+
sourceLocationEvents.push(e);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
unrelatedEvents.push(e);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
// Update current entity.
|
|
102
|
+
this.#entityMappings.eventsByEntity.set(currentEntity, unrelatedEvents);
|
|
103
|
+
// Map the source location events to the new entity.
|
|
104
|
+
this.#entityMappings.eventsByEntity.set(resolvedEntity, sourceLocationEvents);
|
|
105
|
+
sourceLocationEvents.forEach(e => {
|
|
106
|
+
this.#entityMappings.entityByEvent.set(e, resolvedEntity);
|
|
107
|
+
});
|
|
108
|
+
// Update our CallFrame cache when we've got a resolved entity.
|
|
109
|
+
this.#resolvedCallFrames.add(callFrame);
|
|
110
|
+
}
|
|
111
|
+
// Update entities with proper Chrome Extension names.
|
|
112
|
+
updateExtensionEntitiesWithName(executionContextNamesByOrigin) {
|
|
113
|
+
const entities = Array.from(this.#entityMappings.eventsByEntity.keys());
|
|
114
|
+
for (const [origin, name] of executionContextNamesByOrigin) {
|
|
115
|
+
// In makeUpChromeExtensionEntity, the extension origin is set as the only domain for the entity.
|
|
116
|
+
const entity = entities.find(e => e.domains[0] === origin);
|
|
117
|
+
if (entity) {
|
|
118
|
+
entity.name = entity.company = name;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=EntityMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityMapper.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/EntityMapper.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAK7B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAIhD,MAAM,OAAO,YAAY;IACvB,YAAY,CAAc;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IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;QACxE,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,6BAA6B,EAAE,CAAC;YAC3D,iGAAiG;YACjG,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;YAC3D,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Platform from '../../core/platform/platform.js';\nimport type * as Protocol from '../../generated/protocol.js';\n\nimport * as Handlers from './handlers/handlers.js';\nimport * as Helpers from './helpers/helpers.js';\nimport type {ParsedTrace} from './ModelImpl.js';\nimport type * as Types from './types/types.js';\n\nexport class EntityMapper {\n #parsedTrace: ParsedTrace;\n #entityMappings: Handlers.Helpers.EntityMappings;\n #firstPartyEntity: Handlers.Helpers.Entity|null;\n #thirdPartyEvents: Types.Events.Event[] = [];\n /**\n * When resolving urls and updating our entity mapping in the\n * SourceMapsResolver, a single call frame can appear multiple times\n * as different cpu profile nodes. To avoid duplicate work on the\n * same CallFrame, we can keep track of them.\n */\n #resolvedCallFrames = new Set<Protocol.Runtime.CallFrame>();\n\n constructor(parsedTrace: ParsedTrace) {\n this.#parsedTrace = parsedTrace;\n this.#entityMappings = this.#parsedTrace.data.Renderer.entityMappings;\n this.#firstPartyEntity = this.#findFirstPartyEntity();\n this.#thirdPartyEvents = this.#getThirdPartyEvents();\n }\n\n #findFirstPartyEntity(): Handlers.Helpers.Entity|null {\n // As a starting point, we consider the first navigation as the 1P.\n const nav =\n Array.from(this.#parsedTrace.data.Meta.navigationsByNavigationId.values()).sort((a, b) => a.ts - b.ts)[0];\n const firstPartyUrl = nav?.args.data?.documentLoaderURL ?? this.#parsedTrace.data.Meta.mainFrameURL;\n if (!firstPartyUrl) {\n return null;\n }\n return Handlers.Helpers.getEntityForUrl(firstPartyUrl, this.#entityMappings) ?? null;\n }\n\n #getThirdPartyEvents(): Types.Events.Event[] {\n const entries = Array.from(this.#entityMappings.eventsByEntity.entries());\n const thirdPartyEvents = entries.flatMap(([entity, events]) => {\n return entity !== this.#firstPartyEntity ? events : [];\n });\n return thirdPartyEvents;\n }\n\n /**\n * Returns an entity for a given event if any.\n */\n entityForEvent(event: Types.Events.Event): Handlers.Helpers.Entity|null {\n return this.#entityMappings.entityByEvent.get(event) ?? null;\n }\n\n /**\n * Returns trace events that correspond with a given entity if any.\n */\n eventsForEntity(entity: Handlers.Helpers.Entity): Types.Events.Event[] {\n return this.#entityMappings.eventsByEntity.get(entity) ?? [];\n }\n\n firstPartyEntity(): Handlers.Helpers.Entity|null {\n return this.#firstPartyEntity;\n }\n\n thirdPartyEvents(): Types.Events.Event[] {\n return this.#thirdPartyEvents;\n }\n\n mappings(): Handlers.Helpers.EntityMappings {\n return this.#entityMappings;\n }\n\n /**\n * This updates entity mapping given a callFrame and sourceURL (newly resolved),\n * updating both eventsByEntity and entityByEvent. The call frame provides us the\n * URL and sourcemap source location that events map to. This describes the exact events we\n * want to update. We then update the events with the new sourceURL.\n *\n * compiledURLs -> the actual file's url (e.g. my-big-bundle.min.js)\n * sourceURLs -> the resolved urls (e.g. react.development.js, my-app.ts)\n * @param callFrame\n * @param sourceURL\n */\n updateSourceMapEntities(callFrame: Protocol.Runtime.CallFrame, sourceURL: string): void {\n // Avoid the extra work, if we have already resolved this callFrame.\n if (this.#resolvedCallFrames.has(callFrame)) {\n return;\n }\n\n const compiledURL = callFrame.url;\n const currentEntity = Handlers.Helpers.getEntityForUrl(compiledURL, this.#entityMappings);\n const resolvedEntity = Handlers.Helpers.getEntityForUrl(sourceURL, this.#entityMappings);\n // If the entity changed, then we should update our caches. If we don't have a currentEntity,\n // we can't do much with that. Additionally without our current entity, we don't have a reference to the related\n // events so there are no relationships to be made.\n if ((resolvedEntity === currentEntity) || (!currentEntity || !resolvedEntity)) {\n return;\n }\n const currentEntityEvents = (currentEntity && this.#entityMappings.eventsByEntity.get(currentEntity)) ?? [];\n // The events of the entity that match said source location.\n const sourceLocationEvents: Types.Events.Event[] = [];\n // The events that don't match the source location, but that we should keep mapped to its current entity.\n const unrelatedEvents: Types.Events.Event[] = [];\n currentEntityEvents?.forEach(e => {\n const cf = Helpers.Trace.getStackTraceTopCallFrameInEventPayload(e);\n\n const matchesCallFrame = cf && Helpers.Trace.isMatchingCallFrame(cf, callFrame);\n if (matchesCallFrame) {\n sourceLocationEvents.push(e);\n } else {\n unrelatedEvents.push(e);\n }\n });\n // Update current entity.\n this.#entityMappings.eventsByEntity.set(currentEntity, unrelatedEvents);\n // Map the source location events to the new entity.\n this.#entityMappings.eventsByEntity.set(resolvedEntity, sourceLocationEvents);\n sourceLocationEvents.forEach(e => {\n this.#entityMappings.entityByEvent.set(e, resolvedEntity);\n });\n // Update our CallFrame cache when we've got a resolved entity.\n this.#resolvedCallFrames.add(callFrame);\n }\n\n // Update entities with proper Chrome Extension names.\n updateExtensionEntitiesWithName(executionContextNamesByOrigin: Map<Platform.DevToolsPath.UrlString, string>): void {\n const entities = Array.from(this.#entityMappings.eventsByEntity.keys());\n for (const [origin, name] of executionContextNamesByOrigin) {\n // In makeUpChromeExtensionEntity, the extension origin is set as the only domain for the entity.\n const entity = entities.find(e => e.domains[0] === origin);\n if (entity) {\n entity.name = entity.company = name;\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParsedTrace } from './ModelImpl.js';
|
|
2
|
+
import * as Types from './types/types.js';
|
|
3
|
+
export declare class EventsSerializer {
|
|
4
|
+
#private;
|
|
5
|
+
keyForEvent(event: Types.Events.Event): Types.File.SerializableKey | null;
|
|
6
|
+
eventForKey(key: Types.File.SerializableKey, parsedTrace: ParsedTrace): Types.Events.Event;
|
|
7
|
+
static isProfileCallKey(key: Types.File.SerializableKeyValues): key is Types.File.ProfileCallKeyValues;
|
|
8
|
+
static isLegacyTimelineFrameKey(key: Types.File.SerializableKeyValues): key is Types.File.LegacyTimelineFrameKeyValues;
|
|
9
|
+
static isRawEventKey(key: Types.File.SerializableKeyValues): key is Types.File.RawEventKeyValues;
|
|
10
|
+
static isSyntheticEventKey(key: Types.File.SerializableKeyValues): key is Types.File.SyntheticEventKeyValues;
|
|
11
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Copyright 2024 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
import * as Helpers from './helpers/helpers.js';
|
|
5
|
+
import * as Types from './types/types.js';
|
|
6
|
+
export class EventsSerializer {
|
|
7
|
+
#modifiedProfileCallByKey = new Map();
|
|
8
|
+
keyForEvent(event) {
|
|
9
|
+
if (Types.Events.isProfileCall(event)) {
|
|
10
|
+
return `${Types.File.EventKeyType.PROFILE_CALL}-${event.pid}-${event.tid}-${Types.Events.SampleIndex(event.sampleIndex)}-${event.nodeId}`;
|
|
11
|
+
}
|
|
12
|
+
if (Types.Events.isLegacyTimelineFrame(event)) {
|
|
13
|
+
return `${Types.File.EventKeyType.LEGACY_TIMELINE_FRAME}-${event.index}`;
|
|
14
|
+
}
|
|
15
|
+
const rawEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents();
|
|
16
|
+
const key = Types.Events.isSyntheticBased(event) ?
|
|
17
|
+
`${Types.File.EventKeyType.SYNTHETIC_EVENT}-${rawEvents.indexOf(event.rawSourceEvent)}` :
|
|
18
|
+
`${Types.File.EventKeyType.RAW_EVENT}-${rawEvents.indexOf(event)}`;
|
|
19
|
+
if (key.length < 3) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return key;
|
|
23
|
+
}
|
|
24
|
+
eventForKey(key, parsedTrace) {
|
|
25
|
+
const eventValues = Types.File.traceEventKeyToValues(key);
|
|
26
|
+
if (EventsSerializer.isProfileCallKey(eventValues)) {
|
|
27
|
+
return this.#getModifiedProfileCallByKeyValues(eventValues, parsedTrace);
|
|
28
|
+
}
|
|
29
|
+
if (EventsSerializer.isLegacyTimelineFrameKey(eventValues)) {
|
|
30
|
+
const event = parsedTrace.data.Frames.frames.at(eventValues.rawIndex);
|
|
31
|
+
if (!event) {
|
|
32
|
+
throw new Error(`Unknown trace event. Could not find frame with index ${eventValues.rawIndex}`);
|
|
33
|
+
}
|
|
34
|
+
return event;
|
|
35
|
+
}
|
|
36
|
+
if (EventsSerializer.isSyntheticEventKey(eventValues)) {
|
|
37
|
+
const syntheticEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getSyntheticTraces();
|
|
38
|
+
const syntheticEvent = syntheticEvents.at(eventValues.rawIndex);
|
|
39
|
+
if (!syntheticEvent) {
|
|
40
|
+
throw new Error(`Unknown trace event. Attempted to get a synthetic event from an unknown raw event index: ${eventValues.rawIndex}`);
|
|
41
|
+
}
|
|
42
|
+
return syntheticEvent;
|
|
43
|
+
}
|
|
44
|
+
if (EventsSerializer.isRawEventKey(eventValues)) {
|
|
45
|
+
const rawEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents();
|
|
46
|
+
return rawEvents[eventValues.rawIndex];
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`Unknown trace event. Serializable key values: ${eventValues.join('-')}`);
|
|
49
|
+
}
|
|
50
|
+
static isProfileCallKey(key) {
|
|
51
|
+
return key.type === Types.File.EventKeyType.PROFILE_CALL;
|
|
52
|
+
}
|
|
53
|
+
static isLegacyTimelineFrameKey(key) {
|
|
54
|
+
return key.type === Types.File.EventKeyType.LEGACY_TIMELINE_FRAME;
|
|
55
|
+
}
|
|
56
|
+
static isRawEventKey(key) {
|
|
57
|
+
return key.type === Types.File.EventKeyType.RAW_EVENT;
|
|
58
|
+
}
|
|
59
|
+
static isSyntheticEventKey(key) {
|
|
60
|
+
return key.type === Types.File.EventKeyType.SYNTHETIC_EVENT;
|
|
61
|
+
}
|
|
62
|
+
#getModifiedProfileCallByKeyValues(key, parsedTrace) {
|
|
63
|
+
const cacheResult = this.#modifiedProfileCallByKey.get(key);
|
|
64
|
+
if (cacheResult) {
|
|
65
|
+
return cacheResult;
|
|
66
|
+
}
|
|
67
|
+
const profileCallsInThread = parsedTrace.data.Renderer.processes.get(key.processID)?.threads.get(key.threadID)?.profileCalls;
|
|
68
|
+
if (!profileCallsInThread) {
|
|
69
|
+
throw new Error(`Unknown profile call serializable key: ${(key)}`);
|
|
70
|
+
}
|
|
71
|
+
const match = profileCallsInThread?.find((e) => {
|
|
72
|
+
return e.sampleIndex === key.sampleIndex && e.nodeId === key.protocol;
|
|
73
|
+
});
|
|
74
|
+
if (!match) {
|
|
75
|
+
throw new Error(`Unknown profile call serializable key: ${(JSON.stringify(key))}`);
|
|
76
|
+
}
|
|
77
|
+
// Cache to avoid looking up in subsequent calls.
|
|
78
|
+
this.#modifiedProfileCallByKey.set(key, match);
|
|
79
|
+
return match;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=EventsSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventsSerializer.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/EventsSerializer.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE1C,MAAM,OAAO,gBAAgB;IAC3B,yBAAyB,GAAG,IAAI,GAAG,EAAsE,CAAC;IAE1G,WAAW,CAAC,KAAyB;QACnC,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,K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CAAC,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,iDAAiD;QACjD,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["// Copyright 2024 The Chromium Authors\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Helpers from './helpers/helpers.js';\nimport type {ParsedTrace} from './ModelImpl.js';\nimport * as Types from './types/types.js';\n\nexport class EventsSerializer {\n #modifiedProfileCallByKey = new Map<Types.File.ProfileCallKeyValues, Types.Events.SyntheticProfileCall>();\n\n keyForEvent(event: Types.Events.Event): Types.File.SerializableKey|null {\n if (Types.Events.isProfileCall(event)) {\n return `${Types.File.EventKeyType.PROFILE_CALL}-${event.pid}-${event.tid}-${\n Types.Events.SampleIndex(event.sampleIndex)}-${event.nodeId}`;\n }\n\n if (Types.Events.isLegacyTimelineFrame(event)) {\n return `${Types.File.EventKeyType.LEGACY_TIMELINE_FRAME}-${event.index}`;\n }\n\n const rawEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents();\n const key: Types.File.SyntheticEventKey|Types.File.RawEventKey = Types.Events.isSyntheticBased(event) ?\n `${Types.File.EventKeyType.SYNTHETIC_EVENT}-${rawEvents.indexOf(event.rawSourceEvent)}` :\n `${Types.File.EventKeyType.RAW_EVENT}-${rawEvents.indexOf(event)}`;\n if (key.length < 3) {\n return null;\n }\n return key;\n }\n\n eventForKey(key: Types.File.SerializableKey, parsedTrace: ParsedTrace): Types.Events.Event {\n const eventValues = Types.File.traceEventKeyToValues(key);\n\n if (EventsSerializer.isProfileCallKey(eventValues)) {\n return this.#getModifiedProfileCallByKeyValues(eventValues, parsedTrace);\n }\n\n if (EventsSerializer.isLegacyTimelineFrameKey(eventValues)) {\n const event = parsedTrace.data.Frames.frames.at(eventValues.rawIndex);\n if (!event) {\n throw new Error(`Unknown trace event. Could not find frame with index ${eventValues.rawIndex}`);\n }\n return event;\n }\n\n if (EventsSerializer.isSyntheticEventKey(eventValues)) {\n const syntheticEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getSyntheticTraces();\n const syntheticEvent = syntheticEvents.at(eventValues.rawIndex);\n if (!syntheticEvent) {\n throw new Error(`Unknown trace event. Attempted to get a synthetic event from an unknown raw event index: ${\n eventValues.rawIndex}`);\n }\n return syntheticEvent;\n }\n\n if (EventsSerializer.isRawEventKey(eventValues)) {\n const rawEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents();\n return rawEvents[eventValues.rawIndex];\n }\n throw new Error(`Unknown trace event. Serializable key values: ${(eventValues as unknown[]).join('-')}`);\n }\n\n static isProfileCallKey(key: Types.File.SerializableKeyValues): key is Types.File.ProfileCallKeyValues {\n return key.type === Types.File.EventKeyType.PROFILE_CALL;\n }\n static isLegacyTimelineFrameKey(key: Types.File.SerializableKeyValues):\n key is Types.File.LegacyTimelineFrameKeyValues {\n return key.type === Types.File.EventKeyType.LEGACY_TIMELINE_FRAME;\n }\n\n static isRawEventKey(key: Types.File.SerializableKeyValues): key is Types.File.RawEventKeyValues {\n return key.type === Types.File.EventKeyType.RAW_EVENT;\n }\n static isSyntheticEventKey(key: Types.File.SerializableKeyValues): key is Types.File.SyntheticEventKeyValues {\n return key.type === Types.File.EventKeyType.SYNTHETIC_EVENT;\n }\n\n #getModifiedProfileCallByKeyValues(key: Types.File.ProfileCallKeyValues, parsedTrace: ParsedTrace):\n Types.Events.SyntheticProfileCall {\n const cacheResult = this.#modifiedProfileCallByKey.get(key);\n if (cacheResult) {\n return cacheResult;\n }\n const profileCallsInThread =\n parsedTrace.data.Renderer.processes.get(key.processID)?.threads.get(key.threadID)?.profileCalls;\n if (!profileCallsInThread) {\n throw new Error(`Unknown profile call serializable key: ${(key)}`);\n }\n\n const match = profileCallsInThread?.find((e: Types.Events.SyntheticProfileCall) => {\n return e.sampleIndex === key.sampleIndex && e.nodeId === key.protocol;\n });\n if (!match) {\n throw new Error(`Unknown profile call serializable key: ${(JSON.stringify(key))}`);\n }\n // Cache to avoid looking up in subsequent calls.\n this.#modifiedProfileCallByKey.set(key, match);\n return match;\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import * as Handlers from './handlers/handlers.js';
|
|
|
2
2
|
import * as Lantern from './lantern/lantern.js';
|
|
3
3
|
import type * as Types from './types/types.js';
|
|
4
4
|
type NetworkRequest = Lantern.Types.NetworkRequest<Types.Events.SyntheticNetworkRequest>;
|
|
5
|
-
declare function createProcessedNavigation(
|
|
6
|
-
declare function createNetworkRequests(trace: Lantern.Types.Trace,
|
|
7
|
-
declare function createGraph(requests: Lantern.Types.NetworkRequest[], trace: Lantern.Types.Trace,
|
|
5
|
+
declare function createProcessedNavigation(data: Handlers.Types.HandlerData, frameId: string, navigationId: string): Lantern.Types.Simulation.ProcessedNavigation;
|
|
6
|
+
declare function createNetworkRequests(trace: Lantern.Types.Trace, data: Handlers.Types.HandlerData, startTime?: number, endTime?: number): NetworkRequest[];
|
|
7
|
+
declare function createGraph(requests: Lantern.Types.NetworkRequest[], trace: Lantern.Types.Trace, data: Handlers.Types.HandlerData, url?: Lantern.Types.Simulation.URL): Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest>;
|
|
8
8
|
export { createGraph, createNetworkRequests, createProcessedNavigation, };
|