@paulirish/trace_engine 0.0.54 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts +4 -0
- package/.tmp/tsbuildinfo/models/trace/extras/polyfills.d.ts.map +1 -0
- package/.tmp/tsbuildinfo/tsconfig.tsbuildinfo +1 -1
- package/core/platform/MimeType.d.ts +3 -2
- package/core/platform/MimeType.js +4 -3
- package/core/platform/MimeType.js.map +1 -1
- package/generated/protocol.d.ts +115 -16
- package/locales/af.json +52 -10
- package/locales/am.json +52 -10
- package/locales/ar.json +51 -9
- package/locales/as.json +52 -10
- package/locales/az.json +52 -10
- package/locales/be.json +52 -10
- package/locales/bg.json +52 -10
- package/locales/bn.json +52 -10
- package/locales/bs.json +52 -10
- package/locales/ca.json +52 -10
- package/locales/cs.json +52 -10
- package/locales/cy.json +52 -10
- package/locales/da.json +52 -10
- package/locales/de.json +52 -10
- package/locales/el.json +52 -10
- package/locales/en-GB.json +52 -10
- package/locales/en-US.json +12 -12
- package/locales/en-XL.json +12 -12
- package/locales/es-419.json +52 -10
- package/locales/es.json +50 -8
- package/locales/et.json +52 -10
- package/locales/eu.json +52 -10
- package/locales/fa.json +51 -9
- package/locales/fi.json +52 -10
- package/locales/fil.json +52 -10
- package/locales/fr-CA.json +52 -10
- package/locales/fr.json +52 -10
- package/locales/gl.json +52 -10
- package/locales/gu.json +52 -10
- package/locales/he.json +52 -10
- package/locales/hi.json +52 -10
- package/locales/hr.json +52 -10
- package/locales/hu.json +51 -9
- package/locales/hy.json +51 -9
- package/locales/id.json +52 -10
- package/locales/is.json +53 -11
- package/locales/it.json +51 -9
- package/locales/ja.json +52 -10
- package/locales/ka.json +53 -11
- package/locales/kk.json +51 -9
- package/locales/km.json +52 -10
- package/locales/kn.json +52 -10
- package/locales/ko.json +52 -10
- package/locales/ky.json +51 -9
- package/locales/lo.json +52 -10
- package/locales/lt.json +52 -10
- package/locales/lv.json +51 -9
- package/locales/mk.json +52 -10
- package/locales/ml.json +53 -11
- package/locales/mn.json +52 -10
- package/locales/mr.json +52 -10
- package/locales/ms.json +52 -10
- package/locales/my.json +51 -9
- package/locales/ne.json +52 -10
- package/locales/nl.json +52 -10
- package/locales/no.json +52 -10
- package/locales/or.json +53 -11
- package/locales/pa.json +53 -11
- package/locales/pl.json +51 -9
- package/locales/pt-PT.json +52 -10
- package/locales/pt.json +52 -10
- package/locales/ro.json +52 -10
- package/locales/ru.json +53 -11
- package/locales/si.json +52 -10
- package/locales/sk.json +51 -9
- package/locales/sl.json +51 -9
- package/locales/sq.json +52 -10
- package/locales/sr-Latn.json +52 -10
- package/locales/sr.json +52 -10
- package/locales/sv.json +52 -10
- package/locales/sw.json +51 -9
- package/locales/ta.json +52 -10
- package/locales/te.json +52 -10
- package/locales/th.json +51 -9
- package/locales/tr.json +52 -10
- package/locales/uk.json +52 -10
- package/locales/ur.json +52 -10
- package/locales/uz.json +51 -9
- package/locales/vi.json +52 -10
- package/locales/zh-HK.json +52 -10
- package/locales/zh-TW.json +51 -9
- package/locales/zh.json +52 -10
- package/locales/zu.json +52 -10
- package/models/cpu_profile/CPUProfileDataModel.d.ts +4 -2
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -1
- package/models/cpu_profile/ProfileTreeModel.d.ts +0 -1
- package/models/cpu_profile/ProfileTreeModel.js +0 -2
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -1
- package/models/trace/LanternComputationData.js +7 -6
- package/models/trace/LanternComputationData.js.map +1 -1
- package/models/trace/Processor.js +23 -16
- package/models/trace/Processor.js.map +1 -1
- package/models/trace/extras/extras-tsconfig.json +0 -2
- package/models/trace/extras/extras.js.map +1 -1
- package/models/trace/handlers/MetaHandler.js +2 -0
- package/models/trace/handlers/MetaHandler.js.map +1 -1
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +0 -5
- package/models/trace/handlers/NetworkRequestsHandler.js +0 -19
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
- package/models/trace/handlers/SamplesHandler.js +7 -2
- package/models/trace/handlers/SamplesHandler.js.map +1 -1
- package/models/trace/handlers/ScriptsHandler.js.map +1 -1
- package/models/trace/helpers/SamplesIntegrator.js +8 -13
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -1
- package/models/trace/helpers/Trace.js +0 -7
- package/models/trace/helpers/Trace.js.map +1 -1
- package/models/trace/insights/CLSCulprits.d.ts +24 -4
- package/models/trace/insights/CLSCulprits.js +30 -11
- package/models/trace/insights/CLSCulprits.js.map +1 -1
- package/models/trace/insights/DocumentLatency.d.ts +2 -2
- package/models/trace/insights/DocumentLatency.js +2 -2
- package/models/trace/insights/DocumentLatency.js.map +1 -1
- package/models/trace/insights/NetworkDependencyTree.d.ts +31 -5
- package/models/trace/insights/NetworkDependencyTree.js +135 -10
- package/models/trace/insights/NetworkDependencyTree.js.map +1 -1
- package/models/trace/insights/Viewport.d.ts +8 -2
- package/models/trace/insights/Viewport.js +16 -1
- package/models/trace/insights/Viewport.js.map +1 -1
- package/models/trace/lantern/graph/BaseNode.d.ts +5 -2
- package/models/trace/lantern/graph/BaseNode.js +8 -5
- package/models/trace/lantern/graph/BaseNode.js.map +1 -1
- package/models/trace/lantern/graph/PageDependencyGraph.js +46 -3
- package/models/trace/lantern/graph/PageDependencyGraph.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/trace-tsconfig.json +0 -1
- package/models/trace/trace.d.ts +1 -2
- package/models/trace/trace.js +1 -2
- package/models/trace/trace.js.map +1 -1
- package/models/trace/types/Extensions.d.ts +6 -1
- package/models/trace/types/Extensions.js.map +1 -1
- package/models/trace/types/File.d.ts +15 -1
- package/models/trace/types/File.js.map +1 -1
- package/models/trace/types/TraceEvents.d.ts +7 -4
- package/models/trace/types/TraceEvents.js +4 -3
- package/models/trace/types/TraceEvents.js.map +1 -1
- package/package.json +1 -1
- package/core/platform/ServerTiming.d.ts +0 -31
- package/core/platform/ServerTiming.js +0 -212
- package/core/platform/ServerTiming.js.map +0 -1
- package/models/trace/TracingManager.js.map +0 -1
- package/models/trace/extras/FetchNodes.d.ts +0 -61
- package/models/trace/extras/FetchNodes.js +0 -214
- package/models/trace/extras/FetchNodes.js.map +0 -1
- package/models/trace/extras/Metadata.d.ts +0 -3
- package/models/trace/extras/Metadata.js +0 -71
- package/models/trace/extras/Metadata.js.map +0 -1
- package/models/trace/extras/TimelineJSProfile.d.ts +0 -13
- package/models/trace/extras/TimelineJSProfile.js +0 -55
- package/models/trace/extras/TimelineJSProfile.js.map +0 -1
- package/models/trace/extras/URLForEntry.d.ts +0 -12
- package/models/trace/extras/URLForEntry.js +0 -43
- package/models/trace/extras/URLForEntry.js.map +0 -1
- package/models/trace/handlers/ServerTimingsHandler.d.ts +0 -9
- package/models/trace/handlers/ServerTimingsHandler.js +0 -106
- package/models/trace/handlers/ServerTimingsHandler.js.map +0 -1
- package/models/trace/insights/CumulativeLayoutShift.d.ts +0 -57
- package/models/trace/insights/CumulativeLayoutShift.js +0 -335
- package/models/trace/insights/CumulativeLayoutShift.js.map +0 -1
- package/models/trace/insights/InsightRunners.d.ts +0 -9
- package/models/trace/insights/InsightRunners.js +0 -13
- package/models/trace/insights/InsightRunners.js.map +0 -1
- package/models/trace/insights/LargestContentfulPaint.d.ts +0 -38
- package/models/trace/insights/LargestContentfulPaint.js +0 -113
- package/models/trace/insights/LargestContentfulPaint.js.map +0 -1
- package/models/trace/insights/ThirdPartyWeb.d.ts +0 -13
- package/models/trace/insights/ThirdPartyWeb.js +0 -42
- package/models/trace/insights/ThirdPartyWeb.js.map +0 -1
- package/models/trace/root-causes/LayoutShift.d.ts +0 -125
- package/models/trace/root-causes/LayoutShift.js +0 -519
- package/models/trace/root-causes/LayoutShift.js.map +0 -1
- package/models/trace/root-causes/RootCauses.d.ts +0 -15
- package/models/trace/root-causes/RootCauses.js +0 -12
- package/models/trace/root-causes/RootCauses.js.map +0 -1
- package/models/trace/root-causes/bundle-tsconfig.json +0 -1
- package/models/trace/root-causes/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -42
- package/models/trace/root-causes/root-causes-tsconfig.json +0 -55
- package/models/trace/root-causes/root-causes.d.ts +0 -1
- package/models/trace/root-causes/root-causes.js +0 -5
- package/models/trace/root-causes/root-causes.js.map +0 -1
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors. All rights reserved.
|
|
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 SDK from '../../../core/sdk/sdk.js';
|
|
5
|
-
import * as Types from '../types/types.js';
|
|
6
|
-
export async function forNewRecording(isCpuProfile, recordStartTime, emulatedDeviceTitle, cruxFieldData) {
|
|
7
|
-
try {
|
|
8
|
-
if (isCpuProfile) {
|
|
9
|
-
// For CPU profile, only specify data origin
|
|
10
|
-
return {
|
|
11
|
-
dataOrigin: Types.File.DataOrigin.CPU_PROFILE,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const cpuThrottlingManager = SDK.CPUThrottlingManager.CPUThrottlingManager.instance();
|
|
15
|
-
// If the CPU Throttling manager has yet to have its primary page target
|
|
16
|
-
// set, it will block on the call to get the current hardware concurrency
|
|
17
|
-
// until it does. At this point where the user has recorded a trace, that
|
|
18
|
-
// target should have been set. So if it doesn't have it set, we instead
|
|
19
|
-
// just bail and don't store the hardware concurrency (this is only
|
|
20
|
-
// metadata, not mission critical information).
|
|
21
|
-
// We also race this call against a 1s timeout, because sometimes this call
|
|
22
|
-
// can hang (unsure exactly why) and we do not want to block parsing for
|
|
23
|
-
// too long as a result.
|
|
24
|
-
function getConcurrencyOrTimeout() {
|
|
25
|
-
return Promise.race([
|
|
26
|
-
SDK.CPUThrottlingManager.CPUThrottlingManager.instance().getHardwareConcurrency(),
|
|
27
|
-
new Promise(resolve => {
|
|
28
|
-
setTimeout(() => resolve(undefined), 1_000);
|
|
29
|
-
}),
|
|
30
|
-
]);
|
|
31
|
-
}
|
|
32
|
-
const hardwareConcurrency = cpuThrottlingManager.hasPrimaryPageTargetSet() ? await getConcurrencyOrTimeout() : undefined;
|
|
33
|
-
const cpuThrottling = SDK.CPUThrottlingManager.CPUThrottlingManager.instance().cpuThrottlingRate();
|
|
34
|
-
const networkConditions = SDK.NetworkManager.MultitargetNetworkManager.instance().isThrottling() ?
|
|
35
|
-
SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions() :
|
|
36
|
-
undefined;
|
|
37
|
-
let networkThrottlingConditions;
|
|
38
|
-
let networkTitle;
|
|
39
|
-
if (networkConditions) {
|
|
40
|
-
networkThrottlingConditions = {
|
|
41
|
-
download: networkConditions.download,
|
|
42
|
-
upload: networkConditions.upload,
|
|
43
|
-
latency: networkConditions.latency,
|
|
44
|
-
packetLoss: networkConditions.packetLoss,
|
|
45
|
-
packetQueueLength: networkConditions.packetQueueLength,
|
|
46
|
-
packetReordering: networkConditions.packetReordering,
|
|
47
|
-
targetLatency: networkConditions.targetLatency,
|
|
48
|
-
};
|
|
49
|
-
networkTitle =
|
|
50
|
-
typeof networkConditions.title === 'function' ? networkConditions.title() : networkConditions.title;
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
source: 'DevTools',
|
|
54
|
-
startTime: recordStartTime ? new Date(recordStartTime).toJSON() : undefined, // ISO-8601 timestamp
|
|
55
|
-
emulatedDeviceTitle,
|
|
56
|
-
cpuThrottling: cpuThrottling !== 1 ? cpuThrottling : undefined,
|
|
57
|
-
networkThrottling: networkTitle,
|
|
58
|
-
networkThrottlingConditions,
|
|
59
|
-
hardwareConcurrency,
|
|
60
|
-
dataOrigin: Types.File.DataOrigin.TRACE_EVENTS,
|
|
61
|
-
cruxFieldData,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
// If anything went wrong, it does not really matter. The impact is that we
|
|
66
|
-
// will not save the metadata when we save the trace to disk, but that is
|
|
67
|
-
// not really important, so just return empty object and move on
|
|
68
|
-
return {};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=Metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/extras/Metadata.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAEhD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,YAAqB,EAAE,eAAwB,EAAE,mBAA4B,EAC7E,aAAwC;IAC1C,IAAI,CAAC;QACH,IAAI,YAAY,EAAE,CAAC;YACjB,4CAA4C;YAC5C,OAAO;gBACL,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW;aAC9C,CAAC;QACJ,CAAC;QACD,MAAM,oBAAoB,GAAG,GAAG,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;QAEtF,wEAAwE;QACxE,yEAAyE;QACzE,yEAAyE;QACzE,wEAAwE;QACxE,mEAAmE;QACnE,+CAA+C;QAC/C,2EAA2E;QAC3E,wEAAwE;QACxE,wBAAwB;QACxB,SAAS,uBAAuB;YAC9B,OAAO,OAAO,CAAC,IAAI,CAAC;gBAClB,GAAG,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC,sBAAsB,EAAE;gBACjF,IAAI,OAAO,CAAY,OAAO,CAAC,EAAE;oBAC/B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC9C,CAAC,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QAED,MAAM,mBAAmB,GACrB,oBAAoB,CAAC,uBAAuB,EAAE,CAA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AAE,YAAY;YAC/B,2BAA2B;YAC3B,mBAAmB;YACnB,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY;YAC9C,aAAa;SACd,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;QAC3E,yEAAyE;QACzE,gEAAgE;QAChE,OAAO,EAAE,CAAC;IACZ,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 * as SDK from '../../../core/sdk/sdk.js';\nimport type * as CrUXManager from '../../crux-manager/crux-manager.js';\nimport * as Types from '../types/types.js';\n\nexport async function forNewRecording(\n isCpuProfile: boolean, recordStartTime?: number, emulatedDeviceTitle?: string,\n cruxFieldData?: CrUXManager.PageResult[]): Promise<Types.File.MetaData> {\n try {\n if (isCpuProfile) {\n // For CPU profile, only specify data origin\n return {\n dataOrigin: Types.File.DataOrigin.CPU_PROFILE,\n };\n }\n const cpuThrottlingManager = SDK.CPUThrottlingManager.CPUThrottlingManager.instance();\n\n // If the CPU Throttling manager has yet to have its primary page target\n // set, it will block on the call to get the current hardware concurrency\n // until it does. At this point where the user has recorded a trace, that\n // target should have been set. So if it doesn't have it set, we instead\n // just bail and don't store the hardware concurrency (this is only\n // metadata, not mission critical information).\n // We also race this call against a 1s timeout, because sometimes this call\n // can hang (unsure exactly why) and we do not want to block parsing for\n // too long as a result.\n function getConcurrencyOrTimeout(): Promise<number|undefined> {\n return Promise.race([\n SDK.CPUThrottlingManager.CPUThrottlingManager.instance().getHardwareConcurrency(),\n new Promise<undefined>(resolve => {\n setTimeout(() => resolve(undefined), 1_000);\n }),\n ]);\n }\n\n const hardwareConcurrency =\n cpuThrottlingManager.hasPrimaryPageTargetSet() ? await getConcurrencyOrTimeout() : undefined;\n const cpuThrottling = SDK.CPUThrottlingManager.CPUThrottlingManager.instance().cpuThrottlingRate();\n const networkConditions = SDK.NetworkManager.MultitargetNetworkManager.instance().isThrottling() ?\n SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions() :\n undefined;\n\n let networkThrottlingConditions;\n let networkTitle;\n if (networkConditions) {\n networkThrottlingConditions = {\n download: networkConditions.download,\n upload: networkConditions.upload,\n latency: networkConditions.latency,\n packetLoss: networkConditions.packetLoss,\n packetQueueLength: networkConditions.packetQueueLength,\n packetReordering: networkConditions.packetReordering,\n targetLatency: networkConditions.targetLatency,\n };\n networkTitle =\n typeof networkConditions.title === 'function' ? networkConditions.title() : networkConditions.title;\n }\n\n return {\n source: 'DevTools',\n startTime: recordStartTime ? new Date(recordStartTime).toJSON() : undefined, // ISO-8601 timestamp\n emulatedDeviceTitle,\n cpuThrottling: cpuThrottling !== 1 ? cpuThrottling : undefined,\n networkThrottling: networkTitle,\n networkThrottlingConditions,\n hardwareConcurrency,\n dataOrigin: Types.File.DataOrigin.TRACE_EVENTS,\n cruxFieldData,\n };\n } catch {\n // If anything went wrong, it does not really matter. The impact is that we\n // will not save the metadata when we save the trace to disk, but that is\n // not really important, so just return empty object and move on\n return {};\n }\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type * as Protocol from '../../../generated/protocol.js';
|
|
2
|
-
import * as Types from '../types/types.js';
|
|
3
|
-
export declare class TimelineJSProfileProcessor {
|
|
4
|
-
static isNativeRuntimeFrame(frame: Protocol.Runtime.CallFrame): boolean;
|
|
5
|
-
static nativeGroup(nativeName: string): string | null;
|
|
6
|
-
static createFakeTraceFromCpuProfile(profile: Protocol.Profiler.Profile, tid: Types.Events.ThreadID): Types.Events.Event[];
|
|
7
|
-
}
|
|
8
|
-
export declare namespace TimelineJSProfileProcessor {
|
|
9
|
-
const enum NativeGroups {
|
|
10
|
-
COMPILE = "Compile",
|
|
11
|
-
PARSE = "Parse"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
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 Types from '../types/types.js';
|
|
5
|
-
// TODO(paulirish): Delete this file.
|
|
6
|
-
// - Move isNativeRuntimeFrame and nativeGroup to TraceEvents.d.ts (or TraceTree)
|
|
7
|
-
// - Move createFakeTraceFromCpuProfile to TimelineLoader
|
|
8
|
-
export class TimelineJSProfileProcessor {
|
|
9
|
-
static isNativeRuntimeFrame(frame) {
|
|
10
|
-
return frame.url === 'native V8Runtime';
|
|
11
|
-
}
|
|
12
|
-
static nativeGroup(nativeName) {
|
|
13
|
-
if (nativeName.startsWith('Parse')) {
|
|
14
|
-
return "Parse" /* TimelineJSProfileProcessor.NativeGroups.PARSE */;
|
|
15
|
-
}
|
|
16
|
-
if (nativeName.startsWith('Compile') || nativeName.startsWith('Recompile')) {
|
|
17
|
-
return "Compile" /* TimelineJSProfileProcessor.NativeGroups.COMPILE */;
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
static createFakeTraceFromCpuProfile(profile, tid) {
|
|
22
|
-
const events = [];
|
|
23
|
-
const threadName = `Thread ${tid}`;
|
|
24
|
-
appendEvent('TracingStartedInPage', { data: { sessionId: '1' } }, 0, 0, "M" /* Types.Events.Phase.METADATA */);
|
|
25
|
-
appendEvent("thread_name" /* Types.Events.Name.THREAD_NAME */, { name: threadName }, 0, 0, "M" /* Types.Events.Phase.METADATA */, '__metadata');
|
|
26
|
-
if (!profile) {
|
|
27
|
-
return events;
|
|
28
|
-
}
|
|
29
|
-
// Append a root to show the start time of the profile (which is earlier than first sample), so the Performance
|
|
30
|
-
// panel won't truncate this time period.
|
|
31
|
-
// 'JSRoot' doesn't exist in the new engine and is not the name of an actual trace event, but changing it might break other trace processing tools that rely on this, so we stick with this name.
|
|
32
|
-
// TODO(crbug.com/341234884): consider removing this or clarify why it's required.
|
|
33
|
-
appendEvent('JSRoot', {}, profile.startTime, profile.endTime - profile.startTime, "X" /* Types.Events.Phase.COMPLETE */, 'toplevel');
|
|
34
|
-
// TODO: create a `Profile` event instead, as `cpuProfile` is legacy
|
|
35
|
-
appendEvent('CpuProfile', { data: { cpuProfile: profile } }, profile.endTime, 0, "X" /* Types.Events.Phase.COMPLETE */);
|
|
36
|
-
return events;
|
|
37
|
-
function appendEvent(name, args, ts, dur, ph, cat) {
|
|
38
|
-
const event = {
|
|
39
|
-
cat: cat || 'disabled-by-default-devtools.timeline',
|
|
40
|
-
name,
|
|
41
|
-
ph: ph || "X" /* Types.Events.Phase.COMPLETE */,
|
|
42
|
-
pid: Types.Events.ProcessID(1),
|
|
43
|
-
tid,
|
|
44
|
-
ts: Types.Timing.MicroSeconds(ts),
|
|
45
|
-
args,
|
|
46
|
-
};
|
|
47
|
-
if (dur) {
|
|
48
|
-
event.dur = Types.Timing.MicroSeconds(dur);
|
|
49
|
-
}
|
|
50
|
-
events.push(event);
|
|
51
|
-
return event;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=TimelineJSProfile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineJSProfile.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/extras/TimelineJSProfile.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAK7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,qCAAqC;AACrC,mFAAmF;AACnF,2DAA2D;AAC3D,MAAM,OAAO,0BAA0B;IACrC,MAAM,CAAC,oBAAoB,CAAC,KAAiC;QAC3D,OAAO,KAAK,CAAC,GAAG,KAAK,kBAAkB,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,UAAkB;QACnC,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,mEAAqD;QACvD,CAAC;QACD,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,C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K,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;gBACjC,IAAI;aACL,CAAC;YAEF,IAAI,GAAG,EAAE,CAAC;gBACR,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAC7C,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,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\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as Types from '../types/types.js';\n\n// TODO(paulirish): Delete this file.\n// - Move isNativeRuntimeFrame and nativeGroup to TraceEvents.d.ts (or TraceTree)\n// - Move createFakeTraceFromCpuProfile to TimelineLoader\nexport class TimelineJSProfileProcessor {\n static isNativeRuntimeFrame(frame: Protocol.Runtime.CallFrame): boolean {\n return frame.url === 'native V8Runtime';\n }\n\n static nativeGroup(nativeName: string): string|null {\n if (nativeName.startsWith('Parse')) {\n return TimelineJSProfileProcessor.NativeGroups.PARSE;\n }\n if (nativeName.startsWith('Compile') || nativeName.startsWith('Recompile')) {\n return TimelineJSProfileProcessor.NativeGroups.COMPILE;\n }\n return null;\n }\n\n static createFakeTraceFromCpuProfile(profile: Protocol.Profiler.Profile, tid: Types.Events.ThreadID):\n Types.Events.Event[] {\n const events: Types.Events.Event[] = [];\n\n const threadName = `Thread ${tid}`;\n appendEvent('TracingStartedInPage', {data: {sessionId: '1'}}, 0, 0, Types.Events.Phase.METADATA);\n appendEvent(Types.Events.Name.THREAD_NAME, {name: threadName}, 0, 0, Types.Events.Phase.METADATA, '__metadata');\n if (!profile) {\n return events;\n }\n\n // Append a root to show the start time of the profile (which is earlier than first sample), so the Performance\n // panel won't truncate this time period.\n // 'JSRoot' doesn't exist in the new engine and is not the name of an actual trace event, but changing it might break other trace processing tools that rely on this, so we stick with this name.\n // TODO(crbug.com/341234884): consider removing this or clarify why it's required.\n appendEvent(\n 'JSRoot', {}, profile.startTime, profile.endTime - profile.startTime, Types.Events.Phase.COMPLETE, 'toplevel');\n\n // TODO: create a `Profile` event instead, as `cpuProfile` is legacy\n appendEvent('CpuProfile', {data: {cpuProfile: profile}}, profile.endTime, 0, Types.Events.Phase.COMPLETE);\n return events;\n\n function appendEvent(\n name: string, args: any, ts: number, dur?: number, ph?: Types.Events.Phase, cat?: string): Types.Events.Event {\n const event: Types.Events.Event = {\n cat: cat || 'disabled-by-default-devtools.timeline',\n name,\n ph: ph || Types.Events.Phase.COMPLETE,\n pid: Types.Events.ProcessID(1),\n tid,\n ts: Types.Timing.MicroSeconds(ts),\n args,\n };\n\n if (dur) {\n event.dur = Types.Timing.MicroSeconds(dur);\n }\n events.push(event);\n return event;\n }\n }\n}\n\nexport namespace TimelineJSProfileProcessor {\n export const enum NativeGroups {\n COMPILE = 'Compile',\n PARSE = 'Parse',\n }\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type * as Platform from '../../../core/platform/platform.js';
|
|
2
|
-
import type * as Handlers from '../handlers/handlers.js';
|
|
3
|
-
import * as Types from '../types/types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Use this helper whenever resolving an URL's source mapping is not an
|
|
6
|
-
* option. For example when processing non-ui data. Otherwise use the
|
|
7
|
-
* helper SourceMapsResolver::resolvedURLForEntry
|
|
8
|
-
*
|
|
9
|
-
* If an URL will be displayed in the UI, it's likely you should not use
|
|
10
|
-
* this helper and prefer the other option instead.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getNonResolved(parsedTrace: Handlers.Types.ParsedTrace, entry: Types.Events.Event): Platform.DevToolsPath.UrlString | null;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 The Chromium Authors. All rights reserved.
|
|
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 Types from '../types/types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Use this helper whenever resolving an URL's source mapping is not an
|
|
7
|
-
* option. For example when processing non-ui data. Otherwise use the
|
|
8
|
-
* helper SourceMapsResolver::resolvedURLForEntry
|
|
9
|
-
*
|
|
10
|
-
* If an URL will be displayed in the UI, it's likely you should not use
|
|
11
|
-
* this helper and prefer the other option instead.
|
|
12
|
-
*/
|
|
13
|
-
export function getNonResolved(parsedTrace, entry) {
|
|
14
|
-
if (Types.Events.isProfileCall(entry)) {
|
|
15
|
-
return entry.callFrame.url;
|
|
16
|
-
}
|
|
17
|
-
if (entry.args?.data?.stackTrace && entry.args.data.stackTrace.length > 0) {
|
|
18
|
-
return entry.args.data.stackTrace[0].url;
|
|
19
|
-
}
|
|
20
|
-
if (Types.Events.isSyntheticNetworkRequest(entry)) {
|
|
21
|
-
return entry.args.data.url;
|
|
22
|
-
}
|
|
23
|
-
// DecodeImage events use the URL from the relevant PaintImage event.
|
|
24
|
-
if (Types.Events.isDecodeImage(entry)) {
|
|
25
|
-
const paintEvent = parsedTrace.ImagePainting.paintImageForEvent.get(entry);
|
|
26
|
-
return paintEvent ? getNonResolved(parsedTrace, paintEvent) : null;
|
|
27
|
-
}
|
|
28
|
-
// DrawLazyPixelRef events use the URL from the relevant PaintImage event.
|
|
29
|
-
if (Types.Events.isDrawLazyPixelRef(entry) && entry.args?.LazyPixelRef) {
|
|
30
|
-
const paintEvent = parsedTrace.ImagePainting.paintImageByDrawLazyPixelRef.get(entry.args.LazyPixelRef);
|
|
31
|
-
return paintEvent ? getNonResolved(parsedTrace, paintEvent) : null;
|
|
32
|
-
}
|
|
33
|
-
// ParseHTML events store the URL under beginData, not data.
|
|
34
|
-
if (Types.Events.isParseHTML(entry)) {
|
|
35
|
-
return entry.args.beginData.url;
|
|
36
|
-
}
|
|
37
|
-
// For all other events, try to see if the URL is provided, else return null.
|
|
38
|
-
if (entry.args?.data?.url) {
|
|
39
|
-
return entry.args.data.url;
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=URLForEntry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"URLForEntry.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/extras/URLForEntry.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAI7B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C;;;;;;;GAOG;AAEH,MAAM,UAAU,cAAc,CAC1B,WAAuC,EAAE,KAAyB;IACpE,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC,SAAS,CAAC,GAAsC,CAAC;IAChE,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAsC,CAAC;IAC9E,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAsC,CAAC;IAChE,CAAC;IAED,qEAAqE;IACrE,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3E,OAAO,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,CAAC;IAED,0EAA0E;IAC1E,IAAI,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;QACvE,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC,4BAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvG,OAAO,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,CAAC;IAED,4DAA4D;IAC5D,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAsC,CAAC;IACrE,CAAC;IAED,6EAA6E;IAC7E,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAsC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,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 Platform from '../../../core/platform/platform.js';\nimport type * as Handlers from '../handlers/handlers.js';\nimport * as Types from '../types/types.js';\n\n/**\n * Use this helper whenever resolving an URL's source mapping is not an\n * option. For example when processing non-ui data. Otherwise use the\n * helper SourceMapsResolver::resolvedURLForEntry\n *\n * If an URL will be displayed in the UI, it's likely you should not use\n * this helper and prefer the other option instead.\n */\n\nexport function getNonResolved(\n parsedTrace: Handlers.Types.ParsedTrace, entry: Types.Events.Event): Platform.DevToolsPath.UrlString|null {\n if (Types.Events.isProfileCall(entry)) {\n return entry.callFrame.url as Platform.DevToolsPath.UrlString;\n }\n\n if (entry.args?.data?.stackTrace && entry.args.data.stackTrace.length > 0) {\n return entry.args.data.stackTrace[0].url as Platform.DevToolsPath.UrlString;\n }\n\n if (Types.Events.isSyntheticNetworkRequest(entry)) {\n return entry.args.data.url as Platform.DevToolsPath.UrlString;\n }\n\n // DecodeImage events use the URL from the relevant PaintImage event.\n if (Types.Events.isDecodeImage(entry)) {\n const paintEvent = parsedTrace.ImagePainting.paintImageForEvent.get(entry);\n return paintEvent ? getNonResolved(parsedTrace, paintEvent) : null;\n }\n\n // DrawLazyPixelRef events use the URL from the relevant PaintImage event.\n if (Types.Events.isDrawLazyPixelRef(entry) && entry.args?.LazyPixelRef) {\n const paintEvent = parsedTrace.ImagePainting.paintImageByDrawLazyPixelRef.get(entry.args.LazyPixelRef);\n return paintEvent ? getNonResolved(parsedTrace, paintEvent) : null;\n }\n\n // ParseHTML events store the URL under beginData, not data.\n if (Types.Events.isParseHTML(entry)) {\n return entry.args.beginData.url as Platform.DevToolsPath.UrlString;\n }\n\n // For all other events, try to see if the URL is provided, else return null.\n if (entry.args?.data?.url) {\n return entry.args.data.url as Platform.DevToolsPath.UrlString;\n }\n\n return null;\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as Types from '../types/types.js';
|
|
2
|
-
import type { HandlerName } from './types.js';
|
|
3
|
-
export declare function reset(): void;
|
|
4
|
-
export declare function handleEvent(_event: Types.Events.Event): void;
|
|
5
|
-
export declare function finalize(): Promise<void>;
|
|
6
|
-
export declare function data(): {
|
|
7
|
-
serverTimings: Types.Events.SyntheticServerTiming[];
|
|
8
|
-
};
|
|
9
|
-
export declare function deps(): HandlerName[];
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
import * as Platform from '../../../core/platform/platform.js';
|
|
5
|
-
import * as Helpers from '../helpers/helpers.js';
|
|
6
|
-
import * as Types from '../types/types.js';
|
|
7
|
-
import { data as networkData } from './NetworkRequestsHandler.js';
|
|
8
|
-
const serverTimings = [];
|
|
9
|
-
export function reset() {
|
|
10
|
-
serverTimings.length = 0;
|
|
11
|
-
}
|
|
12
|
-
export function handleEvent(_event) {
|
|
13
|
-
// Implementation not needed because data is sourced from NetworkRequestsHandler
|
|
14
|
-
}
|
|
15
|
-
export async function finalize() {
|
|
16
|
-
extractServerTimings();
|
|
17
|
-
Helpers.Trace.sortTraceEventsInPlace(serverTimings);
|
|
18
|
-
}
|
|
19
|
-
const RESPONSE_START_METRIC_NAME = 'response-start';
|
|
20
|
-
const RESPONSE_END_METRIC_NAME = 'response-end';
|
|
21
|
-
/**
|
|
22
|
-
* Creates synthetic trace events based on server timings in the
|
|
23
|
-
* `Server-Timing` response header. A non-standard `start` param is
|
|
24
|
-
* expected on each metric that contains the start time of the timing
|
|
25
|
-
* based on the server clock.
|
|
26
|
-
*
|
|
27
|
-
* In order to estimate the offset between the server and client clocks,
|
|
28
|
-
* we look for the non-standard `response-start` and `response-end`
|
|
29
|
-
* metrics in the response header, which contain the start and end
|
|
30
|
-
* timestamps of the network request processing in the server. We
|
|
31
|
-
* compare these with the times the request was sent and received in the
|
|
32
|
-
* client to estimate the offset between the client and the server
|
|
33
|
-
* clocks.
|
|
34
|
-
*
|
|
35
|
-
* With this offset estimation at hand, we can map timestamps from the
|
|
36
|
-
* server clock to the tracing clock and locate the timings in the
|
|
37
|
-
* performance timeline.
|
|
38
|
-
*/
|
|
39
|
-
function extractServerTimings() {
|
|
40
|
-
for (const networkEvent of networkData().byTime) {
|
|
41
|
-
let timingsInRequest = null;
|
|
42
|
-
for (const header of networkEvent.args.data.responseHeaders) {
|
|
43
|
-
const headerName = header.name.toLocaleLowerCase();
|
|
44
|
-
// Some popular hosting providers like vercel or render get rid of
|
|
45
|
-
// Server-Timing headers added by users, so as a workaround we
|
|
46
|
-
// also support server timing headers with the `-test` suffix
|
|
47
|
-
// while this feature is experimental, to enable easier trials.
|
|
48
|
-
if (headerName === 'server-timing' || headerName === 'server-timing-test') {
|
|
49
|
-
header.name = 'server-timing';
|
|
50
|
-
timingsInRequest = Platform.ServerTiming.ServerTiming.parseHeaders([header]);
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const serverStart = timingsInRequest?.find(timing => timing.metric === RESPONSE_START_METRIC_NAME)?.start;
|
|
55
|
-
const serverEnd = timingsInRequest?.find(timing => timing.metric === RESPONSE_END_METRIC_NAME)?.start;
|
|
56
|
-
if (!serverStart || !serverEnd || !timingsInRequest) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const serverStartInMicro = serverStart * 1_000;
|
|
60
|
-
const serverEndInMicro = serverEnd * 1_000;
|
|
61
|
-
serverTimings.push(...createSyntheticServerTiming(networkEvent, serverStartInMicro, serverEndInMicro, timingsInRequest));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function createSyntheticServerTiming(request, serverStart, serverEnd, timingsInRequest) {
|
|
65
|
-
const clientStart = request.args.data.syntheticData.sendStartTime;
|
|
66
|
-
const clientEndTime = request.args.data.syntheticData.sendStartTime + request.args.data.syntheticData.waiting;
|
|
67
|
-
const offset = Types.Timing.MicroSeconds((serverStart - clientStart + serverEnd - clientEndTime) / 2);
|
|
68
|
-
const convertedServerTimings = [];
|
|
69
|
-
for (const timing of timingsInRequest) {
|
|
70
|
-
if (timing.metric === RESPONSE_START_METRIC_NAME || timing.metric === RESPONSE_END_METRIC_NAME) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (timing.start === null) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
const convertedTimestamp = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timing.start)) - offset;
|
|
77
|
-
const parsedUrl = new URL(request.args.data.url);
|
|
78
|
-
const origin = parsedUrl.origin;
|
|
79
|
-
const serverTiming = Helpers.SyntheticEvents.SyntheticEventsManager.registerServerTiming({
|
|
80
|
-
rawSourceEvent: request.rawSourceEvent,
|
|
81
|
-
name: timing.metric,
|
|
82
|
-
ph: "X" /* Types.Events.Phase.COMPLETE */,
|
|
83
|
-
pid: Types.Events.ProcessID(0),
|
|
84
|
-
tid: Types.Events.ThreadID(0),
|
|
85
|
-
ts: Types.Timing.MicroSeconds(convertedTimestamp),
|
|
86
|
-
dur: Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timing.value)),
|
|
87
|
-
cat: 'devtools.server-timing',
|
|
88
|
-
args: { data: { desc: timing.description || undefined, origin } },
|
|
89
|
-
});
|
|
90
|
-
if (!request.args.data.syntheticServerTimings) {
|
|
91
|
-
request.args.data.syntheticServerTimings = [];
|
|
92
|
-
}
|
|
93
|
-
request.args.data.syntheticServerTimings.push(serverTiming);
|
|
94
|
-
convertedServerTimings.push(serverTiming);
|
|
95
|
-
}
|
|
96
|
-
return convertedServerTimings;
|
|
97
|
-
}
|
|
98
|
-
export function data() {
|
|
99
|
-
return {
|
|
100
|
-
serverTimings,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
export function deps() {
|
|
104
|
-
return ['NetworkRequests'];
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=ServerTimingsHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTimingsHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/ServerTimingsHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAC,IAAI,IAAI,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAGhE,MAAM,aAAa,GAAyC,EAAE,CAAC;AAE/D,MAAM,UAAU,KAAK;IACnB,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CA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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 * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {data as networkData} from './NetworkRequestsHandler.js';\nimport type {HandlerName} from './types.js';\n\nconst serverTimings: Types.Events.SyntheticServerTiming[] = [];\n\nexport function reset(): void {\n serverTimings.length = 0;\n}\n\nexport function handleEvent(_event: Types.Events.Event): void {\n // Implementation not needed because data is sourced from NetworkRequestsHandler\n}\n\nexport async function finalize(): Promise<void> {\n extractServerTimings();\n Helpers.Trace.sortTraceEventsInPlace(serverTimings);\n}\n\nconst RESPONSE_START_METRIC_NAME = 'response-start';\nconst RESPONSE_END_METRIC_NAME = 'response-end';\n\n/**\n * Creates synthetic trace events based on server timings in the\n * `Server-Timing` response header. A non-standard `start` param is\n * expected on each metric that contains the start time of the timing\n * based on the server clock.\n *\n * In order to estimate the offset between the server and client clocks,\n * we look for the non-standard `response-start` and `response-end`\n * metrics in the response header, which contain the start and end\n * timestamps of the network request processing in the server. We\n * compare these with the times the request was sent and received in the\n * client to estimate the offset between the client and the server\n * clocks.\n *\n * With this offset estimation at hand, we can map timestamps from the\n * server clock to the tracing clock and locate the timings in the\n * performance timeline.\n */\nfunction extractServerTimings(): void {\n for (const networkEvent of networkData().byTime) {\n let timingsInRequest: Platform.ServerTiming.ServerTiming[]|null = null;\n for (const header of networkEvent.args.data.responseHeaders) {\n const headerName = header.name.toLocaleLowerCase();\n // Some popular hosting providers like vercel or render get rid of\n // Server-Timing headers added by users, so as a workaround we\n // also support server timing headers with the `-test` suffix\n // while this feature is experimental, to enable easier trials.\n if (headerName === 'server-timing' || headerName === 'server-timing-test') {\n header.name = 'server-timing';\n timingsInRequest = Platform.ServerTiming.ServerTiming.parseHeaders([header]);\n continue;\n }\n }\n const serverStart = timingsInRequest?.find(timing => timing.metric === RESPONSE_START_METRIC_NAME)?.start;\n const serverEnd = timingsInRequest?.find(timing => timing.metric === RESPONSE_END_METRIC_NAME)?.start;\n if (!serverStart || !serverEnd || !timingsInRequest) {\n continue;\n }\n\n const serverStartInMicro = serverStart * 1_000;\n const serverEndInMicro = serverEnd * 1_000;\n serverTimings.push(\n ...createSyntheticServerTiming(networkEvent, serverStartInMicro, serverEndInMicro, timingsInRequest));\n }\n}\nfunction createSyntheticServerTiming(\n request: Types.Events.SyntheticNetworkRequest, serverStart: number, serverEnd: number,\n timingsInRequest: Platform.ServerTiming.ServerTiming[]): Types.Events.SyntheticServerTiming[] {\n const clientStart = request.args.data.syntheticData.sendStartTime;\n const clientEndTime = request.args.data.syntheticData.sendStartTime + request.args.data.syntheticData.waiting;\n const offset = Types.Timing.MicroSeconds((serverStart - clientStart + serverEnd - clientEndTime) / 2);\n const convertedServerTimings: Types.Events.SyntheticServerTiming[] = [];\n for (const timing of timingsInRequest) {\n if (timing.metric === RESPONSE_START_METRIC_NAME || timing.metric === RESPONSE_END_METRIC_NAME) {\n continue;\n }\n if (timing.start === null) {\n continue;\n }\n const convertedTimestamp =\n Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timing.start)) - offset;\n const parsedUrl = new URL(request.args.data.url);\n const origin = parsedUrl.origin;\n\n const serverTiming = Helpers.SyntheticEvents.SyntheticEventsManager.registerServerTiming({\n rawSourceEvent: request.rawSourceEvent,\n name: timing.metric,\n ph: Types.Events.Phase.COMPLETE,\n pid: Types.Events.ProcessID(0),\n tid: Types.Events.ThreadID(0),\n ts: Types.Timing.MicroSeconds(convertedTimestamp),\n dur: Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timing.value)),\n cat: 'devtools.server-timing',\n args: {data: {desc: timing.description || undefined, origin}},\n });\n\n if (!request.args.data.syntheticServerTimings) {\n request.args.data.syntheticServerTimings = [];\n }\n request.args.data.syntheticServerTimings.push(serverTiming);\n convertedServerTimings.push(serverTiming);\n }\n return convertedServerTimings;\n}\n\nexport function data(): {serverTimings: Types.Events.SyntheticServerTiming[]} {\n return {\n serverTimings,\n };\n}\n\nexport function deps(): HandlerName[] {\n return ['NetworkRequests'];\n}\n"]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type * as Protocol from '../../../generated/protocol.js';
|
|
2
|
-
import * as Types from '../types/types.js';
|
|
3
|
-
import type { InsightResult, InsightSetContext, RequiredData } from './types.js';
|
|
4
|
-
export type CLSInsightResult = InsightResult<{
|
|
5
|
-
animationFailures: readonly NoncompositedAnimationFailure[];
|
|
6
|
-
shifts: Map<Types.Events.SyntheticLayoutShift, LayoutShiftRootCausesData>;
|
|
7
|
-
clusters: Types.Events.SyntheticLayoutShiftCluster[];
|
|
8
|
-
worstCluster: Types.Events.SyntheticLayoutShiftCluster | undefined;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function deps(): ['Meta', 'Animations', 'LayoutShifts', 'NetworkRequests'];
|
|
11
|
-
export declare const enum AnimationFailureReasons {
|
|
12
|
-
ACCELERATED_ANIMATIONS_DISABLED = "ACCELERATED_ANIMATIONS_DISABLED",
|
|
13
|
-
EFFECT_SUPPRESSED_BY_DEVTOOLS = "EFFECT_SUPPRESSED_BY_DEVTOOLS",
|
|
14
|
-
INVALID_ANIMATION_OR_EFFECT = "INVALID_ANIMATION_OR_EFFECT",
|
|
15
|
-
EFFECT_HAS_UNSUPPORTED_TIMING_PARAMS = "EFFECT_HAS_UNSUPPORTED_TIMING_PARAMS",
|
|
16
|
-
EFFECT_HAS_NON_REPLACE_COMPOSITE_MODE = "EFFECT_HAS_NON_REPLACE_COMPOSITE_MODE",
|
|
17
|
-
TARGET_HAS_INVALID_COMPOSITING_STATE = "TARGET_HAS_INVALID_COMPOSITING_STATE",
|
|
18
|
-
TARGET_HAS_INCOMPATIBLE_ANIMATIONS = "TARGET_HAS_INCOMPATIBLE_ANIMATIONS",
|
|
19
|
-
TARGET_HAS_CSS_OFFSET = "TARGET_HAS_CSS_OFFSET",
|
|
20
|
-
ANIMATION_AFFECTS_NON_CSS_PROPERTIES = "ANIMATION_AFFECTS_NON_CSS_PROPERTIES",
|
|
21
|
-
TRANSFORM_RELATED_PROPERTY_CANNOT_BE_ACCELERATED_ON_TARGET = "TRANSFORM_RELATED_PROPERTY_CANNOT_BE_ACCELERATED_ON_TARGET",
|
|
22
|
-
TRANSFROM_BOX_SIZE_DEPENDENT = "TRANSFROM_BOX_SIZE_DEPENDENT",
|
|
23
|
-
FILTER_RELATED_PROPERTY_MAY_MOVE_PIXELS = "FILTER_RELATED_PROPERTY_MAY_MOVE_PIXELS",
|
|
24
|
-
UNSUPPORTED_CSS_PROPERTY = "UNSUPPORTED_CSS_PROPERTY",
|
|
25
|
-
MIXED_KEYFRAME_VALUE_TYPES = "MIXED_KEYFRAME_VALUE_TYPES",
|
|
26
|
-
TIMELINE_SOURCE_HAS_INVALID_COMPOSITING_STATE = "TIMELINE_SOURCE_HAS_INVALID_COMPOSITING_STATE",
|
|
27
|
-
ANIMATION_HAS_NO_VISIBLE_CHANGE = "ANIMATION_HAS_NO_VISIBLE_CHANGE",
|
|
28
|
-
AFFECTS_IMPORTANT_PROPERTY = "AFFECTS_IMPORTANT_PROPERTY",
|
|
29
|
-
SVG_TARGET_HAS_INDEPENDENT_TRANSFORM_PROPERTY = "SVG_TARGET_HAS_INDEPENDENT_TRANSFORM_PROPERTY"
|
|
30
|
-
}
|
|
31
|
-
export interface NoncompositedAnimationFailure {
|
|
32
|
-
/**
|
|
33
|
-
* Animation name.
|
|
34
|
-
*/
|
|
35
|
-
name?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Failure reason based on mask number defined in
|
|
38
|
-
* https://source.chromium.org/search?q=f:compositor_animations.h%20%22enum%20FailureReason%22.
|
|
39
|
-
*/
|
|
40
|
-
failureReasons: AnimationFailureReasons[];
|
|
41
|
-
/**
|
|
42
|
-
* Unsupported properties.
|
|
43
|
-
*/
|
|
44
|
-
unsupportedProperties?: Types.Events.Animation['args']['data']['unsupportedProperties'];
|
|
45
|
-
/**
|
|
46
|
-
* Animation event.
|
|
47
|
-
*/
|
|
48
|
-
animation?: Types.Events.SyntheticAnimationPair;
|
|
49
|
-
}
|
|
50
|
-
export interface LayoutShiftRootCausesData {
|
|
51
|
-
iframeIds: string[];
|
|
52
|
-
fontRequests: Types.Events.SyntheticNetworkRequest[];
|
|
53
|
-
nonCompositedAnimations: NoncompositedAnimationFailure[];
|
|
54
|
-
unsizedImages: Protocol.DOM.BackendNodeId[];
|
|
55
|
-
}
|
|
56
|
-
export declare function getNonCompositedFailure(animationEvent: Types.Events.SyntheticAnimationPair): NoncompositedAnimationFailure[];
|
|
57
|
-
export declare function generateInsight(parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): CLSInsightResult;
|