@paulirish/trace_engine
Advanced tools
Comparing version
@@ -45,2 +45,3 @@ { | ||
"../../../../../../front_end/core/platform/Timing.ts", | ||
"../../../../../../front_end/core/platform/TypedArrayUtilities.ts", | ||
"../../../../../../front_end/core/platform/TypescriptUtilities.ts", | ||
@@ -47,0 +48,0 @@ "../../../../../../front_end/core/platform/UIString.ts", |
@@ -14,2 +14,3 @@ import * as ArrayUtilities from './ArrayUtilities.js'; | ||
import * as Timing from './Timing.js'; | ||
import * as TypedArrayUtilities from './TypedArrayUtilities.js'; | ||
import * as TypeScriptUtilities from './TypescriptUtilities.js'; | ||
@@ -19,2 +20,2 @@ import * as UIString from './UIString.js'; | ||
export { assertNever, assertNotNullOrUndefined, assertUnhandled } from './TypescriptUtilities.js'; | ||
export { ArrayUtilities, Brand, DateUtilities, DevToolsPath, DOMUtilities, KeyboardUtilities, MapUtilities, MimeType, NumberUtilities, PromiseUtilities, SetUtilities, StringUtilities, Timing, TypeScriptUtilities, UIString, UserVisibleError, }; | ||
export { ArrayUtilities, Brand, DateUtilities, DevToolsPath, DOMUtilities, KeyboardUtilities, MapUtilities, MimeType, NumberUtilities, PromiseUtilities, SetUtilities, StringUtilities, Timing, TypedArrayUtilities, TypeScriptUtilities, UIString, UserVisibleError, }; |
@@ -43,2 +43,3 @@ /* | ||
import * as Timing from './Timing.js'; | ||
import * as TypedArrayUtilities from './TypedArrayUtilities.js'; | ||
import * as TypeScriptUtilities from './TypescriptUtilities.js'; | ||
@@ -53,3 +54,3 @@ import * as UIString from './UIString.js'; | ||
export { assertNever, assertNotNullOrUndefined, assertUnhandled } from './TypescriptUtilities.js'; | ||
export { ArrayUtilities, Brand, DateUtilities, DevToolsPath, DOMUtilities, KeyboardUtilities, MapUtilities, MimeType, NumberUtilities, PromiseUtilities, SetUtilities, StringUtilities, Timing, TypeScriptUtilities, UIString, UserVisibleError, }; | ||
export { ArrayUtilities, Brand, DateUtilities, DevToolsPath, DOMUtilities, KeyboardUtilities, MapUtilities, MimeType, NumberUtilities, PromiseUtilities, SetUtilities, StringUtilities, Timing, TypedArrayUtilities, TypeScriptUtilities, UIString, UserVisibleError, }; | ||
//# sourceMappingURL=platform.js.map |
@@ -461,4 +461,4 @@ // Copyright (c) 2020 The Chromium Authors. All rights reserved. | ||
}; | ||
const WORD = /[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b|_)|[A-Za-z][0-9]+[a-z]|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g; | ||
// <---1---><------------2-----------> <--------3--------> <-----4----> <------5-----> <-----6----> <7> | ||
const WORD = /[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b|_)|[A-Za-z][0-9]+[a-z]?|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g; | ||
// <---1---><------------2-----------> <---------3--------> <-----4----> <------5-----> <-----6----> <7> | ||
// 1: two or more consecutive uppercase letters. This is useful for identifying acronyms | ||
@@ -474,3 +474,3 @@ // 2: lookahead assertion that matches a word boundary | ||
// correctly without making the RegExp prohibitively complicated. | ||
// https://regex101.com/r/Plutm2/1 | ||
// https://regex101.com/r/FhMVKc/1 | ||
export const toKebabCase = function (input) { | ||
@@ -477,0 +477,0 @@ return (input.match?.(WORD)?.map(w => w.toLowerCase()).join('-').replaceAll('-.-', '.') || input); |
@@ -49,5 +49,6 @@ import * as Helpers from './helpers/helpers.js'; | ||
/** | ||
* Sets invisible entries. Called when a trace with annotations is loaded and some entries are set as hidden. | ||
* Sets invisible and modified entries. Called when a trace with annotations is loaded and some entries are set as hidden and modified. | ||
* Both arrays are set together because if there is one, the other must be present too. | ||
**/ | ||
setInvisibleEntries(entries: Types.TraceEvents.TraceEventData[]): void; | ||
setInvisibleAndModifiedEntries(invisibleEntries: Types.TraceEvents.TraceEventData[], modifiedEntries: Types.TraceEvents.TraceEventData[]): void; | ||
inEntryInvisible(entry: Types.TraceEvents.TraceEventData): boolean; | ||
@@ -54,0 +55,0 @@ /** |
@@ -81,6 +81,8 @@ // Copyright 2023 The Chromium Authors. All rights reserved. | ||
/** | ||
* Sets invisible entries. Called when a trace with annotations is loaded and some entries are set as hidden. | ||
* Sets invisible and modified entries. Called when a trace with annotations is loaded and some entries are set as hidden and modified. | ||
* Both arrays are set together because if there is one, the other must be present too. | ||
**/ | ||
setInvisibleEntries(entries) { | ||
this.#invisibleEntries.push(...entries); | ||
setInvisibleAndModifiedEntries(invisibleEntries, modifiedEntries) { | ||
this.#invisibleEntries.push(...invisibleEntries); | ||
this.#modifiedVisibleEntries.push(...modifiedEntries); | ||
} | ||
@@ -87,0 +89,0 @@ inEntryInvisible(entry) { |
@@ -34,2 +34,3 @@ { | ||
"../../../../../../../front_end/models/trace/handlers/AuctionWorkletsHandler.ts", | ||
"../../../../../../../front_end/models/trace/handlers/ExtensionTraceDataHandler.ts", | ||
"../../../../../../../front_end/models/trace/handlers/FramesHandler.ts", | ||
@@ -36,0 +37,0 @@ "../../../../../../../front_end/models/trace/handlers/GPUHandler.ts", |
@@ -46,2 +46,11 @@ // Copyright 2023 The Chromium Authors. All rights reserved. | ||
export function handleEvent(event) { | ||
if (Types.TraceEvents.isStyleRecalcSelectorStats(event) && lastRecalcStyleEvent) { | ||
if (!lastRecalcStyleEvent.args.selector_stats) { | ||
lastRecalcStyleEvent.args.selector_stats = event.args.selector_stats; | ||
} | ||
else { | ||
lastRecalcStyleEvent.args.selector_stats.selector_timings.push(...event.args.selector_stats?.selector_timings ?? []); | ||
} | ||
return; | ||
} | ||
if (Types.TraceEvents.isTraceEventUpdateLayoutTree(event)) { | ||
@@ -48,0 +57,0 @@ lastRecalcStyleEvent = event; |
@@ -177,4 +177,6 @@ // Copyright 2022 The Chromium Authors. All rights reserved. | ||
} | ||
mainFrameId = frame.frame; | ||
mainFrameURL = frame.url; | ||
if (frame.url) { | ||
mainFrameId = frame.frame; | ||
mainFrameURL = frame.url; | ||
} | ||
topLevelRendererIds.add(frame.processId); | ||
@@ -181,0 +183,0 @@ } |
export * as Animations from './AnimationHandler.js'; | ||
export * as AuctionWorklets from './AuctionWorkletsHandler.js'; | ||
export * as ExtensionTraceData from './ExtensionTraceDataHandler.js'; | ||
export * as Frames from './FramesHandler.js'; | ||
@@ -4,0 +5,0 @@ export * as GPU from './GPUHandler.js'; |
@@ -6,2 +6,3 @@ // Copyright 2022 The Chromium Authors. All rights reserved. | ||
export * as AuctionWorklets from './AuctionWorkletsHandler.js'; | ||
export * as ExtensionTraceData from './ExtensionTraceDataHandler.js'; | ||
export * as Frames from './FramesHandler.js'; | ||
@@ -8,0 +9,0 @@ export * as GPU from './GPUHandler.js'; |
import { type TraceEventHandlerName } from './types.js'; | ||
import * as Types from '../types/types.js'; | ||
export declare function reset(): void; | ||
export declare const MarkerName: readonly ["MarkDOMContent", "MarkLoad", "firstPaint", "firstContentfulPaint", "largestContentfulPaint::Candidate"]; | ||
interface MakerEvent extends Types.TraceEvents.TraceEventData { | ||
name: typeof MarkerName[number]; | ||
} | ||
export declare function isTraceEventMarkerEvent(event: Types.TraceEvents.TraceEventData): event is MakerEvent; | ||
export declare function eventIsPageLoadEvent(event: Types.TraceEvents.TraceEventData): event is Types.TraceEvents.PageLoadEvent; | ||
export declare function handleEvent(event: Types.TraceEvents.TraceEventData): void; | ||
@@ -78,2 +72,1 @@ export declare function getFrameIdForPageLoadEvent(event: Types.TraceEvents.PageLoadEvent): string; | ||
} | ||
export {}; |
@@ -46,23 +46,4 @@ // Copyright 2022 The Chromium Authors. All rights reserved. | ||
const selectedLCPCandidateEvents = new Set(); | ||
export const MarkerName = ['MarkDOMContent', 'MarkLoad', 'firstPaint', 'firstContentfulPaint', 'largestContentfulPaint::Candidate']; | ||
const markerTypeGuards = [ | ||
Types.TraceEvents.isTraceEventMarkDOMContent, | ||
Types.TraceEvents.isTraceEventMarkLoad, | ||
Types.TraceEvents.isTraceEventFirstPaint, | ||
Types.TraceEvents.isTraceEventFirstContentfulPaint, | ||
Types.TraceEvents.isTraceEventLargestContentfulPaintCandidate, | ||
Types.TraceEvents.isTraceEventNavigationStart, | ||
]; | ||
export function isTraceEventMarkerEvent(event) { | ||
return markerTypeGuards.some(fn => fn(event)); | ||
} | ||
const pageLoadEventTypeGuards = [ | ||
...markerTypeGuards, | ||
Types.TraceEvents.isTraceEventInteractiveTime, | ||
]; | ||
export function eventIsPageLoadEvent(event) { | ||
return pageLoadEventTypeGuards.some(fn => fn(event)); | ||
} | ||
export function handleEvent(event) { | ||
if (!eventIsPageLoadEvent(event)) { | ||
if (!Types.TraceEvents.eventIsPageLoadEvent(event)) { | ||
return; | ||
@@ -389,3 +370,3 @@ } | ||
const allEventsButLCP = pageLoadEventsArray.filter(event => !Types.TraceEvents.isTraceEventLargestContentfulPaintCandidate(event)); | ||
const markerEvents = [...allFinalLCPEvents, ...allEventsButLCP].filter(isTraceEventMarkerEvent); | ||
const markerEvents = [...allFinalLCPEvents, ...allEventsButLCP].filter(Types.TraceEvents.isTraceEventMarkerEvent); | ||
// Filter by main frame and sort. | ||
@@ -392,0 +373,0 @@ allMarkerEvents = |
@@ -32,2 +32,3 @@ { | ||
"files": [ | ||
"../../../../../../../front_end/models/trace/helpers/Extensions.ts", | ||
"../../../../../../../front_end/models/trace/helpers/SamplesIntegrator.ts", | ||
@@ -34,0 +35,0 @@ "../../../../../../../front_end/models/trace/helpers/Timing.ts", |
@@ -0,1 +1,2 @@ | ||
export * as Extensions from './Extensions.js'; | ||
export * as SamplesIntegrator from './SamplesIntegrator.js'; | ||
@@ -2,0 +3,0 @@ export * as Timing from './Timing.js'; |
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
export * as Extensions from './Extensions.js'; | ||
export * as SamplesIntegrator from './SamplesIntegrator.js'; | ||
@@ -5,0 +6,0 @@ export * as Timing from './Timing.js'; |
@@ -20,3 +20,3 @@ import type * as CPUProfile from '../../cpu_profile/cpu_profile.js'; | ||
*/ | ||
export declare function mergeEventsInOrder<T1 extends Types.TraceEvents.TraceEventData, T2 extends Types.TraceEvents.TraceEventData>(eventsArray1: T1[], eventsArray2: T2[]): (T1 | T2)[]; | ||
export declare function mergeEventsInOrder<T1 extends Types.TraceEvents.TraceEventData, T2 extends Types.TraceEvents.TraceEventData>(eventsArray1: readonly T1[], eventsArray2: readonly T2[]): (T1 | T2)[]; | ||
export declare function getNavigationForTraceEvent(event: Types.TraceEvents.TraceEventData, eventFrameId: string, navigationsByFrameId: Map<string, Types.TraceEvents.TraceEventNavigationStart[]>): Types.TraceEvents.TraceEventNavigationStart | null; | ||
@@ -29,2 +29,3 @@ export declare function extractId(event: Types.TraceEvents.TraceEventPairableAsync | MatchedPairType<Types.TraceEvents.TraceEventPairableAsync>): string | undefined; | ||
export declare function makeProfileCall(node: CPUProfile.ProfileTreeModel.ProfileNode, ts: Types.Timing.MicroSeconds, pid: Types.TraceEvents.ProcessID, tid: Types.TraceEvents.ThreadID): Types.TraceEvents.SyntheticProfileCall; | ||
export declare function makeSyntheticTraceEntry(name: string, ts: Types.Timing.MicroSeconds, pid: Types.TraceEvents.ProcessID, tid: Types.TraceEvents.ThreadID): Types.TraceEvents.SyntheticTraceEntry; | ||
export declare function matchBeginningAndEndEvents(unpairedEvents: Types.TraceEvents.TraceEventPairableAsync[]): Map<string, { | ||
@@ -37,4 +38,4 @@ begin: Types.TraceEvents.TraceEventPairableAsyncBegin | null; | ||
end: Types.TraceEvents.TraceEventPairableAsyncEnd | null; | ||
}>): MatchedPairType<T>[]; | ||
export declare function createMatchedSortedSyntheticEvents<T extends Types.TraceEvents.TraceEventPairableAsync>(unpairedAsyncEvents: T[]): MatchedPairType<T>[]; | ||
}>, syntheticEventCallback?: (syntheticEvent: MatchedPairType<T>) => void): MatchedPairType<T>[]; | ||
export declare function createMatchedSortedSyntheticEvents<T extends Types.TraceEvents.TraceEventPairableAsync>(unpairedAsyncEvents: T[], syntheticEventCallback?: (syntheticEvent: MatchedPairType<T>) => void): MatchedPairType<T>[]; | ||
export {}; |
@@ -150,2 +150,15 @@ // Copyright 2022 The Chromium Authors. All rights reserved. | ||
} | ||
export function makeSyntheticTraceEntry(name, ts, pid, tid) { | ||
return { | ||
cat: '', | ||
name, | ||
args: {}, | ||
ph: "X" /* Types.TraceEvents.Phase.COMPLETE */, | ||
pid, | ||
tid, | ||
ts, | ||
dur: Types.Timing.MicroSeconds(0), | ||
selfTime: Types.Timing.MicroSeconds(0), | ||
}; | ||
} | ||
export function matchBeginningAndEndEvents(unpairedEvents) { | ||
@@ -181,3 +194,3 @@ // map to store begin and end of the event | ||
} | ||
export function createSortedSyntheticEvents(matchedPairs) { | ||
export function createSortedSyntheticEvents(matchedPairs, syntheticEventCallback) { | ||
const syntheticEvents = []; | ||
@@ -223,2 +236,3 @@ for (const [id, eventsPair] of matchedPairs.entries()) { | ||
} | ||
syntheticEventCallback?.(event); | ||
syntheticEvents.push(event); | ||
@@ -228,7 +242,7 @@ } | ||
} | ||
export function createMatchedSortedSyntheticEvents(unpairedAsyncEvents) { | ||
export function createMatchedSortedSyntheticEvents(unpairedAsyncEvents, syntheticEventCallback) { | ||
const matchedPairs = matchBeginningAndEndEvents(unpairedAsyncEvents); | ||
const syntheticEvents = createSortedSyntheticEvents(matchedPairs); | ||
const syntheticEvents = createSortedSyntheticEvents(matchedPairs, syntheticEventCallback); | ||
return syntheticEvents; | ||
} | ||
//# sourceMappingURL=Trace.js.map |
@@ -21,2 +21,3 @@ // Copyright 2023 The Chromium Authors. All rights reserved. | ||
#modelConfiguration = Types.Configuration.DEFAULT; | ||
#data = null; | ||
#insights = null; | ||
@@ -93,2 +94,3 @@ static createWithAllHandlers() { | ||
} | ||
this.#data = null; | ||
this.#insights = null; | ||
@@ -151,2 +153,5 @@ this.#status = "IDLE" /* Status.IDLE */; | ||
} | ||
if (this.#data) { | ||
return this.#data; | ||
} | ||
// Handlers that depend on other handlers do so via .data(), which used to always | ||
@@ -182,3 +187,4 @@ // return a shallow clone of its internal data structures. However, that pattern | ||
} | ||
return traceParsedData; | ||
this.#data = traceParsedData; | ||
return this.#data; | ||
} | ||
@@ -185,0 +191,0 @@ #getEnabledInsightRunners(traceParsedData) { |
@@ -34,5 +34,9 @@ import type * as Protocol from '../../../generated/protocol.js'; | ||
} | ||
interface Options { | ||
/** Checking iframe root causes can be an expensive operation, so it is disabled by default. */ | ||
enableIframeRootCauses?: boolean; | ||
} | ||
export declare class LayoutShiftRootCauses { | ||
#private; | ||
constructor(protocolInterface: RootCauseProtocolInterface); | ||
constructor(protocolInterface: RootCauseProtocolInterface, options?: Options); | ||
/** | ||
@@ -77,2 +81,3 @@ * Calculates the potential root causes for a given layout shift event. Once | ||
getIframeRootCause(layoutInvalidation: Types.TraceEvents.TraceEventLayoutInvalidationTracking, layoutInvalidationNodeId: Protocol.DOM.NodeId): Promise<InjectedIframe | null>; | ||
getNodeDetails(nodeId: Protocol.DOM.NodeId): Promise<Protocol.DOM.Node | null>; | ||
/** | ||
@@ -122,1 +127,2 @@ * Given a layout invalidation event and a sorted array, returns the subset of requests that arrived within a | ||
} | ||
export {}; |
@@ -43,4 +43,7 @@ // Copyright 2023 The Chromium Authors. All rights reserved. | ||
#rootCauseCacheMap = new Map(); | ||
constructor(protocolInterface) { | ||
#nodeDetailsCache = new Map(); | ||
#iframeRootCausesEnabled; | ||
constructor(protocolInterface, options) { | ||
this.#protocolInterface = protocolInterface; | ||
this.#iframeRootCausesEnabled = options?.enableIframeRootCauses ?? false; | ||
} | ||
@@ -221,3 +224,3 @@ /** | ||
} | ||
const layoutInvalidationNode = await this.#protocolInterface.getNode(layoutInvalidationNodeId); | ||
const layoutInvalidationNode = await this.getNodeDetails(layoutInvalidationNodeId); | ||
if (!layoutInvalidationNode) { | ||
@@ -243,3 +246,6 @@ return null; | ||
async getIframeRootCause(layoutInvalidation, layoutInvalidationNodeId) { | ||
if (layoutInvalidation.args.data.nodeName?.startsWith('IFRAME') && | ||
if (!this.#iframeRootCausesEnabled) { | ||
return null; | ||
} | ||
if (!layoutInvalidation.args.data.nodeName?.startsWith('IFRAME') && | ||
layoutInvalidation.args.data.reason !== "Style changed" /* Types.TraceEvents.LayoutInvalidationReason.STYLE_CHANGED */ && | ||
@@ -249,3 +255,3 @@ layoutInvalidation.args.data.reason !== "Added to layout" /* Types.TraceEvents.LayoutInvalidationReason.ADDED_TO_LAYOUT */) { | ||
} | ||
const layoutInvalidationNode = await this.#protocolInterface.getNode(layoutInvalidationNodeId); | ||
const layoutInvalidationNode = await this.getNodeDetails(layoutInvalidationNodeId); | ||
if (!layoutInvalidationNode) { | ||
@@ -260,2 +266,11 @@ return null; | ||
} | ||
async getNodeDetails(nodeId) { | ||
let nodeDetails = this.#nodeDetailsCache.get(nodeId); | ||
if (nodeDetails !== undefined) { | ||
return nodeDetails; | ||
} | ||
nodeDetails = await this.#protocolInterface.getNode(nodeId); | ||
this.#nodeDetailsCache.set(nodeId, nodeDetails); | ||
return nodeDetails; | ||
} | ||
/** | ||
@@ -262,0 +277,0 @@ * Given a layout invalidation event and a sorted array, returns the subset of requests that arrived within a |
@@ -15,1 +15,2 @@ import type * as Protocol from '../../../generated/protocol.js'; | ||
} | ||
export { LayoutShiftRootCauses } from './LayoutShift.js'; |
@@ -11,2 +11,3 @@ // Copyright 2023 The Chromium Authors. All rights reserved. | ||
} | ||
export { LayoutShiftRootCauses } from './LayoutShift.js'; | ||
//# sourceMappingURL=RootCauses.js.map |
@@ -0,1 +1,2 @@ | ||
import { type TraceWindowMicroSeconds } from './Timing.js'; | ||
import { type TraceEventData } from './TraceEvents.js'; | ||
@@ -6,2 +7,6 @@ export type TraceFile = { | ||
}; | ||
export interface Breadcrumb { | ||
window: TraceWindowMicroSeconds; | ||
child: Breadcrumb | null; | ||
} | ||
export declare const enum DataOrigin { | ||
@@ -12,5 +17,7 @@ CPUProfile = "CPUProfile", | ||
export interface Annotations { | ||
hiddenRendererEventsHashes: string[]; | ||
hiddenProfileCallsSampleIndexes: number[]; | ||
hiddenProfileCallsDepths: number[]; | ||
entriesFilterAnnotations: { | ||
hiddenEntriesIndexes: number[]; | ||
modifiedEntriesIndexes: number[]; | ||
}; | ||
initialBreadcrumb: Breadcrumb; | ||
} | ||
@@ -17,0 +24,0 @@ /** |
@@ -430,2 +430,8 @@ import type * as Protocol from '../../../generated/protocol.js'; | ||
export type PageLoadEvent = TraceEventFirstContentfulPaint | TraceEventMarkDOMContent | TraceEventInteractiveTime | TraceEventLargestContentfulPaintCandidate | TraceEventLayoutShift | TraceEventFirstPaint | TraceEventMarkLoad | TraceEventNavigationStart; | ||
export declare const MarkerName: readonly ["MarkDOMContent", "MarkLoad", "firstPaint", "firstContentfulPaint", "largestContentfulPaint::Candidate"]; | ||
interface MakerEvent extends TraceEventData { | ||
name: typeof MarkerName[number]; | ||
} | ||
export declare function isTraceEventMarkerEvent(event: TraceEventData): event is MakerEvent; | ||
export declare function eventIsPageLoadEvent(event: TraceEventData): event is PageLoadEvent; | ||
export interface TraceEventLargestContentfulPaintCandidate extends TraceEventMark { | ||
@@ -841,3 +847,8 @@ name: 'largestContentfulPaint::Candidate'; | ||
export interface TraceEventPerformanceMark extends TraceEventUserTiming { | ||
ph: Phase.INSTANT | Phase.MARK; | ||
args: TraceEventArgs & { | ||
data?: TraceEventArgsData & { | ||
detail?: string; | ||
}; | ||
}; | ||
ph: Phase.INSTANT | Phase.MARK | Phase.ASYNC_NESTABLE_INSTANT; | ||
} | ||
@@ -863,13 +874,2 @@ export interface TraceEventConsoleTimeBegin extends TraceEventPairableAsyncBegin { | ||
} | ||
export interface TraceEventExtensionMeasureBegin extends TraceEventPerformanceMeasureBegin { | ||
name: `devtools-entry-${string}`; | ||
} | ||
export interface TraceEventExtensionMeasureEnd extends TraceEventPerformanceMeasureEnd { | ||
name: `devtools-entry-${string}`; | ||
} | ||
export interface TraceEventExtensionMark extends TraceEventPerformanceMark { | ||
name: `devtools-entry-${string}`; | ||
ph: Phase.INSTANT | Phase.MARK; | ||
} | ||
export type TraceEventExtensionMeasure = TraceEventExtensionMeasureBegin | TraceEventExtensionMeasureEnd; | ||
/** ChromeFrameReporter args for PipelineReporter event. | ||
@@ -964,2 +964,3 @@ Matching proto: https://source.chromium.org/chromium/chromium/src/+/main:third_party/perfetto/protos/perfetto/trace/track_event/chrome_frame_reporter.proto | ||
export interface SyntheticEventPair<T extends TraceEventPairableAsync = TraceEventPairableAsync> extends TraceEventData { | ||
name: T['name']; | ||
cat: T['cat']; | ||
@@ -1124,5 +1125,23 @@ id?: string; | ||
export declare function isSyntheticInvalidation(event: TraceEventData): event is SyntheticInvalidation; | ||
export interface SelectorTiming { | ||
'elapsed (us)': number; | ||
'fast_reject_count': number; | ||
'match_attempts': number; | ||
'selector': string; | ||
'style_sheet_id': string; | ||
} | ||
export interface SelectorStats { | ||
selector_timings: SelectorTiming[]; | ||
} | ||
export interface TraceEventStyleRecalcSelectorStats extends TraceEventComplete { | ||
name: KnownEventName.SelectorStats; | ||
args: TraceEventArgs & { | ||
selector_stats?: SelectorStats; | ||
}; | ||
} | ||
export declare function isStyleRecalcSelectorStats(event: TraceEventData): event is TraceEventStyleRecalcSelectorStats; | ||
export interface TraceEventUpdateLayoutTree extends TraceEventComplete { | ||
name: KnownEventName.UpdateLayoutTree; | ||
args: TraceEventArgs & { | ||
selector_stats?: SelectorStats; | ||
elementCount: number; | ||
@@ -1524,3 +1543,2 @@ beginData?: { | ||
DOMGC = "BlinkGC.AtomicPhase", | ||
IncrementalGCMarking = "V8.GCIncrementalMarking", | ||
MajorGC = "MajorGC", | ||
@@ -1545,2 +1563,3 @@ MinorGC = "MinorGC", | ||
StyleInvalidatorInvalidationTracking = "StyleInvalidatorInvalidationTracking", | ||
SelectorStats = "SelectorStats", | ||
ScrollLayer = "ScrollLayer", | ||
@@ -1547,0 +1566,0 @@ UpdateLayer = "UpdateLayer", |
@@ -24,2 +24,21 @@ // Copyright 2022 The Chromium Authors. All rights reserved. | ||
} | ||
const markerTypeGuards = [ | ||
isTraceEventMarkDOMContent, | ||
isTraceEventMarkLoad, | ||
isTraceEventFirstPaint, | ||
isTraceEventFirstContentfulPaint, | ||
isTraceEventLargestContentfulPaintCandidate, | ||
isTraceEventNavigationStart, | ||
]; | ||
export const MarkerName = ['MarkDOMContent', 'MarkLoad', 'firstPaint', 'firstContentfulPaint', 'largestContentfulPaint::Candidate']; | ||
export function isTraceEventMarkerEvent(event) { | ||
return markerTypeGuards.some(fn => fn(event)); | ||
} | ||
const pageLoadEventTypeGuards = [ | ||
...markerTypeGuards, | ||
isTraceEventInteractiveTime, | ||
]; | ||
export function eventIsPageLoadEvent(event) { | ||
return pageLoadEventTypeGuards.some(fn => fn(event)); | ||
} | ||
export function isTraceEventTracingSessionIdForWorker(event) { | ||
@@ -89,2 +108,5 @@ return event.name === 'TracingSessionIdForWorker'; | ||
} | ||
export function isStyleRecalcSelectorStats(event) { | ||
return event.name === "SelectorStats" /* KnownEventName.SelectorStats */; | ||
} | ||
export function isTraceEventUpdateLayoutTree(event) { | ||
@@ -305,12 +327,12 @@ return event.name === "UpdateLayoutTree" /* KnownEventName.UpdateLayoutTree */; | ||
} | ||
const asyncPhases = new Set([ | ||
"b" /* Phase.ASYNC_NESTABLE_START */, | ||
"n" /* Phase.ASYNC_NESTABLE_INSTANT */, | ||
"e" /* Phase.ASYNC_NESTABLE_END */, | ||
"T" /* Phase.ASYNC_STEP_INTO */, | ||
"S" /* Phase.ASYNC_BEGIN */, | ||
"F" /* Phase.ASYNC_END */, | ||
"p" /* Phase.ASYNC_STEP_PAST */, | ||
]); | ||
export function isTraceEventAsyncPhase(traceEventData) { | ||
const asyncPhases = new Set([ | ||
"b" /* Phase.ASYNC_NESTABLE_START */, | ||
"n" /* Phase.ASYNC_NESTABLE_INSTANT */, | ||
"e" /* Phase.ASYNC_NESTABLE_END */, | ||
"T" /* Phase.ASYNC_STEP_INTO */, | ||
"S" /* Phase.ASYNC_BEGIN */, | ||
"F" /* Phase.ASYNC_END */, | ||
"p" /* Phase.ASYNC_STEP_PAST */, | ||
]); | ||
return asyncPhases.has(traceEventData.ph); | ||
@@ -317,0 +339,0 @@ } |
@@ -33,2 +33,3 @@ { | ||
"../../../../../../../front_end/models/trace/types/Configuration.ts", | ||
"../../../../../../../front_end/models/trace/types/Extensions.ts", | ||
"../../../../../../../front_end/models/trace/types/File.ts", | ||
@@ -35,0 +36,0 @@ "../../../../../../../front_end/models/trace/types/Timing.ts", |
export * as Configuration from './Configuration.js'; | ||
export * as Extensions from './Extensions.js'; | ||
export * as File from './File.js'; | ||
export * as Timing from './Timing.js'; | ||
export * as TraceEvents from './TraceEvents.js'; |
@@ -5,2 +5,3 @@ // Copyright 2022 The Chromium Authors. All rights reserved. | ||
export * as Configuration from './Configuration.js'; | ||
export * as Extensions from './Extensions.js'; | ||
export * as File from './File.js'; | ||
@@ -7,0 +8,0 @@ export * as Timing from './Timing.js'; |
{ | ||
"name": "@paulirish/trace_engine", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "models/trace/trace.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4462706
1.07%273
5%32499
1.62%