@paulirish/trace_engine 0.0.10 → 0.0.12
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/README.md +1 -1
- package/analyze-trace.mjs +1 -1
- package/core/platform/DevToolsPath.d.ts +4 -13
- package/core/platform/DevToolsPath.js +7 -4
- package/core/platform/DevToolsPath.js.map +1 -7
- package/core/platform/MimeType.d.ts +27 -0
- package/core/platform/MimeType.js +119 -86
- package/core/platform/MimeType.js.map +1 -7
- package/core/platform/Timing.d.ts +7 -0
- package/core/platform/Timing.js +7 -4
- package/core/platform/Timing.js.map +1 -7
- package/core/platform/UIString.d.ts +2 -5
- package/core/platform/UIString.js +5 -2
- package/core/platform/UIString.js.map +1 -7
- package/core/platform/UserVisibleError.js +19 -10
- package/core/platform/UserVisibleError.js.map +1 -7
- package/core/platform/array-utilities.d.ts +48 -10
- package/core/platform/array-utilities.js +160 -124
- package/core/platform/array-utilities.js.map +1 -7
- package/core/platform/brand.d.ts +14 -0
- package/core/platform/brand.js +5 -1
- package/core/platform/brand.js.map +1 -7
- package/core/platform/date-utilities.js +10 -6
- package/core/platform/date-utilities.js.map +1 -7
- package/core/platform/dom-utilities.d.ts +3 -1
- package/core/platform/dom-utilities.js +94 -83
- package/core/platform/dom-utilities.js.map +1 -7
- package/core/platform/keyboard-utilities.d.ts +2 -0
- package/core/platform/keyboard-utilities.js +15 -24
- package/core/platform/keyboard-utilities.js.map +1 -7
- package/core/platform/map-utilities.d.ts +4 -0
- package/core/platform/map-utilities.js +66 -60
- package/core/platform/map-utilities.js.map +1 -7
- package/core/platform/number-utilities.js +66 -55
- package/core/platform/number-utilities.js.map +1 -7
- package/core/platform/platform.d.ts +5 -1
- package/core/platform/platform.js +54 -37
- package/core/platform/platform.js.map +1 -7
- package/core/platform/promise-utilities.d.ts +10 -0
- package/core/platform/promise-utilities.js +16 -8
- package/core/platform/promise-utilities.js.map +1 -7
- package/core/platform/set-utilities.js +20 -17
- package/core/platform/set-utilities.js.map +1 -7
- package/core/platform/string-utilities.d.ts +32 -1
- package/core/platform/string-utilities.js +453 -379
- package/core/platform/string-utilities.js.map +1 -7
- package/core/platform/typescript-utilities.d.ts +5 -5
- package/core/platform/typescript-utilities.js +19 -7
- package/core/platform/typescript-utilities.js.map +1 -7
- package/generated/protocol.d.ts +2081 -347
- package/generated/protocol.js +5 -2230
- package/models/cpu_profile/CPUProfileDataModel.d.ts +77 -0
- package/models/cpu_profile/CPUProfileDataModel.js +492 -359
- package/models/cpu_profile/CPUProfileDataModel.js.map +1 -7
- package/models/cpu_profile/ProfileTreeModel.d.ts +29 -0
- package/models/cpu_profile/ProfileTreeModel.js +87 -82
- package/models/cpu_profile/ProfileTreeModel.js.map +1 -7
- package/models/cpu_profile/cpu_profile.d.ts +3 -0
- package/models/cpu_profile/cpu_profile.js +7 -7
- package/models/cpu_profile/cpu_profile.js.map +1 -7
- package/models/trace/EntriesFilter.d.ts +55 -0
- package/models/trace/EntriesFilter.js +227 -166
- package/models/trace/EntriesFilter.js.map +1 -7
- package/models/trace/LegacyTracingModel.js.map +1 -7
- package/models/trace/ModelImpl.d.ts +110 -0
- package/models/trace/ModelImpl.js +161 -102
- package/models/trace/ModelImpl.js.map +1 -7
- package/models/trace/Processor.d.ts +36 -0
- package/models/trace/Processor.js +197 -163
- package/models/trace/Processor.js.map +1 -7
- package/models/trace/TracingManager.js.map +1 -7
- package/models/trace/extras/FetchNodes.d.ts +46 -0
- package/models/trace/extras/FetchNodes.js +132 -91
- package/models/trace/extras/FetchNodes.js.map +1 -7
- package/models/trace/extras/FilmStrip.d.ts +19 -0
- package/models/trace/extras/FilmStrip.js +38 -31
- package/models/trace/extras/FilmStrip.js.map +1 -7
- package/models/trace/extras/MainThreadActivity.d.ts +2 -0
- package/models/trace/extras/MainThreadActivity.js +72 -56
- package/models/trace/extras/MainThreadActivity.js.map +1 -7
- package/models/trace/extras/Metadata.d.ts +2 -0
- package/models/trace/extras/Metadata.js +42 -26
- package/models/trace/extras/Metadata.js.map +1 -7
- package/models/trace/extras/extras.js.map +1 -7
- package/models/trace/handlers/AnimationHandler.d.ts +8 -0
- package/models/trace/handlers/AnimationHandler.js +22 -20
- package/models/trace/handlers/AnimationHandler.js.map +1 -7
- package/models/trace/handlers/AuctionWorkletsHandler.d.ts +8 -0
- package/models/trace/handlers/AuctionWorkletsHandler.js +143 -89
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +1 -7
- package/models/trace/handlers/FramesHandler.d.ts +76 -0
- package/models/trace/handlers/FramesHandler.js +424 -355
- package/models/trace/handlers/FramesHandler.js.map +1 -7
- package/models/trace/handlers/GPUHandler.d.ts +11 -0
- package/models/trace/handlers/GPUHandler.js +41 -37
- package/models/trace/handlers/GPUHandler.js.map +1 -7
- package/models/trace/handlers/InitiatorsHandler.d.ts +10 -0
- package/models/trace/handlers/InitiatorsHandler.js +164 -113
- package/models/trace/handlers/InitiatorsHandler.js.map +1 -7
- package/models/trace/handlers/InvalidationsHandler.d.ts +10 -0
- package/models/trace/handlers/InvalidationsHandler.js +101 -79
- package/models/trace/handlers/InvalidationsHandler.js.map +1 -7
- package/models/trace/handlers/LargestImagePaintHandler.d.ts +5 -0
- package/models/trace/handlers/LargestImagePaintHandler.js +32 -12
- package/models/trace/handlers/LargestImagePaintHandler.js.map +1 -7
- package/models/trace/handlers/LargestTextPaintHandler.d.ts +5 -0
- package/models/trace/handlers/LargestTextPaintHandler.js +20 -12
- package/models/trace/handlers/LargestTextPaintHandler.js.map +1 -7
- package/models/trace/handlers/LayerTreeHandler.d.ts +13 -0
- package/models/trace/handlers/LayerTreeHandler.js +96 -70
- package/models/trace/handlers/LayerTreeHandler.js.map +1 -7
- package/models/trace/handlers/LayoutShiftsHandler.d.ts +44 -0
- package/models/trace/handlers/LayoutShiftsHandler.js +304 -227
- package/models/trace/handlers/LayoutShiftsHandler.js.map +1 -7
- package/models/trace/handlers/MemoryHandler.d.ts +7 -0
- package/models/trace/handlers/MemoryHandler.js +14 -11
- package/models/trace/handlers/MemoryHandler.js.map +1 -7
- package/models/trace/handlers/MetaHandler.d.ts +37 -0
- package/models/trace/handlers/MetaHandler.js +314 -226
- package/models/trace/handlers/MetaHandler.js.map +1 -7
- package/models/trace/handlers/ModelHandlers.d.ts +21 -0
- package/models/trace/handlers/ModelHandlers.js +25 -22
- package/models/trace/handlers/ModelHandlers.js.map +1 -7
- package/models/trace/handlers/NetworkRequestsHandler.d.ts +17 -0
- package/models/trace/handlers/NetworkRequestsHandler.js +342 -218
- package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -7
- package/models/trace/handlers/PageLoadMetricsHandler.d.ts +67 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js +357 -284
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +1 -7
- package/models/trace/handlers/RendererHandler.d.ts +101 -0
- package/models/trace/handlers/RendererHandler.js +295 -191
- package/models/trace/handlers/RendererHandler.js.map +1 -7
- package/models/trace/handlers/SamplesHandler.d.ts +46 -0
- package/models/trace/handlers/SamplesHandler.js +195 -158
- package/models/trace/handlers/SamplesHandler.js.map +1 -7
- package/models/trace/handlers/ScreenshotsHandler.d.ts +7 -0
- package/models/trace/handlers/ScreenshotsHandler.js +63 -41
- package/models/trace/handlers/ScreenshotsHandler.js.map +1 -7
- package/models/trace/handlers/Threads.d.ts +33 -0
- package/models/trace/handlers/Threads.js +85 -67
- package/models/trace/handlers/Threads.js.map +1 -7
- package/models/trace/handlers/UserInteractionsHandler.d.ts +57 -0
- package/models/trace/handlers/UserInteractionsHandler.js +240 -141
- package/models/trace/handlers/UserInteractionsHandler.js.map +1 -7
- package/models/trace/handlers/UserTimingsHandler.d.ts +28 -0
- package/models/trace/handlers/UserTimingsHandler.js +91 -80
- package/models/trace/handlers/UserTimingsHandler.js.map +1 -7
- package/models/trace/handlers/WarningsHandler.d.ts +14 -0
- package/models/trace/handlers/WarningsHandler.js +100 -62
- package/models/trace/handlers/WarningsHandler.js.map +1 -7
- package/models/trace/handlers/WorkersHandler.d.ts +11 -0
- package/models/trace/handlers/WorkersHandler.js +40 -38
- package/models/trace/handlers/WorkersHandler.js.map +1 -7
- package/models/trace/handlers/handlers.d.ts +3 -0
- package/models/trace/handlers/handlers.js +7 -4
- package/models/trace/handlers/handlers.js.map +1 -7
- package/models/trace/handlers/types.d.ts +45 -0
- package/models/trace/handlers/types.js +15 -15
- package/models/trace/handlers/types.js.map +1 -7
- package/models/trace/helpers/SamplesIntegrator.d.ts +49 -0
- package/models/trace/helpers/SamplesIntegrator.js +381 -204
- package/models/trace/helpers/SamplesIntegrator.js.map +1 -7
- package/models/trace/helpers/Timing.d.ts +26 -0
- package/models/trace/helpers/Timing.js +131 -110
- package/models/trace/helpers/Timing.js.map +1 -7
- package/models/trace/helpers/Trace.d.ts +37 -0
- package/models/trace/helpers/Trace.js +200 -166
- package/models/trace/helpers/Trace.js.map +1 -7
- package/models/trace/helpers/TreeHelpers.d.ts +90 -0
- package/models/trace/helpers/TreeHelpers.js +203 -100
- package/models/trace/helpers/TreeHelpers.js.map +1 -7
- package/models/trace/helpers/helpers.d.ts +4 -0
- package/models/trace/helpers/helpers.js +8 -5
- package/models/trace/helpers/helpers.js.map +1 -7
- package/models/trace/root-causes/LayoutShift.d.ts +119 -0
- package/models/trace/root-causes/LayoutShift.js +470 -323
- package/models/trace/root-causes/LayoutShift.js.map +1 -7
- package/models/trace/root-causes/RootCauses.d.ts +14 -0
- package/models/trace/root-causes/RootCauses.js +9 -6
- package/models/trace/root-causes/RootCauses.js.map +1 -7
- package/models/trace/root-causes/root-causes.d.ts +1 -0
- package/models/trace/root-causes/root-causes.js +5 -2
- package/models/trace/root-causes/root-causes.js.map +1 -7
- package/models/trace/trace.d.ts +11 -0
- package/models/trace/trace.js +17 -23
- package/models/trace/trace.js.map +1 -7
- package/models/trace/types/Configuration.d.ts +33 -0
- package/models/trace/types/Configuration.js +25 -14
- package/models/trace/types/Configuration.js.map +1 -7
- package/models/trace/types/File.d.ts +23 -0
- package/models/trace/types/File.js +5 -6
- package/models/trace/types/File.js.map +1 -7
- package/models/trace/types/Timing.d.ts +25 -0
- package/models/trace/types/Timing.js +10 -11
- package/models/trace/types/Timing.js.map +1 -7
- package/models/trace/types/TraceEvents.d.ts +1571 -0
- package/models/trace/types/TraceEvents.js +174 -381
- package/models/trace/types/TraceEvents.js.map +1 -7
- package/models/trace/types/types.d.ts +4 -0
- package/models/trace/types/types.js +8 -5
- package/models/trace/types/types.js.map +1 -7
- package/package.json +1 -1
- package/TracingManager.js +0 -0
- package/core/platform/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -40
- package/core/platform/platform.js.compressed +0 -0
- package/core/platform/platform.js.hash +0 -1
- package/core/platform/platform.prebundle.d.ts +0 -15
- package/core/platform/platform.prebundle.js +0 -50
- package/core/platform/platform.prebundle.js.map +0 -1
- package/core/platform/platform.prebundle.ts +0 -64
- package/extras/extras.js +0 -0
- package/models/trace/SDKServices.js +0 -104
- package/models/trace/SDKServices.js.map +0 -7
- package/models/trace/TraceProcessor.js +0 -133
- package/models/trace/TraceProcessor.js.map +0 -7
- package/models/trace/TreeManipulator.js +0 -85
- package/models/trace/TreeManipulator.js.map +0 -7
- package/models/trace/devtools_entrypoint-legacy-typescript-tsconfig.json +0 -43
- package/models/trace/frames/TimelineFrameModel.js +0 -392
- package/models/trace/frames/TimelineFrameModel.js.map +0 -7
- package/models/trace/frames/bundle-tsconfig.json +0 -1
- package/models/trace/frames/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -43
- package/models/trace/frames/frames-tsconfig.json +0 -58
- package/models/trace/frames/frames.js +0 -5
- package/models/trace/frames/frames.js.map +0 -7
- package/models/trace/handlers/Migration.js +0 -27
- package/models/trace/handlers/Migration.js.map +0 -7
- package/models/trace/handlers/UberFramesHandler.js +0 -293
- package/models/trace/handlers/UberFramesHandler.js.map +0 -7
- package/models/trace/legacy-tsconfig.json +0 -1
- package/models/trace/sdk_services/DOMNodeLookup.js +0 -41
- package/models/trace/sdk_services/DOMNodeLookup.js.map +0 -7
- package/models/trace/sdk_services/LayoutShifts.js +0 -68
- package/models/trace/sdk_services/LayoutShifts.js.map +0 -7
- package/models/trace/sdk_services/bundle-tsconfig.json +0 -1
- package/models/trace/sdk_services/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
- package/models/trace/sdk_services/sdk_services-tsconfig.json +0 -57
- package/models/trace/sdk_services/sdk_services.js +0 -7
- package/models/trace/sdk_services/sdk_services.js.map +0 -7
- package/models/trace/trace-legacy.js +0 -16
- package/models/trace/trace-legacy.js.map +0 -7
- package/models/trace/worker/Processor.js +0 -143
- package/models/trace/worker/Processor.js.map +0 -7
- package/models/trace/worker/Types.js +0 -1
- package/models/trace/worker/Types.js.map +0 -7
- package/models/trace/worker/bundle-tsconfig.json +0 -1
- package/models/trace/worker/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
- package/models/trace/worker/devtools_entrypoint-worker_entrypoint-typescript-tsconfig.json +0 -41
- package/models/trace/worker/processor-tsconfig.json +0 -45
- package/models/trace/worker/worker.js +0 -7
- package/models/trace/worker/worker.js.map +0 -7
- package/models/trace/worker/worker_entrypoint-tsconfig.json +0 -1
- package/models/trace/worker/worker_entrypoint.js +0 -36
- package/models/trace/worker/worker_entrypoint.js.map +0 -7
- package/trace.mjs +0 -6980
- package/trace.mjs.map +0 -8
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as CPUProfile from '../../cpu_profile/cpu_profile.js';
|
|
2
|
+
import * as Helpers from '../helpers/helpers.js';
|
|
3
|
+
import * as Types from '../types/types.js';
|
|
4
|
+
declare const profilesInProcess: Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ThreadID, ProfileData>>;
|
|
5
|
+
declare const entryToNode: Map<Types.TraceEvents.SyntheticTraceEntry, Helpers.TreeHelpers.TraceEntryNode>;
|
|
6
|
+
export declare function reset(): void;
|
|
7
|
+
export declare function initialize(): void;
|
|
8
|
+
export declare function handleEvent(event: Types.TraceEvents.TraceEventData): void;
|
|
9
|
+
export declare function finalize(): Promise<void>;
|
|
10
|
+
export declare function data(): SamplesHandlerData;
|
|
11
|
+
export interface SamplesHandlerData {
|
|
12
|
+
profilesInProcess: typeof profilesInProcess;
|
|
13
|
+
entryToNode: typeof entryToNode;
|
|
14
|
+
}
|
|
15
|
+
export type ProfileData = {
|
|
16
|
+
rawProfile: CPUProfile.CPUProfileDataModel.ExtendedProfile;
|
|
17
|
+
parsedProfile: CPUProfile.CPUProfileDataModel.CPUProfileDataModel;
|
|
18
|
+
/**
|
|
19
|
+
* Contains the calls built from the CPU profile samples.
|
|
20
|
+
* Note: This doesn't contain real trace events coming from the
|
|
21
|
+
* browser, only calls synthetically typed as trace events for
|
|
22
|
+
* compatibility, as such it only makes sense to use them in pure CPU
|
|
23
|
+
* profiles.
|
|
24
|
+
*
|
|
25
|
+
* If you need the profile calls from a CPU profile obtained from a
|
|
26
|
+
* web trace, use the data exported by the RendererHandler instead.
|
|
27
|
+
*/
|
|
28
|
+
profileCalls: Types.TraceEvents.SyntheticProfileCall[];
|
|
29
|
+
/**
|
|
30
|
+
* Contains the call tree built from the CPU profile samples.
|
|
31
|
+
* Similar to the profileCalls field, this tree does not contain nor
|
|
32
|
+
* take into account trace events, as such it only makes sense to use
|
|
33
|
+
* them in pure CPU profiles.
|
|
34
|
+
*/
|
|
35
|
+
profileTree?: Helpers.TreeHelpers.TraceEntryTree;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Returns the name of a function for a given synthetic profile call.
|
|
39
|
+
* We first look to find the ProfileNode representing this call, and use its
|
|
40
|
+
* function name. This is preferred (and should always exist) because if we
|
|
41
|
+
* resolve sourcemaps, we will update this name. If that name is not present,
|
|
42
|
+
* we fall back to the function name that was in the callframe that we got
|
|
43
|
+
* when parsing the profile's trace data.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getProfileCallFunctionName(data: SamplesHandlerData, entry: Types.TraceEvents.SyntheticProfileCall): string;
|
|
46
|
+
export {};
|
|
@@ -1,178 +1,215 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
// Copyright 2022 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 CPUProfile from '../../cpu_profile/cpu_profile.js';
|
|
6
|
+
import * as Helpers from '../helpers/helpers.js';
|
|
7
|
+
import * as Types from '../types/types.js';
|
|
8
|
+
const events = new Map();
|
|
9
|
+
const profilesInProcess = new Map();
|
|
10
|
+
const entryToNode = new Map();
|
|
11
|
+
// The profile head, containing its metadata like its start
|
|
12
|
+
// time, comes in a "Profile" event. The sample data comes in
|
|
13
|
+
// "ProfileChunk" events. We match these ProfileChunks with their head
|
|
14
|
+
// using process and profile ids. However, in order to integrate sample
|
|
15
|
+
// data with trace data, we need the thread id that owns each profile.
|
|
16
|
+
// This thread id is extracted from the head event.
|
|
17
|
+
// For this reason, we have a preprocessed data structure, where events
|
|
18
|
+
// are matched by profile id, which we then finish processing to export
|
|
19
|
+
// events matched by thread id.
|
|
20
|
+
const preprocessedData = new Map();
|
|
21
|
+
let handlerState = 1 /* HandlerState.UNINITIALIZED */;
|
|
11
22
|
function buildProfileCalls() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
for (const [processId, profiles] of preprocessedData) {
|
|
24
|
+
for (const [profileId, preProcessedData] of profiles) {
|
|
25
|
+
const threadId = preProcessedData.threadId;
|
|
26
|
+
if (!preProcessedData.rawProfile.nodes.length || threadId === undefined) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const indexStack = [];
|
|
30
|
+
const profileModel = new CPUProfile.CPUProfileDataModel.CPUProfileDataModel(preProcessedData.rawProfile);
|
|
31
|
+
const profileTree = Helpers.TreeHelpers.makeEmptyTraceEntryTree();
|
|
32
|
+
profileTree.maxDepth = profileModel.maxDepth;
|
|
33
|
+
const finalizedData = { rawProfile: preProcessedData.rawProfile, parsedProfile: profileModel, profileCalls: [], profileTree };
|
|
34
|
+
const dataByThread = Platform.MapUtilities.getWithDefault(profilesInProcess, processId, () => new Map());
|
|
35
|
+
profileModel.forEachFrame(openFrameCallback, closeFrameCallback);
|
|
36
|
+
dataByThread.set(threadId, finalizedData);
|
|
37
|
+
function openFrameCallback(depth, node, timeStampMs) {
|
|
38
|
+
if (threadId === undefined) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const ts = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timeStampMs));
|
|
42
|
+
const nodeId = node.id;
|
|
43
|
+
const profileCall = Helpers.Trace.makeProfileCall(node, ts, processId, threadId);
|
|
44
|
+
finalizedData.profileCalls.push(profileCall);
|
|
45
|
+
indexStack.push(finalizedData.profileCalls.length - 1);
|
|
46
|
+
const traceEntryNode = Helpers.TreeHelpers.makeEmptyTraceEntryNode(profileCall, nodeId);
|
|
47
|
+
entryToNode.set(profileCall, traceEntryNode);
|
|
48
|
+
traceEntryNode.depth = depth;
|
|
49
|
+
if (indexStack.length === 1) {
|
|
50
|
+
// First call in the stack is a root call.
|
|
51
|
+
finalizedData.profileTree?.roots.add(traceEntryNode);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function closeFrameCallback(_depth, node, _timeStamp, durMs, selfTimeMs) {
|
|
55
|
+
const profileCallIndex = indexStack.pop();
|
|
56
|
+
const profileCall = profileCallIndex !== undefined && finalizedData.profileCalls[profileCallIndex];
|
|
57
|
+
if (!profileCall) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const { callFrame, ts, pid, tid } = profileCall;
|
|
61
|
+
const traceEntryNode = entryToNode.get(profileCall);
|
|
62
|
+
if (callFrame === undefined || ts === undefined || pid === undefined || profileId === undefined ||
|
|
63
|
+
tid === undefined || traceEntryNode === undefined) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const dur = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(durMs));
|
|
67
|
+
const selfTime = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(selfTimeMs));
|
|
68
|
+
profileCall.dur = dur;
|
|
69
|
+
profileCall.selfTime = selfTime;
|
|
70
|
+
const parentIndex = indexStack.at(-1);
|
|
71
|
+
const parent = parentIndex !== undefined && finalizedData.profileCalls.at(parentIndex);
|
|
72
|
+
const parentNode = parent && entryToNode.get(parent);
|
|
73
|
+
if (!parentNode) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
traceEntryNode.parent = parentNode;
|
|
77
|
+
parentNode.children.push(traceEntryNode);
|
|
78
|
+
}
|
|
17
79
|
}
|
|
18
|
-
const ts = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timeStampMs));
|
|
19
|
-
const nodeId = node.id;
|
|
20
|
-
const profileCall = Helpers.Trace.makeProfileCall(node, ts, processId, threadId);
|
|
21
|
-
finalizedData.profileCalls.push(profileCall);
|
|
22
|
-
indexStack.push(finalizedData.profileCalls.length - 1);
|
|
23
|
-
const traceEntryNode = Helpers.TreeHelpers.makeEmptyTraceEntryNode(profileCall, nodeId);
|
|
24
|
-
entryToNode.set(profileCall, traceEntryNode);
|
|
25
|
-
traceEntryNode.depth = depth;
|
|
26
|
-
if (indexStack.length === 1) {
|
|
27
|
-
finalizedData.profileTree?.roots.add(traceEntryNode);
|
|
28
|
-
}
|
|
29
|
-
}, closeFrameCallback = function(_depth, node, _timeStamp, durMs, selfTimeMs) {
|
|
30
|
-
const profileCallIndex = indexStack.pop();
|
|
31
|
-
const profileCall = profileCallIndex !== void 0 && finalizedData.profileCalls[profileCallIndex];
|
|
32
|
-
if (!profileCall) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const { callFrame, ts, pid, tid } = profileCall;
|
|
36
|
-
const traceEntryNode = entryToNode.get(profileCall);
|
|
37
|
-
if (callFrame === void 0 || ts === void 0 || pid === void 0 || profileId === void 0 || tid === void 0 || traceEntryNode === void 0) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const dur = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(durMs));
|
|
41
|
-
const selfTime = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(selfTimeMs));
|
|
42
|
-
profileCall.dur = dur;
|
|
43
|
-
profileCall.selfTime = selfTime;
|
|
44
|
-
const parentIndex = indexStack.at(-1);
|
|
45
|
-
const parent = parentIndex !== void 0 && finalizedData.profileCalls.at(parentIndex);
|
|
46
|
-
const parentNode = parent && entryToNode.get(parent);
|
|
47
|
-
if (!parentNode) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
traceEntryNode.parent = parentNode;
|
|
51
|
-
parentNode.children.push(traceEntryNode);
|
|
52
|
-
};
|
|
53
|
-
const threadId = preProcessedData.threadId;
|
|
54
|
-
if (!preProcessedData.rawProfile.nodes.length || threadId === void 0) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
const indexStack = [];
|
|
58
|
-
const profileModel = new CPUProfile.CPUProfileDataModel.CPUProfileDataModel(preProcessedData.rawProfile);
|
|
59
|
-
const profileTree = Helpers.TreeHelpers.makeEmptyTraceEntryTree();
|
|
60
|
-
profileTree.maxDepth = profileModel.maxDepth;
|
|
61
|
-
const finalizedData = { rawProfile: preProcessedData.rawProfile, parsedProfile: profileModel, profileCalls: [], profileTree };
|
|
62
|
-
const dataByThread = Platform.MapUtilities.getWithDefault(profilesInProcess, processId, () => /* @__PURE__ */ new Map());
|
|
63
|
-
profileModel.forEachFrame(openFrameCallback, closeFrameCallback);
|
|
64
|
-
dataByThread.set(threadId, finalizedData);
|
|
65
80
|
}
|
|
66
|
-
}
|
|
67
81
|
}
|
|
68
82
|
export function reset() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
events.clear();
|
|
84
|
+
preprocessedData.clear();
|
|
85
|
+
profilesInProcess.clear();
|
|
86
|
+
entryToNode.clear();
|
|
87
|
+
handlerState = 1 /* HandlerState.UNINITIALIZED */;
|
|
74
88
|
}
|
|
75
89
|
export function initialize() {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
if (handlerState !== 1 /* HandlerState.UNINITIALIZED */) {
|
|
91
|
+
throw new Error('Samples Handler was not reset');
|
|
92
|
+
}
|
|
93
|
+
handlerState = 2 /* HandlerState.INITIALIZED */;
|
|
80
94
|
}
|
|
81
95
|
export function handleEvent(event) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
if (Types.TraceEvents.isSyntheticCpuProfile(event)) {
|
|
86
|
-
const pid = event.pid;
|
|
87
|
-
const tid = event.tid;
|
|
88
|
-
const profileId = "0x1";
|
|
89
|
-
const profileData = getOrCreatePreProcessedData(pid, profileId);
|
|
90
|
-
profileData.rawProfile = event.args.data.cpuProfile;
|
|
91
|
-
profileData.threadId = tid;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (Types.TraceEvents.isTraceEventProfile(event)) {
|
|
95
|
-
const profileData = getOrCreatePreProcessedData(event.pid, event.id);
|
|
96
|
-
profileData.rawProfile.startTime = event.ts;
|
|
97
|
-
profileData.threadId = event.tid;
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (Types.TraceEvents.isTraceEventProfileChunk(event)) {
|
|
101
|
-
const profileData = getOrCreatePreProcessedData(event.pid, event.id);
|
|
102
|
-
const cdpProfile = profileData.rawProfile;
|
|
103
|
-
const nodesAndSamples = event.args?.data?.cpuProfile || { samples: [] };
|
|
104
|
-
const samples = nodesAndSamples?.samples || [];
|
|
105
|
-
const nodes = [];
|
|
106
|
-
for (const n of nodesAndSamples?.nodes || []) {
|
|
107
|
-
const lineNumber = typeof n.callFrame.lineNumber === "undefined" ? -1 : n.callFrame.lineNumber;
|
|
108
|
-
const columnNumber = typeof n.callFrame.columnNumber === "undefined" ? -1 : n.callFrame.columnNumber;
|
|
109
|
-
const scriptId = String(n.callFrame.scriptId);
|
|
110
|
-
const url = n.callFrame.url || "";
|
|
111
|
-
const node = {
|
|
112
|
-
...n,
|
|
113
|
-
callFrame: {
|
|
114
|
-
...n.callFrame,
|
|
115
|
-
url,
|
|
116
|
-
lineNumber,
|
|
117
|
-
columnNumber,
|
|
118
|
-
scriptId
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
nodes.push(node);
|
|
96
|
+
if (handlerState !== 2 /* HandlerState.INITIALIZED */) {
|
|
97
|
+
throw new Error('Samples Handler is not initialized');
|
|
122
98
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
99
|
+
/**
|
|
100
|
+
* A fake trace event created to support CDP.Profiler.Profiles in the
|
|
101
|
+
* trace engine.
|
|
102
|
+
*/
|
|
103
|
+
if (Types.TraceEvents.isSyntheticCpuProfile(event)) {
|
|
104
|
+
// At the moment we are attaching to a single node target so we
|
|
105
|
+
// should only get a single CPU profile. The values of the process
|
|
106
|
+
// id and thread id are not really important, so we use the data
|
|
107
|
+
// in the fake event. Should multi-thread CPU profiling be supported
|
|
108
|
+
// we could use these fields in the event to pass thread info.
|
|
109
|
+
const pid = event.pid;
|
|
110
|
+
const tid = event.tid;
|
|
111
|
+
// Create an arbitrary profile id.
|
|
112
|
+
const profileId = '0x1';
|
|
113
|
+
const profileData = getOrCreatePreProcessedData(pid, profileId);
|
|
114
|
+
profileData.rawProfile = event.args.data.cpuProfile;
|
|
115
|
+
profileData.threadId = tid;
|
|
116
|
+
return;
|
|
132
117
|
}
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
118
|
+
if (Types.TraceEvents.isTraceEventProfile(event)) {
|
|
119
|
+
// Do not use event.args.data.startTime as it is in CLOCK_MONOTONIC domain,
|
|
120
|
+
// but use profileEvent.ts which has been translated to Perfetto's clock
|
|
121
|
+
// domain. Also convert from ms to us.
|
|
122
|
+
// Note: events are collected on a different thread than what's sampled.
|
|
123
|
+
// The correct process and thread ids are specified by the profile.
|
|
124
|
+
const profileData = getOrCreatePreProcessedData(event.pid, event.id);
|
|
125
|
+
profileData.rawProfile.startTime = event.ts;
|
|
126
|
+
profileData.threadId = event.tid;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (Types.TraceEvents.isTraceEventProfileChunk(event)) {
|
|
130
|
+
const profileData = getOrCreatePreProcessedData(event.pid, event.id);
|
|
131
|
+
const cdpProfile = profileData.rawProfile;
|
|
132
|
+
const nodesAndSamples = event.args?.data?.cpuProfile || { samples: [] };
|
|
133
|
+
const samples = nodesAndSamples?.samples || [];
|
|
134
|
+
const nodes = [];
|
|
135
|
+
for (const n of nodesAndSamples?.nodes || []) {
|
|
136
|
+
const lineNumber = typeof n.callFrame.lineNumber === 'undefined' ? -1 : n.callFrame.lineNumber;
|
|
137
|
+
const columnNumber = typeof n.callFrame.columnNumber === 'undefined' ? -1 : n.callFrame.columnNumber;
|
|
138
|
+
const scriptId = String(n.callFrame.scriptId);
|
|
139
|
+
const url = n.callFrame.url || '';
|
|
140
|
+
const node = {
|
|
141
|
+
...n,
|
|
142
|
+
callFrame: {
|
|
143
|
+
...n.callFrame,
|
|
144
|
+
url,
|
|
145
|
+
lineNumber,
|
|
146
|
+
columnNumber,
|
|
147
|
+
scriptId,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
nodes.push(node);
|
|
151
|
+
}
|
|
152
|
+
const timeDeltas = event.args.data?.timeDeltas || [];
|
|
153
|
+
const lines = event.args.data?.lines || Array(samples.length).fill(0);
|
|
154
|
+
cdpProfile.nodes.push(...nodes);
|
|
155
|
+
cdpProfile.samples?.push(...samples);
|
|
156
|
+
cdpProfile.timeDeltas?.push(...timeDeltas);
|
|
157
|
+
cdpProfile.lines?.push(...lines);
|
|
158
|
+
if (cdpProfile.samples && cdpProfile.timeDeltas && cdpProfile.samples.length !== cdpProfile.timeDeltas.length) {
|
|
159
|
+
console.error('Failed to parse CPU profile.');
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!cdpProfile.endTime && cdpProfile.timeDeltas) {
|
|
163
|
+
const timeDeltas = cdpProfile.timeDeltas;
|
|
164
|
+
cdpProfile.endTime = timeDeltas.reduce((x, y) => x + y, cdpProfile.startTime);
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
136
167
|
}
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
168
|
}
|
|
140
169
|
export async function finalize() {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
170
|
+
if (handlerState !== 2 /* HandlerState.INITIALIZED */) {
|
|
171
|
+
throw new Error('Samples Handler is not initialized');
|
|
172
|
+
}
|
|
173
|
+
buildProfileCalls();
|
|
174
|
+
handlerState = 3 /* HandlerState.FINALIZED */;
|
|
146
175
|
}
|
|
147
176
|
export function data() {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
177
|
+
if (handlerState !== 3 /* HandlerState.FINALIZED */) {
|
|
178
|
+
throw new Error('Samples Handler is not finalized');
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
profilesInProcess: new Map(profilesInProcess),
|
|
182
|
+
entryToNode: new Map(entryToNode),
|
|
183
|
+
};
|
|
155
184
|
}
|
|
156
185
|
function getOrCreatePreProcessedData(processId, profileId) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
186
|
+
const profileById = Platform.MapUtilities.getWithDefault(preprocessedData, processId, () => new Map());
|
|
187
|
+
return Platform.MapUtilities.getWithDefault(profileById, profileId, () => ({
|
|
188
|
+
rawProfile: {
|
|
189
|
+
startTime: 0,
|
|
190
|
+
endTime: 0,
|
|
191
|
+
nodes: [],
|
|
192
|
+
samples: [],
|
|
193
|
+
timeDeltas: [],
|
|
194
|
+
lines: [],
|
|
195
|
+
},
|
|
196
|
+
profileId,
|
|
197
|
+
}));
|
|
169
198
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Returns the name of a function for a given synthetic profile call.
|
|
201
|
+
* We first look to find the ProfileNode representing this call, and use its
|
|
202
|
+
* function name. This is preferred (and should always exist) because if we
|
|
203
|
+
* resolve sourcemaps, we will update this name. If that name is not present,
|
|
204
|
+
* we fall back to the function name that was in the callframe that we got
|
|
205
|
+
* when parsing the profile's trace data.
|
|
206
|
+
*/
|
|
207
|
+
export function getProfileCallFunctionName(data, entry) {
|
|
208
|
+
const profile = data.profilesInProcess.get(entry.pid)?.get(entry.tid);
|
|
209
|
+
const node = profile?.parsedProfile.nodeById(entry.nodeId);
|
|
210
|
+
if (node?.functionName) {
|
|
211
|
+
return node.functionName;
|
|
212
|
+
}
|
|
213
|
+
return entry.callFrame.functionName;
|
|
177
214
|
}
|
|
178
|
-
//# sourceMappingURL=SamplesHandler.js.map
|
|
215
|
+
//# sourceMappingURL=SamplesHandler.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../../front_end/models/trace/handlers/SamplesHandler.ts"],
|
|
4
|
-
"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\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as CPUProfile from '../../cpu_profile/cpu_profile.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {HandlerState} from './types.js';\n\nconst events =\n new Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ThreadID, Types.TraceEvents.TraceEventComplete[]>>();\n\nconst profilesInProcess = new Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ThreadID, ProfileData>>();\nconst entryToNode = new Map<Types.TraceEvents.SyntheticTraceEntry, Helpers.TreeHelpers.TraceEntryNode>();\n\n// The profile head, containing its metadata like its start\n// time, comes in a \"Profile\" event. The sample data comes in\n// \"ProfileChunk\" events. We match these ProfileChunks with their head\n// using process and profile ids. However, in order to integrate sample\n// data with trace data, we need the thread id that owns each profile.\n// This thread id is extracted from the head event.\n// For this reason, we have a preprocessed data structure, where events\n// are matched by profile id, which we then finish processing to export\n// events matched by thread id.\nconst preprocessedData = new Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ProfileID, PreprocessedData>>();\n\nlet handlerState = HandlerState.UNINITIALIZED;\n\nfunction buildProfileCalls(): void {\n for (const [processId, profiles] of preprocessedData) {\n for (const [profileId, preProcessedData] of profiles) {\n const threadId = preProcessedData.threadId;\n if (!preProcessedData.rawProfile.nodes.length || threadId === undefined) {\n continue;\n }\n const indexStack: number[] = [];\n\n const profileModel = new CPUProfile.CPUProfileDataModel.CPUProfileDataModel(preProcessedData.rawProfile);\n const profileTree = Helpers.TreeHelpers.makeEmptyTraceEntryTree();\n profileTree.maxDepth = profileModel.maxDepth;\n\n const finalizedData: ProfileData =\n {rawProfile: preProcessedData.rawProfile, parsedProfile: profileModel, profileCalls: [], profileTree};\n\n const dataByThread = Platform.MapUtilities.getWithDefault(profilesInProcess, processId, () => new Map());\n profileModel.forEachFrame(openFrameCallback, closeFrameCallback);\n dataByThread.set(threadId, finalizedData);\n\n function openFrameCallback(\n depth: number, node: CPUProfile.ProfileTreeModel.ProfileNode, timeStampMs: number): void {\n if (threadId === undefined) {\n return;\n }\n const ts = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timeStampMs));\n const nodeId = node.id as Helpers.TreeHelpers.TraceEntryNodeId;\n\n const profileCall = Helpers.Trace.makeProfileCall(node, ts, processId, threadId);\n finalizedData.profileCalls.push(profileCall);\n indexStack.push(finalizedData.profileCalls.length - 1);\n const traceEntryNode = Helpers.TreeHelpers.makeEmptyTraceEntryNode(profileCall, nodeId);\n entryToNode.set(profileCall, traceEntryNode);\n traceEntryNode.depth = depth;\n if (indexStack.length === 1) {\n // First call in the stack is a root call.\n finalizedData.profileTree?.roots.add(traceEntryNode);\n }\n }\n function closeFrameCallback(\n _depth: number, node: CPUProfile.ProfileTreeModel.ProfileNode, _timeStamp: number, durMs: number,\n selfTimeMs: number): void {\n const profileCallIndex = indexStack.pop();\n const profileCall = profileCallIndex !== undefined && finalizedData.profileCalls[profileCallIndex];\n if (!profileCall) {\n return;\n }\n const {callFrame, ts, pid, tid} = profileCall;\n const traceEntryNode = entryToNode.get(profileCall);\n if (callFrame === undefined || ts === undefined || pid === undefined || profileId === undefined ||\n tid === undefined || traceEntryNode === undefined) {\n return;\n }\n const dur = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(durMs));\n const selfTime = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(selfTimeMs));\n profileCall.dur = dur;\n profileCall.selfTime = selfTime;\n\n const parentIndex = indexStack.at(-1);\n const parent = parentIndex !== undefined && finalizedData.profileCalls.at(parentIndex);\n const parentNode = parent && entryToNode.get(parent);\n if (!parentNode) {\n return;\n }\n traceEntryNode.parent = parentNode;\n parentNode.children.push(traceEntryNode);\n }\n }\n }\n}\n\nexport function reset(): void {\n events.clear();\n preprocessedData.clear();\n profilesInProcess.clear();\n entryToNode.clear();\n handlerState = HandlerState.UNINITIALIZED;\n}\n\nexport function initialize(): void {\n if (handlerState !== HandlerState.UNINITIALIZED) {\n throw new Error('Samples Handler was not reset');\n }\n\n handlerState = HandlerState.INITIALIZED;\n}\n\nexport function handleEvent(event: Types.TraceEvents.TraceEventData): void {\n if (handlerState !== HandlerState.INITIALIZED) {\n throw new Error('Samples Handler is not initialized');\n }\n\n /**\n * A fake trace event created to support CDP.Profiler.Profiles in the\n * trace engine.\n */\n if (Types.TraceEvents.isSyntheticCpuProfile(event)) {\n // At the moment we are attaching to a single node target so we\n // should only get a single CPU profile. The values of the process\n // id and thread id are not really important, so we use the data\n // in the fake event. Should multi-thread CPU profiling be supported\n // we could use these fields in the event to pass thread info.\n const pid = event.pid;\n const tid = event.tid;\n // Create an arbitrary profile id.\n const profileId = '0x1' as Types.TraceEvents.ProfileID;\n const profileData = getOrCreatePreProcessedData(pid, profileId);\n profileData.rawProfile = event.args.data.cpuProfile;\n profileData.threadId = tid;\n return;\n }\n\n if (Types.TraceEvents.isTraceEventProfile(event)) {\n // Do not use event.args.data.startTime as it is in CLOCK_MONOTONIC domain,\n // but use profileEvent.ts which has been translated to Perfetto's clock\n // domain. Also convert from ms to us.\n // Note: events are collected on a different thread than what's sampled.\n // The correct process and thread ids are specified by the profile.\n const profileData = getOrCreatePreProcessedData(event.pid, event.id);\n profileData.rawProfile.startTime = event.ts;\n profileData.threadId = event.tid;\n return;\n }\n if (Types.TraceEvents.isTraceEventProfileChunk(event)) {\n const profileData = getOrCreatePreProcessedData(event.pid, event.id);\n const cdpProfile = profileData.rawProfile;\n const nodesAndSamples: Types.TraceEvents.TraceEventPartialProfile|undefined =\n event.args?.data?.cpuProfile || {samples: []};\n const samples = nodesAndSamples?.samples || [];\n const nodes: CPUProfile.CPUProfileDataModel.ExtendedProfileNode[] = [];\n for (const n of nodesAndSamples?.nodes || []) {\n const lineNumber = typeof n.callFrame.lineNumber === 'undefined' ? -1 : n.callFrame.lineNumber;\n const columnNumber = typeof n.callFrame.columnNumber === 'undefined' ? -1 : n.callFrame.columnNumber;\n\n const scriptId = String(n.callFrame.scriptId) as Protocol.Runtime.ScriptId;\n const url = n.callFrame.url || '';\n const node = {\n ...n,\n callFrame: {\n ...n.callFrame,\n url,\n lineNumber,\n columnNumber,\n scriptId,\n },\n };\n nodes.push(node);\n }\n\n const timeDeltas = event.args.data?.timeDeltas || [];\n const lines = event.args.data?.lines || Array(samples.length).fill(0);\n cdpProfile.nodes.push(...nodes);\n cdpProfile.samples?.push(...samples);\n cdpProfile.timeDeltas?.push(...timeDeltas);\n cdpProfile.lines?.push(...lines);\n if (cdpProfile.samples && cdpProfile.timeDeltas && cdpProfile.samples.length !== cdpProfile.timeDeltas.length) {\n console.error('Failed to parse CPU profile.');\n return;\n }\n if (!cdpProfile.endTime && cdpProfile.timeDeltas) {\n const timeDeltas: number[] = cdpProfile.timeDeltas;\n cdpProfile.endTime = timeDeltas.reduce((x, y) => x + y, cdpProfile.startTime);\n }\n return;\n }\n}\n\nexport async function finalize(): Promise<void> {\n if (handlerState !== HandlerState.INITIALIZED) {\n throw new Error('Samples Handler is not initialized');\n }\n buildProfileCalls();\n\n handlerState = HandlerState.FINALIZED;\n}\n\nexport function data(): SamplesHandlerData {\n if (handlerState !== HandlerState.FINALIZED) {\n throw new Error('Samples Handler is not finalized');\n }\n\n return {\n profilesInProcess: new Map(profilesInProcess),\n entryToNode: new Map(entryToNode),\n };\n}\n\nfunction getOrCreatePreProcessedData(\n processId: Types.TraceEvents.ProcessID, profileId: Types.TraceEvents.ProfileID): PreprocessedData {\n const profileById = Platform.MapUtilities.getWithDefault(preprocessedData, processId, () => new Map());\n return Platform.MapUtilities.getWithDefault<Types.TraceEvents.ProfileID, PreprocessedData>(\n profileById, profileId, () => ({\n rawProfile: {\n startTime: 0,\n endTime: 0,\n nodes: [],\n samples: [],\n timeDeltas: [],\n lines: [],\n },\n profileId,\n }));\n}\n\nexport interface SamplesHandlerData {\n profilesInProcess: typeof profilesInProcess;\n entryToNode: typeof entryToNode;\n}\n\nexport type ProfileData = {\n rawProfile: CPUProfile.CPUProfileDataModel.ExtendedProfile,\n parsedProfile: CPUProfile.CPUProfileDataModel.CPUProfileDataModel,\n /**\n * Contains the calls built from the CPU profile samples.\n * Note: This doesn't contain real trace events coming from the\n * browser, only calls synthetically typed as trace events for\n * compatibility, as such it only makes sense to use them in pure CPU\n * profiles.\n *\n * If you need the profile calls from a CPU profile obtained from a\n * web trace, use the data exported by the RendererHandler instead.\n */\n profileCalls: Types.TraceEvents.SyntheticProfileCall[],\n /**\n * Contains the call tree built from the CPU profile samples.\n * Similar to the profileCalls field, this tree does not contain nor\n * take into account trace events, as such it only makes sense to use\n * them in pure CPU profiles.\n */\n profileTree?: Helpers.TreeHelpers.TraceEntryTree,\n};\n\ntype PreprocessedData = {\n rawProfile: CPUProfile.CPUProfileDataModel.ExtendedProfile,\n threadId?: Types.TraceEvents.ThreadID, profileId: Types.TraceEvents.ProfileID,\n};\n\n/**\n * Returns the name of a function for a given synthetic profile call.\n * We first look to find the ProfileNode representing this call, and use its\n * function name. This is preferred (and should always exist) because if we\n * resolve sourcemaps, we will update this name. If that name is not present,\n * we fall back to the function name that was in the callframe that we got\n * when parsing the profile's trace data.\n */\nexport function getProfileCallFunctionName(\n data: SamplesHandlerData, entry: Types.TraceEvents.SyntheticProfileCall): string {\n const profile = data.profilesInProcess.get(entry.pid)?.get(entry.tid);\n const node = profile?.parsedProfile.nodeById(entry.nodeId);\n if (node?.functionName) {\n return node.functionName;\n }\n return entry.callFrame.functionName;\n}\n"],
|
|
5
|
-
"mappings": "AAIA;AAEA;AACA;AACA;AAEA;AAEA,MAAM,SACF,oBAAI;AAER,MAAM,oBAAoB,oBAAI;AAC9B,MAAM,cAAc,oBAAI;AAWxB,MAAM,mBAAmB,oBAAI;AAE7B,IAAI,eAAe,aAAa;AAEhC,6BAAmC;AACjC,aAAW,CAAC,WAAW,aAAa,kBAAkB;AACpD,eAAW,CAAC,WAAW,qBAAqB,UAAU;AAkBpD,UAAS,oBAAT,SACI,OAAe,MAA+C,aAA2B;A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,aAAa,eACzB,aAAa,WAAW,MAAO;AAAA,IACL,YAAY;AAAA,MACV,WAAW;AAAA,MACX,SAAS;AAAA,MACT,OAAO;AAAA,MACP,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,OAAO;AAAA;AAAA,IAET;AAAA;AAAA;AA6CzB,2CACH,OAA0B,OAAuD;AACnF,QAAM,UAAU,MAAK,kBAAkB,IAAI,MAAM,MAAM,IAAI,MAAM;AACjE,QAAM,OAAO,SAAS,cAAc,SAAS,MAAM;AACnD,MAAI,MAAM,cAAc;AACtB,WAAO,KAAK;AAAA;AAEd,SAAO,MAAM,UAAU;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"SamplesHandler.js","sourceRoot":"","sources":["../../../../../../../front_end/models/trace/handlers/SamplesHandler.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAI3C,MAAM,MAAM,GACR,IAAI,GAAG,EAAwG,CAAC;AAEpH,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA6E,CAAC;AAC/G,MAAM,WAAW,GAAG,IAAI,GAAG,EAA6E,CAAC;AAEzG,2DAA2D;AAC3D,6DAA6D;AAC7D,sEAAsE;AACtE,uEAAuE;AACvE,sEAAsE;AACtE,mDAAmD;AACnD,uEAAuE;AACvE,uEAAuE;AACvE,+BAA+B;AAC/B,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAmF,CAAC;AAEpH,IAAI,YAAY,qCAA6B,CAAC;AAE9C,SAAS,iBAAiB;IACxB,KAAK,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,gBAAgB,EAAE;QACpD,KAAK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AY,CAAC,cAAc,CACvC,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;QACL,UAAU,EAAE;YACV,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,CAAC;YACV,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,EAAE;YACX,UAAU,EAAE,EAAE;YACd,KAAK,EAAE,EAAE;SACV;QACD,SAAS;KACV,CAAC,CAAC,CAAC;AAClC,CAAC;AAmCD;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACtC,IAAwB,EAAE,KAA6C;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,IAAI,EAAE,YAAY,EAAE;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC;KAC1B;IACD,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC;AACtC,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\nimport * as Platform from '../../../core/platform/platform.js';\nimport type * as Protocol from '../../../generated/protocol.js';\nimport * as CPUProfile from '../../cpu_profile/cpu_profile.js';\nimport * as Helpers from '../helpers/helpers.js';\nimport * as Types from '../types/types.js';\n\nimport {HandlerState} from './types.js';\n\nconst events =\n new Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ThreadID, Types.TraceEvents.TraceEventComplete[]>>();\n\nconst profilesInProcess = new Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ThreadID, ProfileData>>();\nconst entryToNode = new Map<Types.TraceEvents.SyntheticTraceEntry, Helpers.TreeHelpers.TraceEntryNode>();\n\n// The profile head, containing its metadata like its start\n// time, comes in a \"Profile\" event. The sample data comes in\n// \"ProfileChunk\" events. We match these ProfileChunks with their head\n// using process and profile ids. However, in order to integrate sample\n// data with trace data, we need the thread id that owns each profile.\n// This thread id is extracted from the head event.\n// For this reason, we have a preprocessed data structure, where events\n// are matched by profile id, which we then finish processing to export\n// events matched by thread id.\nconst preprocessedData = new Map<Types.TraceEvents.ProcessID, Map<Types.TraceEvents.ProfileID, PreprocessedData>>();\n\nlet handlerState = HandlerState.UNINITIALIZED;\n\nfunction buildProfileCalls(): void {\n for (const [processId, profiles] of preprocessedData) {\n for (const [profileId, preProcessedData] of profiles) {\n const threadId = preProcessedData.threadId;\n if (!preProcessedData.rawProfile.nodes.length || threadId === undefined) {\n continue;\n }\n const indexStack: number[] = [];\n\n const profileModel = new CPUProfile.CPUProfileDataModel.CPUProfileDataModel(preProcessedData.rawProfile);\n const profileTree = Helpers.TreeHelpers.makeEmptyTraceEntryTree();\n profileTree.maxDepth = profileModel.maxDepth;\n\n const finalizedData: ProfileData =\n {rawProfile: preProcessedData.rawProfile, parsedProfile: profileModel, profileCalls: [], profileTree};\n\n const dataByThread = Platform.MapUtilities.getWithDefault(profilesInProcess, processId, () => new Map());\n profileModel.forEachFrame(openFrameCallback, closeFrameCallback);\n dataByThread.set(threadId, finalizedData);\n\n function openFrameCallback(\n depth: number, node: CPUProfile.ProfileTreeModel.ProfileNode, timeStampMs: number): void {\n if (threadId === undefined) {\n return;\n }\n const ts = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(timeStampMs));\n const nodeId = node.id as Helpers.TreeHelpers.TraceEntryNodeId;\n\n const profileCall = Helpers.Trace.makeProfileCall(node, ts, processId, threadId);\n finalizedData.profileCalls.push(profileCall);\n indexStack.push(finalizedData.profileCalls.length - 1);\n const traceEntryNode = Helpers.TreeHelpers.makeEmptyTraceEntryNode(profileCall, nodeId);\n entryToNode.set(profileCall, traceEntryNode);\n traceEntryNode.depth = depth;\n if (indexStack.length === 1) {\n // First call in the stack is a root call.\n finalizedData.profileTree?.roots.add(traceEntryNode);\n }\n }\n function closeFrameCallback(\n _depth: number, node: CPUProfile.ProfileTreeModel.ProfileNode, _timeStamp: number, durMs: number,\n selfTimeMs: number): void {\n const profileCallIndex = indexStack.pop();\n const profileCall = profileCallIndex !== undefined && finalizedData.profileCalls[profileCallIndex];\n if (!profileCall) {\n return;\n }\n const {callFrame, ts, pid, tid} = profileCall;\n const traceEntryNode = entryToNode.get(profileCall);\n if (callFrame === undefined || ts === undefined || pid === undefined || profileId === undefined ||\n tid === undefined || traceEntryNode === undefined) {\n return;\n }\n const dur = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(durMs));\n const selfTime = Helpers.Timing.millisecondsToMicroseconds(Types.Timing.MilliSeconds(selfTimeMs));\n profileCall.dur = dur;\n profileCall.selfTime = selfTime;\n\n const parentIndex = indexStack.at(-1);\n const parent = parentIndex !== undefined && finalizedData.profileCalls.at(parentIndex);\n const parentNode = parent && entryToNode.get(parent);\n if (!parentNode) {\n return;\n }\n traceEntryNode.parent = parentNode;\n parentNode.children.push(traceEntryNode);\n }\n }\n }\n}\n\nexport function reset(): void {\n events.clear();\n preprocessedData.clear();\n profilesInProcess.clear();\n entryToNode.clear();\n handlerState = HandlerState.UNINITIALIZED;\n}\n\nexport function initialize(): void {\n if (handlerState !== HandlerState.UNINITIALIZED) {\n throw new Error('Samples Handler was not reset');\n }\n\n handlerState = HandlerState.INITIALIZED;\n}\n\nexport function handleEvent(event: Types.TraceEvents.TraceEventData): void {\n if (handlerState !== HandlerState.INITIALIZED) {\n throw new Error('Samples Handler is not initialized');\n }\n\n /**\n * A fake trace event created to support CDP.Profiler.Profiles in the\n * trace engine.\n */\n if (Types.TraceEvents.isSyntheticCpuProfile(event)) {\n // At the moment we are attaching to a single node target so we\n // should only get a single CPU profile. The values of the process\n // id and thread id are not really important, so we use the data\n // in the fake event. Should multi-thread CPU profiling be supported\n // we could use these fields in the event to pass thread info.\n const pid = event.pid;\n const tid = event.tid;\n // Create an arbitrary profile id.\n const profileId = '0x1' as Types.TraceEvents.ProfileID;\n const profileData = getOrCreatePreProcessedData(pid, profileId);\n profileData.rawProfile = event.args.data.cpuProfile;\n profileData.threadId = tid;\n return;\n }\n\n if (Types.TraceEvents.isTraceEventProfile(event)) {\n // Do not use event.args.data.startTime as it is in CLOCK_MONOTONIC domain,\n // but use profileEvent.ts which has been translated to Perfetto's clock\n // domain. Also convert from ms to us.\n // Note: events are collected on a different thread than what's sampled.\n // The correct process and thread ids are specified by the profile.\n const profileData = getOrCreatePreProcessedData(event.pid, event.id);\n profileData.rawProfile.startTime = event.ts;\n profileData.threadId = event.tid;\n return;\n }\n if (Types.TraceEvents.isTraceEventProfileChunk(event)) {\n const profileData = getOrCreatePreProcessedData(event.pid, event.id);\n const cdpProfile = profileData.rawProfile;\n const nodesAndSamples: Types.TraceEvents.TraceEventPartialProfile|undefined =\n event.args?.data?.cpuProfile || {samples: []};\n const samples = nodesAndSamples?.samples || [];\n const nodes: CPUProfile.CPUProfileDataModel.ExtendedProfileNode[] = [];\n for (const n of nodesAndSamples?.nodes || []) {\n const lineNumber = typeof n.callFrame.lineNumber === 'undefined' ? -1 : n.callFrame.lineNumber;\n const columnNumber = typeof n.callFrame.columnNumber === 'undefined' ? -1 : n.callFrame.columnNumber;\n\n const scriptId = String(n.callFrame.scriptId) as Protocol.Runtime.ScriptId;\n const url = n.callFrame.url || '';\n const node = {\n ...n,\n callFrame: {\n ...n.callFrame,\n url,\n lineNumber,\n columnNumber,\n scriptId,\n },\n };\n nodes.push(node);\n }\n\n const timeDeltas = event.args.data?.timeDeltas || [];\n const lines = event.args.data?.lines || Array(samples.length).fill(0);\n cdpProfile.nodes.push(...nodes);\n cdpProfile.samples?.push(...samples);\n cdpProfile.timeDeltas?.push(...timeDeltas);\n cdpProfile.lines?.push(...lines);\n if (cdpProfile.samples && cdpProfile.timeDeltas && cdpProfile.samples.length !== cdpProfile.timeDeltas.length) {\n console.error('Failed to parse CPU profile.');\n return;\n }\n if (!cdpProfile.endTime && cdpProfile.timeDeltas) {\n const timeDeltas: number[] = cdpProfile.timeDeltas;\n cdpProfile.endTime = timeDeltas.reduce((x, y) => x + y, cdpProfile.startTime);\n }\n return;\n }\n}\n\nexport async function finalize(): Promise<void> {\n if (handlerState !== HandlerState.INITIALIZED) {\n throw new Error('Samples Handler is not initialized');\n }\n buildProfileCalls();\n\n handlerState = HandlerState.FINALIZED;\n}\n\nexport function data(): SamplesHandlerData {\n if (handlerState !== HandlerState.FINALIZED) {\n throw new Error('Samples Handler is not finalized');\n }\n\n return {\n profilesInProcess: new Map(profilesInProcess),\n entryToNode: new Map(entryToNode),\n };\n}\n\nfunction getOrCreatePreProcessedData(\n processId: Types.TraceEvents.ProcessID, profileId: Types.TraceEvents.ProfileID): PreprocessedData {\n const profileById = Platform.MapUtilities.getWithDefault(preprocessedData, processId, () => new Map());\n return Platform.MapUtilities.getWithDefault<Types.TraceEvents.ProfileID, PreprocessedData>(\n profileById, profileId, () => ({\n rawProfile: {\n startTime: 0,\n endTime: 0,\n nodes: [],\n samples: [],\n timeDeltas: [],\n lines: [],\n },\n profileId,\n }));\n}\n\nexport interface SamplesHandlerData {\n profilesInProcess: typeof profilesInProcess;\n entryToNode: typeof entryToNode;\n}\n\nexport type ProfileData = {\n rawProfile: CPUProfile.CPUProfileDataModel.ExtendedProfile,\n parsedProfile: CPUProfile.CPUProfileDataModel.CPUProfileDataModel,\n /**\n * Contains the calls built from the CPU profile samples.\n * Note: This doesn't contain real trace events coming from the\n * browser, only calls synthetically typed as trace events for\n * compatibility, as such it only makes sense to use them in pure CPU\n * profiles.\n *\n * If you need the profile calls from a CPU profile obtained from a\n * web trace, use the data exported by the RendererHandler instead.\n */\n profileCalls: Types.TraceEvents.SyntheticProfileCall[],\n /**\n * Contains the call tree built from the CPU profile samples.\n * Similar to the profileCalls field, this tree does not contain nor\n * take into account trace events, as such it only makes sense to use\n * them in pure CPU profiles.\n */\n profileTree?: Helpers.TreeHelpers.TraceEntryTree,\n};\n\ntype PreprocessedData = {\n rawProfile: CPUProfile.CPUProfileDataModel.ExtendedProfile,\n threadId?: Types.TraceEvents.ThreadID, profileId: Types.TraceEvents.ProfileID,\n};\n\n/**\n * Returns the name of a function for a given synthetic profile call.\n * We first look to find the ProfileNode representing this call, and use its\n * function name. This is preferred (and should always exist) because if we\n * resolve sourcemaps, we will update this name. If that name is not present,\n * we fall back to the function name that was in the callframe that we got\n * when parsing the profile's trace data.\n */\nexport function getProfileCallFunctionName(\n data: SamplesHandlerData, entry: Types.TraceEvents.SyntheticProfileCall): string {\n const profile = data.profilesInProcess.get(entry.pid)?.get(entry.tid);\n const node = profile?.parsedProfile.nodeById(entry.nodeId);\n if (node?.functionName) {\n return node.functionName;\n }\n return entry.callFrame.functionName;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Types from '../types/types.js';
|
|
2
|
+
import { type TraceEventHandlerName } from './types.js';
|
|
3
|
+
export declare function reset(): void;
|
|
4
|
+
export declare function handleEvent(event: Types.TraceEvents.TraceEventData): void;
|
|
5
|
+
export declare function finalize(): Promise<void>;
|
|
6
|
+
export declare function data(): Types.TraceEvents.SyntheticScreenshot[];
|
|
7
|
+
export declare function deps(): TraceEventHandlerName[];
|
|
@@ -1,57 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Copyright 2022 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 Helpers from '../helpers/helpers.js';
|
|
5
|
+
import * as Types from '../types/types.js';
|
|
6
|
+
// Each thread contains events. Events indicate the thread and process IDs, which are
|
|
7
|
+
// used to store the event in the correct process thread entry below.
|
|
3
8
|
const unpairedAsyncEvents = [];
|
|
4
9
|
const snapshotEvents = [];
|
|
5
10
|
const syntheticScreenshotEvents = [];
|
|
6
11
|
let frameSequenceToTs = {};
|
|
7
12
|
export function reset() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
unpairedAsyncEvents.length = 0;
|
|
14
|
+
snapshotEvents.length = 0;
|
|
15
|
+
syntheticScreenshotEvents.length = 0;
|
|
16
|
+
frameSequenceToTs = {};
|
|
12
17
|
}
|
|
13
18
|
export function handleEvent(event) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
if (Types.TraceEvents.isTraceEventScreenshot(event)) {
|
|
20
|
+
snapshotEvents.push(event);
|
|
21
|
+
}
|
|
22
|
+
else if (Types.TraceEvents.isTraceEventPipelineReporter(event)) {
|
|
23
|
+
unpairedAsyncEvents.push(event);
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
export async function finalize() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
const pipelineReporterEvents = Helpers.Trace.createMatchedSortedSyntheticEvents(unpairedAsyncEvents);
|
|
28
|
+
frameSequenceToTs = Object.fromEntries(pipelineReporterEvents.map(evt => {
|
|
29
|
+
const frameSequenceId = evt.args.data.beginEvent.args.chrome_frame_reporter.frame_sequence;
|
|
30
|
+
const presentationTs = Types.Timing.MicroSeconds(evt.ts + evt.dur);
|
|
31
|
+
return [frameSequenceId, presentationTs];
|
|
32
|
+
}));
|
|
33
|
+
for (const snapshotEvent of snapshotEvents) {
|
|
34
|
+
const { cat, name, ph, pid, tid } = snapshotEvent;
|
|
35
|
+
const syntheticEvent = {
|
|
36
|
+
cat,
|
|
37
|
+
name,
|
|
38
|
+
ph,
|
|
39
|
+
pid,
|
|
40
|
+
tid,
|
|
41
|
+
// `getPresentationTimestamp(snapshotEvent) - snapshotEvent.ts` is how many microsec the screenshot was adjusted to the right/later
|
|
42
|
+
ts: getPresentationTimestamp(snapshotEvent),
|
|
43
|
+
args: {
|
|
44
|
+
dataUri: `data:image/jpg;base64,${snapshotEvent.args.snapshot}`,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
syntheticScreenshotEvents.push(syntheticEvent);
|
|
48
|
+
}
|
|
42
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Correct the screenshot timestamps
|
|
52
|
+
* The screenshot 'snapshot object' trace event has the "frame sequence number" attached as an ID.
|
|
53
|
+
* We match that up with the "PipelineReporter" trace events as they terminate at presentation.
|
|
54
|
+
* Presentation == when the pixels hit the screen. AKA Swap on the GPU
|
|
55
|
+
*/
|
|
43
56
|
function getPresentationTimestamp(screenshotEvent) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
const frameSequence = parseInt(screenshotEvent.id, 16);
|
|
58
|
+
// If it's 1, then it's an old trace (before https://crrev.com/c/4957973) and cannot be corrected.
|
|
59
|
+
if (frameSequence === 1) {
|
|
60
|
+
return screenshotEvent.ts;
|
|
61
|
+
}
|
|
62
|
+
// The screenshot trace event's `ts` reflects the "expected display time" which is ESTIMATE.
|
|
63
|
+
// It is set by the compositor frame sink from the `expected_display_time`, which is based on a previously known
|
|
64
|
+
// frame start PLUS the vsync interval (eg 16.6ms)
|
|
65
|
+
const updatedTs = frameSequenceToTs[frameSequence];
|
|
66
|
+
// Do we always find a match? No...
|
|
67
|
+
// We generally don't match the very first screenshot and, sometimes, the last
|
|
68
|
+
// The very first screenshot is requested immediately (even if nothing is painting). As a result there's no compositor
|
|
69
|
+
// instrumentation running alongside.
|
|
70
|
+
// The last one is sometimes missing as because the trace terminates right before the associated PipelineReporter is emitted.
|
|
71
|
+
return updatedTs ?? screenshotEvent.ts;
|
|
50
72
|
}
|
|
51
73
|
export function data() {
|
|
52
|
-
|
|
74
|
+
return [...syntheticScreenshotEvents];
|
|
53
75
|
}
|
|
54
76
|
export function deps() {
|
|
55
|
-
|
|
77
|
+
return ['Meta'];
|
|
56
78
|
}
|
|
57
|
-
//# sourceMappingURL=ScreenshotsHandler.js.map
|
|
79
|
+
//# sourceMappingURL=ScreenshotsHandler.js.map
|