Skip to content

Commit 2a09702

Browse files
authored
Merge pull request #18 from PerfLab-io/add-event-entry-highlight
Enable event entry highlighting
2 parents f71acdf + 7a817d4 commit 2a09702

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

front_end/panels/timeline/TimelineFlameChartView.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export type EventTypes = {
5757
start: Trace.Types.Timing.MicroSeconds,
5858
end: Trace.Types.Timing.MicroSeconds,
5959
}[],
60+
entry?: Trace.Types.Events.Event,
6061
},
6162
};
6263

@@ -84,18 +85,23 @@ export class HightlightEventAsOvelay extends CustomEvent<EventTypes[Events.Hight
8485
}
8586
}
8687

87-
export const createOverlayFnForEvent = (phases: {
88-
name: string,
89-
start: Trace.Types.Timing.MicroSeconds,
90-
end: Trace.Types.Timing.MicroSeconds,
91-
}[]) => (): Overlays.Overlays.TimelineOverlay[] => {
88+
export const createOverlayFnForEvent = (
89+
phases: {
90+
name: string,
91+
start: Trace.Types.Timing.MicroSeconds,
92+
end: Trace.Types.Timing.MicroSeconds,
93+
}[],
94+
entry?: Trace.Types.Events.Event,
95+
) => (): Overlays.Overlays.TimelineOverlay[] => {
9296
return [{
9397
type: 'TIMESPAN_BREAKDOWN',
94-
sections: phases.map(({ start, end, name }) => ({
95-
bounds: Trace.Helpers.Timing.traceWindowFromMicroSeconds(start, end),
96-
label: name,
97-
showDuration: true,
98-
})),
98+
sections: phases.map(({ start, end, name }) => ({
99+
bounds: Trace.Helpers.Timing.traceWindowFromMicroSeconds(start, end),
100+
label: name,
101+
showDuration: true,
102+
})),
103+
entry,
104+
renderLocation: 'BELOW_EVENT',
99105
}];
100106
};
101107

@@ -413,7 +419,7 @@ export class TimelineFlameChartView extends UI.Widget.VBox implements PerfUI.Fla
413419
const insight = {
414420
name: event.detail.eventName,
415421
insightSetKey: event.detail.navigationId,
416-
overlays: createOverlayFnForEvent(event.detail.phases)(),
422+
overlays: createOverlayFnForEvent(event.detail.phases, event.detail.entry)(),
417423
};
418424
this.setActiveInsight(insight);
419425
});

0 commit comments

Comments
 (0)