@paulirish/trace_engine 0.0.41 → 0.0.42
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/tsconfig.tsbuildinfo +1 -1
- package/generated/protocol.d.ts +79 -3
- package/locales/en-US.json +222 -0
- package/locales/en-XL.json +222 -0
- package/models/cpu_profile/CPUProfileDataModel.d.ts +7 -0
- package/models/cpu_profile/CPUProfileDataModel.js +7 -0
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
- package/models/cpu_profile/ProfileTreeModel.d.ts +1 -1
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
- package/models/trace/LanternComputationData.d.ts +1 -1
- package/models/trace/LanternComputationData.js +7 -5
- package/models/trace/LanternComputationData.js.map +1 -1
- package/models/trace/Processor.d.ts +2 -16
- package/models/trace/Processor.js +6 -4
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/extras/FilmStrip.d.ts +5 -5
- package/models/trace/extras/FilmStrip.js +2 -1
- package/models/trace/extras/FilmStrip.js.map +1 -1
- package/models/trace/extras/MainThreadActivity.d.ts +1 -1
- package/models/trace/extras/MainThreadActivity.js +3 -3
- package/models/trace/extras/MainThreadActivity.js.map +1 -1
- package/models/trace/extras/ThirdParties.d.ts +14 -13
- package/models/trace/extras/ThirdParties.js +51 -61
- package/models/trace/extras/ThirdParties.js.map +1 -1
- package/models/trace/extras/TimelineJSProfile.d.ts +1 -1
- package/models/trace/extras/TimelineJSProfile.js +9 -4
- package/models/trace/extras/TimelineJSProfile.js.map +1 -1
- package/models/trace/extras/TraceTree.d.ts +6 -6
- package/models/trace/extras/TraceTree.js +4 -1
- package/models/trace/extras/TraceTree.js.map +1 -1
- package/models/trace/handlers/AnimationFramesHandler.js +1 -1
- package/models/trace/handlers/AnimationFramesHandler.js.map +1 -1
- package/models/trace/handlers/ExtensionTraceDataHandler.js +8 -2
- package/models/trace/handlers/ExtensionTraceDataHandler.js.map +1 -1
- package/models/trace/handlers/FlowsHandler.js.map +1 -1
- package/models/trace/handlers/FramesHandler.d.ts +12 -12
- package/models/trace/handlers/FramesHandler.js +3 -3
- package/models/trace/handlers/FramesHandler.js.map +1 -1
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +2 -2
- package/models/trace/handlers/LayoutShiftsHandler.js +25 -16
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -1
- package/models/trace/handlers/MetaHandler.d.ts +2 -2
- package/models/trace/handlers/MetaHandler.js +18 -18
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.js +37 -38
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/PageLoadMetricsHandler.d.ts +6 -6
- package/models/trace/handlers/PageLoadMetricsHandler.js +9 -9
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -1
- package/models/trace/handlers/RendererHandler.js +3 -3
- package/models/trace/handlers/RendererHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.d.ts +1 -1
- package/models/trace/handlers/SamplesHandler.js +50 -42
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScreenshotsHandler.d.ts +6 -3
- package/models/trace/handlers/ScreenshotsHandler.js +21 -7
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -1
- package/models/trace/handlers/ServerTimingsHandler.js +4 -4
- package/models/trace/handlers/ServerTimingsHandler.js.map +1 -1
- package/models/trace/handlers/Threads.js +3 -4
- package/models/trace/handlers/Threads.js.map +1 -1
- package/models/trace/handlers/UserInteractionsHandler.d.ts +2 -2
- package/models/trace/handlers/UserInteractionsHandler.js +12 -12
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -1
- package/models/trace/handlers/WarningsHandler.d.ts +2 -2
- package/models/trace/handlers/WarningsHandler.js +2 -2
- package/models/trace/handlers/WarningsHandler.js.map +1 -1
- package/models/trace/handlers/helpers.d.ts +3 -3
- package/models/trace/handlers/helpers.js +16 -19
- package/models/trace/handlers/helpers.js.map +1 -1
- package/models/trace/handlers/types.d.ts +1 -1
- package/models/trace/handlers/types.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.js +52 -13
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/Timing.d.ts +23 -23
- package/models/trace/helpers/Timing.js +11 -11
- package/models/trace/helpers/Timing.js.map +1 -1
- package/models/trace/helpers/Trace.d.ts +14 -13
- package/models/trace/helpers/Trace.js +10 -4
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/helpers/TreeHelpers.d.ts +2 -2
- package/models/trace/helpers/TreeHelpers.js +4 -4
- package/models/trace/helpers/TreeHelpers.js.map +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +44 -1
- package/models/trace/insights/CLSCulprits.js +44 -2
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/Common.d.ts +11 -7
- package/models/trace/insights/Common.js +85 -26
- package/models/trace/insights/Common.js.map +1 -1
- package/models/trace/insights/DOMSize.d.ts +26 -1
- package/models/trace/insights/DOMSize.js +44 -7
- package/models/trace/insights/DOMSize.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +50 -3
- package/models/trace/insights/DocumentLatency.js +51 -4
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/FontDisplay.d.ts +8 -2
- package/models/trace/insights/FontDisplay.js +10 -4
- package/models/trace/insights/FontDisplay.js.map +1 -1
- package/models/trace/insights/ForcedReflow.d.ts +30 -0
- package/models/trace/insights/ForcedReflow.js +181 -0
- package/models/trace/insights/ForcedReflow.js.map +1 -0
- package/models/trace/insights/ImageDelivery.d.ts +15 -1
- package/models/trace/insights/ImageDelivery.js +21 -1
- package/models/trace/insights/ImageDelivery.js.map +1 -1
- package/models/trace/insights/InteractionToNextPaint.d.ts +26 -1
- package/models/trace/insights/InteractionToNextPaint.js +27 -1
- package/models/trace/insights/InteractionToNextPaint.js.map +1 -1
- package/models/trace/insights/LCPDiscovery.d.ts +38 -2
- package/models/trace/insights/LCPDiscovery.js +38 -2
- package/models/trace/insights/LCPDiscovery.js.map +1 -1
- package/models/trace/insights/LCPPhases.d.ts +36 -7
- package/models/trace/insights/LCPPhases.js +37 -8
- package/models/trace/insights/LCPPhases.js.map +1 -1
- package/models/trace/insights/LongCriticalNetworkTree.d.ts +22 -0
- package/models/trace/insights/LongCriticalNetworkTree.js +40 -0
- package/models/trace/insights/LongCriticalNetworkTree.js.map +1 -0
- package/models/trace/insights/Models.d.ts +2 -0
- package/models/trace/insights/Models.js +2 -0
- package/models/trace/insights/Models.js.map +1 -1
- package/models/trace/insights/RenderBlocking.d.ts +14 -1
- package/models/trace/insights/RenderBlocking.js +14 -1
- package/models/trace/insights/RenderBlocking.js.map +1 -1
- package/models/trace/insights/SlowCSSSelector.d.ts +27 -2
- package/models/trace/insights/SlowCSSSelector.js +27 -2
- package/models/trace/insights/SlowCSSSelector.js.map +1 -1
- package/models/trace/insights/ThirdParties.d.ts +13 -4
- package/models/trace/insights/ThirdParties.js +21 -12
- package/models/trace/insights/ThirdParties.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +2 -1
- package/models/trace/insights/Viewport.js +2 -1
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/insights/insights-tsconfig.json +2 -0
- package/models/trace/insights/types.d.ts +23 -8
- package/models/trace/insights/types.js.map +1 -1
- package/models/trace/lantern/graph/CPUNode.d.ts +1 -1
- package/models/trace/lantern/graph/CPUNode.js.map +1 -1
- package/models/trace/lantern/graph/NetworkNode.d.ts +1 -1
- package/models/trace/lantern/graph/NetworkNode.js.map +1 -1
- package/models/trace/types/Configuration.d.ts +15 -0
- package/models/trace/types/Configuration.js.map +1 -1
- package/models/trace/types/File.d.ts +4 -4
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/Timing.d.ts +7 -13
- package/models/trace/types/Timing.js +5 -2
- package/models/trace/types/Timing.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +143 -108
- package/models/trace/types/TraceEvents.js +9 -7
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/package.json +1 -1
- package/test/test-trace-engine.mjs +18 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Viewport.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,eAAe,EAGf,cAAc,
|
|
1
|
+
{"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/Viewport.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,eAAe,EAGf,cAAc,GAGf,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,8GAA8G;IAC9G,KAAK,EAAE,8BAA8B;IACrC;;OAEG;IACH,WAAW,EACP,iKAAiK;CACtK,CAAC;AAEF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,mCAAmC,EAAE,SAAS,CAAC,CAAC;AACzF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE7E,MAAM,UAAU,IAAI;IAClB,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AACtC,CAAC;AAOD,SAAS,QAAQ,CAAC,YAAuD;IACvE,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,UAAU,CAAC,SAAS,CAA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C,OAAO,QAAQ,CAAC;gBACd,eAAe,EAAE,KAAK;gBACtB,aAAa;gBACb,aAAa,EAAE,EAAC,GAAG,EAAE,GAAyB,EAAC;aAChD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;QACd,eAAe,EAAE,IAAI;QACrB,aAAa;KACd,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as i18n from '../../../core/i18n/i18n.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport type * as Types from '../types/types.js';\n\nimport {\n InsightCategory,\n type InsightModel,\n type InsightSetContext,\n InsightWarning,\n type PartialInsightModel,\n type RequiredData,\n} from './types.js';\n\nexport const UIStrings = {\n /** Title of an insight that provides details about if the page's viewport is optimized for mobile viewing. */\n title: 'Optimize viewport for mobile',\n /**\n * @description Text to tell the user how a viewport meta element can improve performance. \\xa0 is a non-breaking space\n */\n description:\n 'Tap interactions may be [delayed by up to 300\\xA0ms](https://developer.chrome.com/blog/300ms-tap-delay-gone-away/) if the viewport is not optimized for mobile.',\n};\n\nconst str_ = i18n.i18n.registerUIStrings('models/trace/insights/Viewport.ts', UIStrings);\nexport const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);\n\nexport function deps(): ['Meta', 'UserInteractions'] {\n return ['Meta', 'UserInteractions'];\n}\n\nexport type ViewportInsightModel = InsightModel<typeof UIStrings, {\n mobileOptimized: boolean | null,\n viewportEvent?: Types.Events.ParseMetaViewport,\n}>;\n\nfunction finalize(partialModel: PartialInsightModel<ViewportInsightModel>): ViewportInsightModel {\n return {\n strings: UIStrings,\n title: i18nString(UIStrings.title),\n description: i18nString(UIStrings.description),\n category: InsightCategory.INP,\n shouldShow: partialModel.mobileOptimized === false,\n ...partialModel,\n };\n}\n\nexport function generateInsight(\n parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): ViewportInsightModel {\n const compositorEvents = parsedTrace.UserInteractions.beginCommitCompositorFrameEvents.filter(event => {\n if (event.args.frame !== context.frameId) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n if (!compositorEvents.length) {\n // Trace doesn't have the data we need.\n return finalize({\n mobileOptimized: null,\n warnings: [InsightWarning.NO_LAYOUT],\n });\n }\n\n const viewportEvent = parsedTrace.UserInteractions.parseMetaViewportEvents.find(event => {\n if (event.args.data.frame !== context.frameId) {\n return false;\n }\n\n return Helpers.Timing.eventIsInBounds(event, context.bounds);\n });\n\n // Returns true only if all events are mobile optimized.\n for (const event of compositorEvents) {\n if (!event.args.is_mobile_optimized) {\n return finalize({\n mobileOptimized: false,\n viewportEvent,\n metricSavings: {INP: 300 as Types.Timing.Milli},\n });\n }\n }\n\n return finalize({\n mobileOptimized: true,\n viewportEvent,\n });\n}\n"]}
|
|
@@ -34,10 +34,12 @@
|
|
|
34
34
|
"../../../../../../../front_end/models/trace/insights/DOMSize.ts",
|
|
35
35
|
"../../../../../../../front_end/models/trace/insights/DocumentLatency.ts",
|
|
36
36
|
"../../../../../../../front_end/models/trace/insights/FontDisplay.ts",
|
|
37
|
+
"../../../../../../../front_end/models/trace/insights/ForcedReflow.ts",
|
|
37
38
|
"../../../../../../../front_end/models/trace/insights/ImageDelivery.ts",
|
|
38
39
|
"../../../../../../../front_end/models/trace/insights/InteractionToNextPaint.ts",
|
|
39
40
|
"../../../../../../../front_end/models/trace/insights/LCPDiscovery.ts",
|
|
40
41
|
"../../../../../../../front_end/models/trace/insights/LCPPhases.ts",
|
|
42
|
+
"../../../../../../../front_end/models/trace/insights/LongCriticalNetworkTree.ts",
|
|
41
43
|
"../../../../../../../front_end/models/trace/insights/Models.ts",
|
|
42
44
|
"../../../../../../../front_end/models/trace/insights/RenderBlocking.ts",
|
|
43
45
|
"../../../../../../../front_end/models/trace/insights/SlowCSSSelector.ts",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// import type * as Common from '../../../core/common/common.js';
|
|
2
|
+
import type * as Protocol from '../../../generated/protocol.js';
|
|
2
3
|
import type * as Handlers from '../handlers/handlers.js';
|
|
3
4
|
import type * as Lantern from '../lantern/lantern.js';
|
|
4
5
|
import type * as Types from '../types/types.js';
|
|
@@ -8,12 +9,12 @@ import type * as Models from './Models.js';
|
|
|
8
9
|
*/
|
|
9
10
|
export type InsightSetContext = InsightSetContextWithoutNavigation | InsightSetContextWithNavigation;
|
|
10
11
|
export interface InsightSetContextWithoutNavigation {
|
|
11
|
-
bounds: Types.Timing.
|
|
12
|
+
bounds: Types.Timing.TraceWindowMicro;
|
|
12
13
|
frameId: string;
|
|
13
14
|
navigation?: never;
|
|
14
15
|
}
|
|
15
16
|
export interface InsightSetContextWithNavigation {
|
|
16
|
-
bounds: Types.Timing.
|
|
17
|
+
bounds: Types.Timing.TraceWindowMicro;
|
|
17
18
|
frameId: string;
|
|
18
19
|
navigation: Types.Events.NavigationStart;
|
|
19
20
|
navigationId: string;
|
|
@@ -24,6 +25,17 @@ export interface LanternContext {
|
|
|
24
25
|
simulator: Lantern.Simulation.Simulator<Types.Events.SyntheticNetworkRequest>;
|
|
25
26
|
metrics: Record<string, Lantern.Metrics.MetricResult>;
|
|
26
27
|
}
|
|
28
|
+
export interface ForcedReflowAggregatedData {
|
|
29
|
+
topLevelFunctionCall: Types.Events.CallFrame | Protocol.Runtime.CallFrame;
|
|
30
|
+
totalReflowTime: number;
|
|
31
|
+
bottomUpData: Set<string>;
|
|
32
|
+
topLevelFunctionCallEvents: Types.Events.Event[];
|
|
33
|
+
}
|
|
34
|
+
export interface BottomUpCallStack {
|
|
35
|
+
bottomUpData: Types.Events.CallFrame | Protocol.Runtime.CallFrame;
|
|
36
|
+
totalTime: number;
|
|
37
|
+
relatedEvents: Types.Events.Event[];
|
|
38
|
+
}
|
|
27
39
|
export type InsightModelsType = typeof Models;
|
|
28
40
|
export declare enum InsightWarning {
|
|
29
41
|
NO_FP = "NO_FP",
|
|
@@ -32,11 +44,11 @@ export declare enum InsightWarning {
|
|
|
32
44
|
NO_LAYOUT = "NO_LAYOUT"
|
|
33
45
|
}
|
|
34
46
|
export interface MetricSavings {
|
|
35
|
-
FCP?: Types.Timing.
|
|
36
|
-
LCP?: Types.Timing.
|
|
37
|
-
TBT?: Types.Timing.
|
|
47
|
+
FCP?: Types.Timing.Milli;
|
|
48
|
+
LCP?: Types.Timing.Milli;
|
|
49
|
+
TBT?: Types.Timing.Milli;
|
|
38
50
|
CLS?: number;
|
|
39
|
-
INP?: Types.Timing.
|
|
51
|
+
INP?: Types.Timing.Milli;
|
|
40
52
|
}
|
|
41
53
|
export declare enum InsightCategory {
|
|
42
54
|
ALL = "All",
|
|
@@ -45,7 +57,9 @@ export declare enum InsightCategory {
|
|
|
45
57
|
CLS = "CLS"
|
|
46
58
|
}
|
|
47
59
|
export type RelatedEventsMap = Map<Types.Events.Event, string[]>;
|
|
48
|
-
export type InsightModel<R extends Record<string, unknown>> = R & {
|
|
60
|
+
export type InsightModel<UIStrings extends Record<string, string>, R extends Record<string, unknown>> = R & {
|
|
61
|
+
/** Not used within DevTools - this is for external consumers (like Lighthouse). */
|
|
62
|
+
strings: UIStrings;
|
|
49
63
|
title: string;
|
|
50
64
|
description: string;
|
|
51
65
|
category: InsightCategory;
|
|
@@ -55,6 +69,7 @@ export type InsightModel<R extends Record<string, unknown>> = R & {
|
|
|
55
69
|
warnings?: InsightWarning[];
|
|
56
70
|
metricSavings?: MetricSavings;
|
|
57
71
|
};
|
|
72
|
+
export type PartialInsightModel<T> = Omit<T, 'strings' | 'title' | 'description' | 'category' | 'shouldShow'>;
|
|
58
73
|
/**
|
|
59
74
|
* Contains insights for a specific navigation. If a trace began after a navigation already started,
|
|
60
75
|
* this could instead represent the duration from the beginning of the trace up to the first recorded
|
|
@@ -66,7 +81,7 @@ export interface InsightSet {
|
|
|
66
81
|
/** The URL to show in the accordion list. */
|
|
67
82
|
url: URL;
|
|
68
83
|
frameId: string;
|
|
69
|
-
bounds: Types.Timing.
|
|
84
|
+
bounds: Types.Timing.TraceWindowMicro;
|
|
70
85
|
model: InsightModels;
|
|
71
86
|
navigation?: Types.Events.NavigationStart;
|
|
72
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/insights/types.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAkD7B,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,mCAAiB,CAAA;IACjB,uEAAuE;IACvE,6DAA2C,CAAA;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAYD,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Common from '../../../core/common/common.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport type * as Handlers from '../handlers/handlers.js';\nimport type * as Lantern from '../lantern/lantern.js';\nimport type * as Types from '../types/types.js';\n\nimport type * as Models from './Models.js';\n\n/**\n * Context for the portion of the trace an insight should look at.\n */\nexport type InsightSetContext = InsightSetContextWithoutNavigation|InsightSetContextWithNavigation;\n\nexport interface InsightSetContextWithoutNavigation {\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation?: never;\n}\n\nexport interface InsightSetContextWithNavigation {\n bounds: Types.Timing.TraceWindowMicro;\n frameId: string;\n navigation: Types.Events.NavigationStart;\n navigationId: string;\n lantern?: LanternContext;\n}\n\nexport interface LanternContext {\n graph: Lantern.Graph.Node<Types.Events.SyntheticNetworkRequest>;\n simulator: Lantern.Simulation.Simulator<Types.Events.SyntheticNetworkRequest>;\n metrics: Record<string, Lantern.Metrics.MetricResult>;\n}\n\nexport interface ForcedReflowAggregatedData {\n topLevelFunctionCall: Types.Events.CallFrame|Protocol.Runtime.CallFrame;\n totalReflowTime: number;\n bottomUpData: Set<string>;\n topLevelFunctionCallEvents: Types.Events.Event[];\n}\n\nexport interface BottomUpCallStack {\n bottomUpData: Types.Events.CallFrame|Protocol.Runtime.CallFrame;\n totalTime: number;\n relatedEvents: Types.Events.Event[];\n}\n\nexport type InsightModelsType = typeof Models;\n\nexport enum InsightWarning {\n NO_FP = 'NO_FP',\n NO_LCP = 'NO_LCP',\n // No network request could be identified as the primary HTML document.\n NO_DOCUMENT_REQUEST = 'NO_DOCUMENT_REQUEST',\n NO_LAYOUT = 'NO_LAYOUT',\n}\n\nexport interface MetricSavings {\n /* eslint-disable @typescript-eslint/naming-convention */\n FCP?: Types.Timing.Milli;\n LCP?: Types.Timing.Milli;\n TBT?: Types.Timing.Milli;\n CLS?: number;\n INP?: Types.Timing.Milli;\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nexport enum InsightCategory {\n ALL = 'All',\n INP = 'INP',\n LCP = 'LCP',\n CLS = 'CLS',\n}\n\nexport type RelatedEventsMap = Map<Types.Events.Event, string[]>;\n\nexport type InsightModel<UIStrings extends Record<string, string>, R extends Record<string, unknown>> = R&{\n /** Not used within DevTools - this is for external consumers (like Lighthouse). */\n strings: UIStrings,\n title: Common.UIString.LocalizedString,\n description: Common.UIString.LocalizedString,\n category: InsightCategory,\n /** True if there is anything of interest to display to the user. */\n shouldShow: boolean,\n relatedEvents?: RelatedEventsMap | Types.Events.Event[],\n warnings?: InsightWarning[],\n metricSavings?: MetricSavings,\n};\n\nexport type PartialInsightModel<T> = Omit<T, 'strings'|'title'|'description'|'category'|'shouldShow'>;\n\n/**\n * Contains insights for a specific navigation. If a trace began after a navigation already started,\n * this could instead represent the duration from the beginning of the trace up to the first recorded\n * navigation (or the end of the trace).\n */\nexport interface InsightSet {\n /** If for a navigation, this is the navigationId. Else it is Trace.Types.Events.NO_NAVIGATION. */\n id: Types.Events.NavigationId;\n /** The URL to show in the accordion list. */\n url: URL;\n frameId: string;\n bounds: Types.Timing.TraceWindowMicro;\n model: InsightModels;\n navigation?: Types.Events.NavigationStart;\n}\n\n/**\n * Contains insights for a specific insight set.\n */\nexport type InsightModels = {\n [I in keyof InsightModelsType]: ReturnType<InsightModelsType[I]['generateInsight']>;\n};\n\n/**\n * Contains insights for the entire trace. Insights are mostly grouped by `navigationId`, with one exception:\n *\n * If the analyzed trace started after the navigation, and has meaningful work with that span, there is no\n * navigation to map it to. In this case `Types.Events.NO_NAVIGATION` is used for the key.\n */\nexport type TraceInsightSets = Map<Types.Events.NavigationId, InsightSet>;\n\n/**\n * Represents the narrow set of dependencies defined by an insight's `deps()` function. `Meta` is always included regardless of `deps()`.\n */\nexport type RequiredData<D extends() => Array<keyof typeof Handlers.ModelHandlers>> =\n Handlers.Types.EnabledHandlerDataWithMeta<Pick<typeof Handlers.ModelHandlers, ReturnType<D>[number]>>;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNode } from './BaseNode.js';
|
|
2
1
|
import type * as Lantern from '../types/types.js';
|
|
2
|
+
import { BaseNode } from './BaseNode.js';
|
|
3
3
|
declare class CPUNode<T = Lantern.AnyNetworkObject> extends BaseNode<T> {
|
|
4
4
|
_event: Lantern.TraceEvent;
|
|
5
5
|
_childEvents: Lantern.TraceEvent[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CPUNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/CPUNode.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"CPUNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/CPUNode.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,MAAM,OAAsC,SAAQ,QAAW;IAC7D,MAAM,CAAqB;IAC3B,YAAY,CAAuB;IACnC,cAAc,CAAmB;IAEjC,YAAY,WAA+B,EAAE,cAAoC,EAAE,EAAE,cAAuB;QAC1G,MAAM,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,IAAI,WAAW,CAAC,EAAE,EAAE,CAAC;QACtD,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,IAAa,IAAI;QACf,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;IAC5B,CAAC;IAED,IAAa,SAAS;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,IAAa,OAAO;QAClB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;IAC1C,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;IACvC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtC,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBACpC,SAAS;YACX,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC7C,SAAS;YACX,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,yBAAyB;QAChC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1E,CAAC;CACF;AAED,OAAO,EAAC,OAAO,EAAC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Lantern from '../types/types.js';\n\nimport {BaseNode} from './BaseNode.js';\n\nclass CPUNode<T = Lantern.AnyNetworkObject> extends BaseNode<T> {\n _event: Lantern.TraceEvent;\n _childEvents: Lantern.TraceEvent[];\n correctedEndTs: number|undefined;\n\n constructor(parentEvent: Lantern.TraceEvent, childEvents: Lantern.TraceEvent[] = [], correctedEndTs?: number) {\n const nodeId = `${parentEvent.tid}.${parentEvent.ts}`;\n super(nodeId);\n\n this._event = parentEvent;\n this._childEvents = childEvents;\n this.correctedEndTs = correctedEndTs;\n }\n\n override get type(): 'cpu' {\n return BaseNode.types.CPU;\n }\n\n override get startTime(): number {\n return this._event.ts;\n }\n\n override get endTime(): number {\n if (this.correctedEndTs) {\n return this.correctedEndTs;\n }\n return this._event.ts + this._event.dur;\n }\n\n get duration(): number {\n return this.endTime - this.startTime;\n }\n\n get event(): Lantern.TraceEvent {\n return this._event;\n }\n\n get childEvents(): Lantern.TraceEvent[] {\n return this._childEvents;\n }\n\n /**\n * Returns true if this node contains a Layout task.\n */\n didPerformLayout(): boolean {\n return this._childEvents.some(evt => evt.name === 'Layout');\n }\n\n /**\n * Returns the script URLs that had their EvaluateScript events occur in this task.\n */\n getEvaluateScriptURLs(): Set<string> {\n const urls = new Set<string>();\n for (const event of this._childEvents) {\n if (event.name !== 'EvaluateScript') {\n continue;\n }\n if (!event.args.data || !event.args.data.url) {\n continue;\n }\n urls.add(event.args.data.url);\n }\n\n return urls;\n }\n\n override cloneWithoutRelationships(): CPUNode {\n return new CPUNode(this._event, this._childEvents, this.correctedEndTs);\n }\n}\n\nexport {CPUNode};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNode } from './BaseNode.js';
|
|
2
1
|
import type * as Lantern from '../types/types.js';
|
|
2
|
+
import { BaseNode } from './BaseNode.js';
|
|
3
3
|
declare class NetworkNode<T = Lantern.AnyNetworkObject> extends BaseNode<T> {
|
|
4
4
|
_request: Lantern.NetworkRequest<T>;
|
|
5
5
|
constructor(networkRequest: Lantern.NetworkRequest<T>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/NetworkNode.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"NetworkNode.js","sourceRoot":"","sources":["../../../../../../../../front_end/models/trace/lantern/graph/NetworkNode.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,EAAC,QA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C,IAAI,CAAC;IACjE,CAAC;IAED,IAAI,aAAa;QACf,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,oBAAoB;QACtB,iEAAiE;QACjE,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC9C,uFAAuF;YACvF,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,oBAAoB,CAAC;IACzD,CAAC;IAED,yBAAyB;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,KAAK,QAAQ,CAAC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,KAAK,UAAU,CAAC;QAC7D,MAAM,gBAAgB,GAAG,QAAQ,KAAK,MAAM,IAAI,QAAQ,CAAC;QACzD,MAAM,oBAAoB,GAAG,QAAQ,KAAK,MAAM,IAAI,UAAU,CAAC;QAC/D,OAAO,QAAQ,KAAK,UAAU,IAAI,gBAAgB,IAAI,oBAAoB,CAAC;IAC7E,CAAC;IAEQ,yBAAyB;QAChC,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,OAAO,EAAC,WAAW,EAAC,CAAC","sourcesContent":["// Copyright 2024 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as Lantern from '../types/types.js';\n\nimport {BaseNode} from './BaseNode.js';\n\nconst NON_NETWORK_SCHEMES = [\n 'blob', // @see https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL\n 'data', // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\n 'intent', // @see https://developer.chrome.com/docs/multidevice/android/intents/\n 'file', // @see https://en.wikipedia.org/wiki/File_URI_scheme\n 'filesystem', // @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystem\n 'chrome-extension',\n];\n\n/**\n * Note: the `protocol` field from CDP can be 'h2', 'http', (not 'https'!) or it'll be url's scheme.\n * https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/protocol/network_handler.cc;l=598-611;drc=56d4a9a9deb30be73adcee8737c73bcb2a5ab64f\n * However, a `new URL(href).protocol` has a colon suffix.\n * https://url.spec.whatwg.org/#dom-url-protocol\n * A URL's `scheme` is specced as the `protocol` sans-colon, but isn't exposed on a URL object.\n * This method can take all 3 of these string types as a parameter.\n *\n * @param protocol Either a networkRequest's `protocol` per CDP or a `new URL(href).protocol`\n */\nfunction isNonNetworkProtocol(protocol: string): boolean {\n // Strip off any colon\n const urlScheme = protocol.includes(':') ? protocol.slice(0, protocol.indexOf(':')) : protocol;\n return NON_NETWORK_SCHEMES.includes(urlScheme);\n}\n\nclass NetworkNode<T = Lantern.AnyNetworkObject> extends BaseNode<T> {\n _request: Lantern.NetworkRequest<T>;\n\n constructor(networkRequest: Lantern.NetworkRequest<T>) {\n super(networkRequest.requestId);\n this._request = networkRequest;\n }\n\n override get type(): 'network' {\n return BaseNode.types.NETWORK;\n }\n\n override get startTime(): number {\n return this._request.rendererStartTime * 1000;\n }\n\n override get endTime(): number {\n return this._request.networkEndTime * 1000;\n }\n\n get rawRequest(): Readonly<T> {\n return this._request.rawRequest as Required<T>;\n }\n\n get request(): Lantern.NetworkRequest<T> {\n return this._request;\n }\n\n get initiatorType(): string {\n return this._request.initiator && this._request.initiator.type;\n }\n\n get fromDiskCache(): boolean {\n return Boolean(this._request.fromDiskCache);\n }\n\n get isNonNetworkProtocol(): boolean {\n // The 'protocol' field in devtools a string more like a `scheme`\n return isNonNetworkProtocol(this.request.protocol) ||\n // But `protocol` can fail to be populated if the request fails, so fallback to scheme.\n isNonNetworkProtocol(this.request.parsedURL.scheme);\n }\n\n /**\n * Returns whether this network request can be downloaded without a TCP connection.\n * During simulation we treat data coming in over a network connection separately from on-device data.\n */\n get isConnectionless(): boolean {\n return this.fromDiskCache || this.isNonNetworkProtocol;\n }\n\n hasRenderBlockingPriority(): boolean {\n const priority = this._request.priority;\n const isScript = this._request.resourceType === 'Script';\n const isDocument = this._request.resourceType === 'Document';\n const isBlockingScript = priority === 'High' && isScript;\n const isBlockingHtmlImport = priority === 'High' && isDocument;\n return priority === 'VeryHigh' || isBlockingScript || isBlockingHtmlImport;\n }\n\n override cloneWithoutRelationships(): NetworkNode<T> {\n const node = new NetworkNode(this._request);\n node.setIsMainDocument(this._isMainDocument);\n return node;\n }\n}\n\nexport {NetworkNode};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as File from './File.js';
|
|
1
2
|
export interface Configuration {
|
|
2
3
|
/**
|
|
3
4
|
* Include V8 RCS functions in the JS stacks
|
|
@@ -35,3 +36,17 @@ export declare const defaults: () => Configuration;
|
|
|
35
36
|
* already processed it with the same configuration.
|
|
36
37
|
*/
|
|
37
38
|
export declare function configToCacheKey(config: Configuration): string;
|
|
39
|
+
export interface ParseOptions {
|
|
40
|
+
/**
|
|
41
|
+
* If the trace was just recorded on the current page, rather than an imported file.
|
|
42
|
+
* TODO(paulirish): Maybe remove. This is currently unused by the Processor and Handlers
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
isFreshRecording?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* If the trace is a CPU Profile rather than a Chrome tracing trace.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
isCPUProfile?: boolean;
|
|
51
|
+
metadata?: File.MetaData;
|
|
52
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Configuration.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAmC7B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAkB,EAAE,CAAC,CAAC;IAC5C,uBAAuB,EAAE,KAAK;IAC9B,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,KAAK;IAChB,6BAA6B,EAAE,EAAE;CAClC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAqB;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as File from './File.js';\n\nexport interface Configuration {\n /**\n * Include V8 RCS functions in the JS stacks\n */\n includeRuntimeCallStats: boolean;\n /**\n * Show all events: disable the default filtering which hides and excludes some events.\n */\n showAllEvents: boolean;\n /**\n * Extra detail for RPP developers (eg Trace Event json in Summary, and individual JS Sample events)\n */\n debugMode: boolean;\n /**\n * How many invalidation events will be stored for a layout (or similar) event.\n * On large sites with a lot of DOM there can be thousands of invalidations\n * associated with any given event. It is not useful to show the user 1000s of\n * invalidations in the UI, but it is also expensive for us to hold onto them\n * all, and it helps prevents OOM issues when running in NodeJS\n * [https://github.com/GoogleChrome/lighthouse/issues/16111].\n * Therefore, instead, we store only the latest 20 per event. We do also store\n * the total count, so we can show that, but we'll only ever hold on to the\n * last 20 invalidations (in DESC trace order - so the latest 20 in the trace file)\n *\n * If you set this to 0, we will skip the Invalidations processing entirely.\n * 0 effectively disables the InvalidationsHandler and it will not even\n * attempt to gather or track invalidations.\n */\n maxInvalidationEventsPerEvent: number;\n}\n\nexport const defaults = (): Configuration => ({\n includeRuntimeCallStats: false,\n showAllEvents: false,\n debugMode: false,\n maxInvalidationEventsPerEvent: 20,\n});\n\n/**\n * Generates a key that can be used to represent this config in a cache. This is\n * used mainly in tests, where we want to avoid re-parsing a file if we have\n * already processed it with the same configuration.\n */\nexport function configToCacheKey(config: Configuration): string {\n return JSON.stringify(config);\n}\n\nexport interface ParseOptions {\n /**\n * If the trace was just recorded on the current page, rather than an imported file.\n * TODO(paulirish): Maybe remove. This is currently unused by the Processor and Handlers\n * @default false\n */\n isFreshRecording?: boolean;\n /**\n * If the trace is a CPU Profile rather than a Chrome tracing trace.\n * @default false\n */\n isCPUProfile?: boolean;\n metadata?: File.MetaData;\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// import type * as SDK from '../../../core/sdk/sdk.js';
|
|
2
2
|
import type * as Protocol from '../../../generated/protocol.js';
|
|
3
3
|
// import type * as CrUXManager from '../../../models/crux-manager/crux-manager.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TraceWindowMicro } from './Timing.js';
|
|
5
5
|
import type { Event, LegacyTimelineFrame, ProcessID, SampleIndex, ThreadID } from './TraceEvents.js';
|
|
6
6
|
export interface TraceFile {
|
|
7
7
|
traceEvents: readonly Event[];
|
|
8
8
|
metadata: MetaData;
|
|
9
9
|
}
|
|
10
10
|
export interface Breadcrumb {
|
|
11
|
-
window:
|
|
11
|
+
window: TraceWindowMicro;
|
|
12
12
|
child: Breadcrumb | null;
|
|
13
13
|
}
|
|
14
14
|
export declare const enum DataOrigin {
|
|
@@ -56,7 +56,7 @@ export interface EntryLabelAnnotation {
|
|
|
56
56
|
export interface TimeRangeAnnotation {
|
|
57
57
|
type: 'TIME_RANGE';
|
|
58
58
|
label: string;
|
|
59
|
-
bounds:
|
|
59
|
+
bounds: TraceWindowMicro;
|
|
60
60
|
}
|
|
61
61
|
export interface EntriesLinkAnnotation {
|
|
62
62
|
type: 'ENTRIES_LINK';
|
|
@@ -75,7 +75,7 @@ export interface EntryLabelAnnotationSerialized {
|
|
|
75
75
|
* Represents an object that is saved in the file when a user creates a time range with a label in the timeline.
|
|
76
76
|
*/
|
|
77
77
|
export interface TimeRangeAnnotationSerialized {
|
|
78
|
-
bounds:
|
|
78
|
+
bounds: TraceWindowMicro;
|
|
79
79
|
label: string;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/File.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAgH7B,MAAM,UAAU,qBAAqB,CAAC,UAAsB;IAC1D,OAAO,UAAU,CAAC,IAAI,KAAK,YAAY,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAC3D,OAAO,UAAU,CAAC,IAAI,KAAK,aAAa,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,UAAsB;IAC5D,OAAO,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC;AAC5C,CAAC;AA0ED,MAAM,UAAU,qBAAqB,CAAC,GAAoB;IACxD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtB,QAAQ,IAAI,EAAE,CAAC;QACb;YACE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC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ACd,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aACN,CAAC;QAC/B,iDAAuC,CAAC,CAAC,CAAC;YACxC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC/D,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO;gBACL,IAAI;gBACJ,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aACjC,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as SDK from '../../../core/sdk/sdk.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport type * as CrUXManager from '../../../models/crux-manager/crux-manager.js';\n\nimport type {TraceWindowMicroSeconds} from './Timing.js';\nimport type {Event, LegacyTimelineFrame, ProcessID, SampleIndex, ThreadID} from './TraceEvents.js';\n\nexport interface TraceFile {\n traceEvents: readonly Event[];\n metadata: MetaData;\n}\n\nexport interface Breadcrumb {\n window: TraceWindowMicroSeconds;\n child: Breadcrumb|null;\n}\n\nexport const enum DataOrigin {\n CPU_PROFILE = 'CPUProfile',\n TRACE_EVENTS = 'TraceEvents',\n}\n\n/**\n * The Entries link can have 3 stated:\n * 1. The Link creation is not started yet, meaning only the button that needs to be clicked to start creating the link is visible.\n * 2. Pending to event - the creation is started, but the entry that the link points to has not been chosen yet\n * 3. Link connected - final state, both entries present\n */\nexport const enum EntriesLinkState {\n CREATION_NOT_STARTED = 'creation_not_started',\n PENDING_TO_EVENT = 'pending_to_event',\n CONNECTED = 'connected',\n}\n\nexport const enum EventKeyType {\n RAW_EVENT = 'r',\n SYNTHETIC_EVENT = 's',\n PROFILE_CALL = 'p',\n LEGACY_TIMELINE_FRAME = 'l',\n}\n\n/**\n * Represents an object that is saved in the file when user created annotations in the timeline.\n *\n * Expected to add more annotations.\n */\nexport interface SerializedAnnotations {\n entryLabels: EntryLabelAnnotationSerialized[];\n labelledTimeRanges: TimeRangeAnnotationSerialized[];\n linksBetweenEntries: EntriesLinkAnnotationSerialized[];\n}\n\n/**\n * Represents an object that is used to store the Entry Label annotation that is created when a user creates a label for an entry in the timeline.\n */\nexport interface EntryLabelAnnotation {\n type: 'ENTRY_LABEL';\n entry: Event|LegacyTimelineFrame;\n label: string;\n}\n\n/**\n * Represents an object that is used to store the Labelled Time Range Annotation that is created when a user creates a Time Range Selection in the timeline.\n */\nexport interface TimeRangeAnnotation {\n type: 'TIME_RANGE';\n label: string;\n bounds: TraceWindowMicroSeconds;\n}\n\nexport interface EntriesLinkAnnotation {\n type: 'ENTRIES_LINK';\n state: EntriesLinkState;\n entryFrom: Event;\n entryTo?: Event;\n}\n\n/**\n * Represents an object that is saved in the file when a user creates a label for an entry in the timeline.\n */\nexport interface EntryLabelAnnotationSerialized {\n entry: SerializableKey;\n label: string;\n}\n\n/**\n * Represents an object that is saved in the file when a user creates a time range with a label in the timeline.\n */\nexport interface TimeRangeAnnotationSerialized {\n bounds: TraceWindowMicroSeconds;\n label: string;\n}\n\n/**\n * Represents an object that is saved in the file when a user creates a link between entries in the timeline.\n */\nexport interface EntriesLinkAnnotationSerialized {\n entryFrom: SerializableKey;\n entryTo: SerializableKey;\n}\n\n/**\n * `Annotation` are the user-created annotations that are saved into the metadata.\n * Those annotations are rendered on the timeline by `Overlays.ts`\n *\n * TODO: Implement other OverlayAnnotations (annotated time ranges, links between entries).\n * TODO: Save/load overlay annotations to/from the trace file.\n */\nexport type Annotation = EntryLabelAnnotation|TimeRangeAnnotation|EntriesLinkAnnotation;\n\nexport function isTimeRangeAnnotation(annotation: Annotation): annotation is TimeRangeAnnotation {\n return annotation.type === 'TIME_RANGE';\n}\n\nexport function isEntryLabelAnnotation(annotation: Annotation): annotation is EntryLabelAnnotation {\n return annotation.type === 'ENTRY_LABEL';\n}\n\nexport function isEntriesLinkAnnotation(annotation: Annotation): annotation is EntriesLinkAnnotation {\n return annotation.type === 'ENTRIES_LINK';\n}\n\n// Serializable keys are created for trace events to be able to save\n// references to timeline events in a trace file. These keys enable\n// user modifications that can be saved. See go/cpq:event-data-json for\n// more details on the key format.\nexport type RawEventKey = `${EventKeyType.RAW_EVENT}-${number}`;\nexport type SyntheticEventKey = `${EventKeyType.SYNTHETIC_EVENT}-${number}`;\nexport type ProfileCallKey = `${EventKeyType.PROFILE_CALL}-${ProcessID}-${ThreadID}-${SampleIndex}-${Protocol.integer}`;\nexport type LegacyTimelineFrameKey = `${EventKeyType.LEGACY_TIMELINE_FRAME}-${number}`;\nexport type SerializableKey = RawEventKey|ProfileCallKey|SyntheticEventKey|LegacyTimelineFrameKey;\n\n// Serializable keys values objects contain data that maps the keys to original Trace Events\nexport interface RawEventKeyValues {\n type: EventKeyType.RAW_EVENT;\n rawIndex: number;\n}\n\nexport interface SyntheticEventKeyValues {\n type: EventKeyType.SYNTHETIC_EVENT;\n rawIndex: number;\n}\n\nexport interface ProfileCallKeyValues {\n type: EventKeyType.PROFILE_CALL;\n processID: ProcessID;\n threadID: ThreadID;\n sampleIndex: SampleIndex;\n protocol: Protocol.integer;\n}\n\nexport interface LegacyTimelineFrameKeyValues {\n type: EventKeyType.LEGACY_TIMELINE_FRAME;\n rawIndex: number;\n}\n\nexport type SerializableKeyValues =\n RawEventKeyValues|ProfileCallKeyValues|SyntheticEventKeyValues|LegacyTimelineFrameKeyValues;\n\nexport interface Modifications {\n entriesModifications: {\n // Entries hidden by the user\n hiddenEntries: SerializableKey[],\n // Entries that parent a hiddenEntry\n expandableEntries: SerializableKey[],\n };\n initialBreadcrumb: Breadcrumb;\n annotations: SerializedAnnotations;\n}\n\n/**\n * Trace metadata that we persist to the file. This will allow us to\n * store specifics for the trace, e.g., which tracks should be visible\n * on load.\n */\nexport interface MetaData {\n source?: 'DevTools';\n startTime?: string;\n emulatedDeviceTitle?: string;\n // Only set if network throttling is active.\n networkThrottling?: string;\n // Only set if network throttling is active.\n networkThrottlingConditions?: Omit<SDK.NetworkManager.Conditions, 'title'>;\n // Only set if CPU throttling is active.\n cpuThrottling?: number;\n hardwareConcurrency?: number;\n dataOrigin?: DataOrigin;\n enhancedTraceVersion?: number;\n modifications?: Modifications;\n cruxFieldData?: CrUXManager.PageResult[];\n}\n\nexport type Contents = TraceFile|Event[];\n\nexport function traceEventKeyToValues(key: SerializableKey): SerializableKeyValues {\n const parts = key.split('-');\n const type = parts[0];\n\n switch (type) {\n case EventKeyType.PROFILE_CALL:\n if (parts.length !== 5 ||\n !(parts.every((part, i) => i === 0 || typeof part === 'number' || !isNaN(parseInt(part, 10))))) {\n throw new Error(`Invalid ProfileCallKey: ${key}`);\n }\n return {\n type: parts[0],\n processID: parseInt(parts[1], 10),\n threadID: parseInt(parts[2], 10),\n sampleIndex: parseInt(parts[3], 10),\n protocol: parseInt(parts[4], 10),\n } as ProfileCallKeyValues;\n case EventKeyType.RAW_EVENT:\n if (parts.length !== 2 || !(typeof parts[1] === 'number' || !isNaN(parseInt(parts[1], 10)))) {\n throw new Error(`Invalid RawEvent Key: ${key}`);\n }\n return {\n type: parts[0],\n rawIndex: parseInt(parts[1], 10),\n } as RawEventKeyValues;\n case EventKeyType.SYNTHETIC_EVENT:\n if (parts.length !== 2 || !(typeof parts[1] === 'number' || !isNaN(parseInt(parts[1], 10)))) {\n throw new Error(`Invalid SyntheticEvent Key: ${key}`);\n }\n return {\n type: parts[0],\n rawIndex: parseInt(parts[1], 10),\n } as SyntheticEventKeyValues;\n case EventKeyType.LEGACY_TIMELINE_FRAME: {\n if (parts.length !== 2 || Number.isNaN(parseInt(parts[1], 10))) {\n throw new Error(`Invalid LegacyTimelineFrame Key: ${key}`);\n }\n return {\n type,\n rawIndex: parseInt(parts[1], 10),\n };\n }\n\n default:\n throw new Error(`Unknown trace event key: ${key}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/File.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAgH7B,MAAM,UAAU,qBAAqB,CAAC,UAAsB;IAC1D,OAAO,UAAU,CAAC,IAAI,KAAK,YAAY,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAC3D,OAAO,UAAU,CAAC,IAAI,KAAK,aAAa,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,UAAsB;IAC5D,OAAO,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC;AAC5C,CAAC;AA0ED,MAAM,UAAU,qBAAqB,CAAC,GAAoB;IACxD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtB,QAAQ,IAAI,EAAE,CAAC;QACb;YACE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnG,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YACpD,CAAC;YACD,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;gBACd,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC/D,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO;gBACL,IAAI;gBACJ,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aACjC,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport type * as SDK from '../../../core/sdk/sdk.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport type * as CrUXManager from '../../../models/crux-manager/crux-manager.js';\n\nimport type {TraceWindowMicro} from './Timing.js';\nimport type {Event, LegacyTimelineFrame, ProcessID, SampleIndex, ThreadID} from './TraceEvents.js';\n\nexport interface TraceFile {\n traceEvents: readonly Event[];\n metadata: MetaData;\n}\n\nexport interface Breadcrumb {\n window: TraceWindowMicro;\n child: Breadcrumb|null;\n}\n\nexport const enum DataOrigin {\n CPU_PROFILE = 'CPUProfile',\n TRACE_EVENTS = 'TraceEvents',\n}\n\n/**\n * The Entries link can have 3 stated:\n * 1. The Link creation is not started yet, meaning only the button that needs to be clicked to start creating the link is visible.\n * 2. Pending to event - the creation is started, but the entry that the link points to has not been chosen yet\n * 3. Link connected - final state, both entries present\n */\nexport const enum EntriesLinkState {\n CREATION_NOT_STARTED = 'creation_not_started',\n PENDING_TO_EVENT = 'pending_to_event',\n CONNECTED = 'connected',\n}\n\nexport const enum EventKeyType {\n RAW_EVENT = 'r',\n SYNTHETIC_EVENT = 's',\n PROFILE_CALL = 'p',\n LEGACY_TIMELINE_FRAME = 'l',\n}\n\n/**\n * Represents an object that is saved in the file when user created annotations in the timeline.\n *\n * Expected to add more annotations.\n */\nexport interface SerializedAnnotations {\n entryLabels: EntryLabelAnnotationSerialized[];\n labelledTimeRanges: TimeRangeAnnotationSerialized[];\n linksBetweenEntries: EntriesLinkAnnotationSerialized[];\n}\n\n/**\n * Represents an object that is used to store the Entry Label annotation that is created when a user creates a label for an entry in the timeline.\n */\nexport interface EntryLabelAnnotation {\n type: 'ENTRY_LABEL';\n entry: Event|LegacyTimelineFrame;\n label: string;\n}\n\n/**\n * Represents an object that is used to store the Labelled Time Range Annotation that is created when a user creates a Time Range Selection in the timeline.\n */\nexport interface TimeRangeAnnotation {\n type: 'TIME_RANGE';\n label: string;\n bounds: TraceWindowMicro;\n}\n\nexport interface EntriesLinkAnnotation {\n type: 'ENTRIES_LINK';\n state: EntriesLinkState;\n entryFrom: Event;\n entryTo?: Event;\n}\n\n/**\n * Represents an object that is saved in the file when a user creates a label for an entry in the timeline.\n */\nexport interface EntryLabelAnnotationSerialized {\n entry: SerializableKey;\n label: string;\n}\n\n/**\n * Represents an object that is saved in the file when a user creates a time range with a label in the timeline.\n */\nexport interface TimeRangeAnnotationSerialized {\n bounds: TraceWindowMicro;\n label: string;\n}\n\n/**\n * Represents an object that is saved in the file when a user creates a link between entries in the timeline.\n */\nexport interface EntriesLinkAnnotationSerialized {\n entryFrom: SerializableKey;\n entryTo: SerializableKey;\n}\n\n/**\n * `Annotation` are the user-created annotations that are saved into the metadata.\n * Those annotations are rendered on the timeline by `Overlays.ts`\n *\n * TODO: Implement other OverlayAnnotations (annotated time ranges, links between entries).\n * TODO: Save/load overlay annotations to/from the trace file.\n */\nexport type Annotation = EntryLabelAnnotation|TimeRangeAnnotation|EntriesLinkAnnotation;\n\nexport function isTimeRangeAnnotation(annotation: Annotation): annotation is TimeRangeAnnotation {\n return annotation.type === 'TIME_RANGE';\n}\n\nexport function isEntryLabelAnnotation(annotation: Annotation): annotation is EntryLabelAnnotation {\n return annotation.type === 'ENTRY_LABEL';\n}\n\nexport function isEntriesLinkAnnotation(annotation: Annotation): annotation is EntriesLinkAnnotation {\n return annotation.type === 'ENTRIES_LINK';\n}\n\n// Serializable keys are created for trace events to be able to save\n// references to timeline events in a trace file. These keys enable\n// user modifications that can be saved. See go/cpq:event-data-json for\n// more details on the key format.\nexport type RawEventKey = `${EventKeyType.RAW_EVENT}-${number}`;\nexport type SyntheticEventKey = `${EventKeyType.SYNTHETIC_EVENT}-${number}`;\nexport type ProfileCallKey = `${EventKeyType.PROFILE_CALL}-${ProcessID}-${ThreadID}-${SampleIndex}-${Protocol.integer}`;\nexport type LegacyTimelineFrameKey = `${EventKeyType.LEGACY_TIMELINE_FRAME}-${number}`;\nexport type SerializableKey = RawEventKey|ProfileCallKey|SyntheticEventKey|LegacyTimelineFrameKey;\n\n// Serializable keys values objects contain data that maps the keys to original Trace Events\nexport interface RawEventKeyValues {\n type: EventKeyType.RAW_EVENT;\n rawIndex: number;\n}\n\nexport interface SyntheticEventKeyValues {\n type: EventKeyType.SYNTHETIC_EVENT;\n rawIndex: number;\n}\n\nexport interface ProfileCallKeyValues {\n type: EventKeyType.PROFILE_CALL;\n processID: ProcessID;\n threadID: ThreadID;\n sampleIndex: SampleIndex;\n protocol: Protocol.integer;\n}\n\nexport interface LegacyTimelineFrameKeyValues {\n type: EventKeyType.LEGACY_TIMELINE_FRAME;\n rawIndex: number;\n}\n\nexport type SerializableKeyValues =\n RawEventKeyValues|ProfileCallKeyValues|SyntheticEventKeyValues|LegacyTimelineFrameKeyValues;\n\nexport interface Modifications {\n entriesModifications: {\n // Entries hidden by the user\n hiddenEntries: SerializableKey[],\n // Entries that parent a hiddenEntry\n expandableEntries: SerializableKey[],\n };\n initialBreadcrumb: Breadcrumb;\n annotations: SerializedAnnotations;\n}\n\n/**\n * Trace metadata that we persist to the file. This will allow us to\n * store specifics for the trace, e.g., which tracks should be visible\n * on load.\n */\nexport interface MetaData {\n source?: 'DevTools';\n startTime?: string;\n emulatedDeviceTitle?: string;\n // Only set if network throttling is active.\n networkThrottling?: string;\n // Only set if network throttling is active.\n networkThrottlingConditions?: Omit<SDK.NetworkManager.Conditions, 'title'>;\n // Only set if CPU throttling is active.\n cpuThrottling?: number;\n hardwareConcurrency?: number;\n dataOrigin?: DataOrigin;\n enhancedTraceVersion?: number;\n modifications?: Modifications;\n cruxFieldData?: CrUXManager.PageResult[];\n}\n\nexport type Contents = TraceFile|Event[];\n\nexport function traceEventKeyToValues(key: SerializableKey): SerializableKeyValues {\n const parts = key.split('-');\n const type = parts[0];\n\n switch (type) {\n case EventKeyType.PROFILE_CALL:\n if (parts.length !== 5 ||\n !(parts.every((part, i) => i === 0 || typeof part === 'number' || !isNaN(parseInt(part, 10))))) {\n throw new Error(`Invalid ProfileCallKey: ${key}`);\n }\n return {\n type: parts[0],\n processID: parseInt(parts[1], 10),\n threadID: parseInt(parts[2], 10),\n sampleIndex: parseInt(parts[3], 10),\n protocol: parseInt(parts[4], 10),\n } as ProfileCallKeyValues;\n case EventKeyType.RAW_EVENT:\n if (parts.length !== 2 || !(typeof parts[1] === 'number' || !isNaN(parseInt(parts[1], 10)))) {\n throw new Error(`Invalid RawEvent Key: ${key}`);\n }\n return {\n type: parts[0],\n rawIndex: parseInt(parts[1], 10),\n } as RawEventKeyValues;\n case EventKeyType.SYNTHETIC_EVENT:\n if (parts.length !== 2 || !(typeof parts[1] === 'number' || !isNaN(parseInt(parts[1], 10)))) {\n throw new Error(`Invalid SyntheticEvent Key: ${key}`);\n }\n return {\n type: parts[0],\n rawIndex: parseInt(parts[1], 10),\n } as SyntheticEventKeyValues;\n case EventKeyType.LEGACY_TIMELINE_FRAME: {\n if (parts.length !== 2 || Number.isNaN(parseInt(parts[1], 10))) {\n throw new Error(`Invalid LegacyTimelineFrame Key: ${key}`);\n }\n return {\n type,\n rawIndex: parseInt(parts[1], 10),\n };\n }\n\n default:\n throw new Error(`Unknown trace event key: ${key}`);\n }\n}\n"]}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Micro = number & {
|
|
2
2
|
_tag: 'MicroSeconds';
|
|
3
3
|
};
|
|
4
|
-
export declare function
|
|
5
|
-
export type
|
|
4
|
+
export declare function Micro(value: number): Micro;
|
|
5
|
+
export type Milli = number & {
|
|
6
6
|
_tag: 'MilliSeconds';
|
|
7
7
|
};
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function Milli(value: number): Milli;
|
|
9
9
|
export type Seconds = number & {
|
|
10
10
|
_tag: 'Seconds';
|
|
11
11
|
};
|
|
12
12
|
export declare function Seconds(value: number): Seconds;
|
|
13
|
-
export
|
|
14
|
-
MICROSECONDS = 0,
|
|
15
|
-
MILLISECONDS = 1,
|
|
16
|
-
SECONDS = 2,
|
|
17
|
-
MINUTES = 3
|
|
18
|
-
}
|
|
19
|
-
export interface TraceWindow<TimeFormat extends MicroSeconds | MilliSeconds> {
|
|
13
|
+
export interface TraceWindow<TimeFormat extends Micro | Milli> {
|
|
20
14
|
min: TimeFormat;
|
|
21
15
|
max: TimeFormat;
|
|
22
16
|
range: TimeFormat;
|
|
23
17
|
}
|
|
24
|
-
export type
|
|
25
|
-
export type
|
|
18
|
+
export type TraceWindowMicro = TraceWindow<Micro>;
|
|
19
|
+
export type TraceWindowMilli = TraceWindow<Milli>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// Copyright 2022 The Chromium Authors. All rights reserved.
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5
|
+
export function Micro(value) {
|
|
5
6
|
return value;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
export function Milli(value) {
|
|
8
10
|
return value;
|
|
9
11
|
}
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
13
|
export function Seconds(value) {
|
|
11
14
|
return value;
|
|
12
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timing.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Timing.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;
|
|
1
|
+
{"version":3,"file":"Timing.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/types/Timing.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAG7B,gEAAgE;AAChE,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,OAAO,KAAc,CAAC;AACxB,CAAC;AAGD,gEAAgE;AAChE,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,OAAO,KAAc,CAAC;AACxB,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,OAAO,KAAgB,CAAC;AAC1B,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport type Micro = number&{_tag: 'MicroSeconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function Micro(value: number): Micro {\n return value as Micro;\n}\n\nexport type Milli = number&{_tag: 'MilliSeconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function Milli(value: number): Milli {\n return value as Milli;\n}\nexport type Seconds = number&{_tag: 'Seconds'};\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function Seconds(value: number): Seconds {\n return value as Seconds;\n}\n\nexport interface TraceWindow<TimeFormat extends Micro|Milli> {\n min: TimeFormat;\n max: TimeFormat;\n range: TimeFormat;\n}\n\nexport type TraceWindowMicro = TraceWindow<Micro>;\nexport type TraceWindowMilli = TraceWindow<Milli>;\n"]}
|