in browsers perf util is just a wrapper around native performance

This commit is contained in:
Johannes Rieken
2020-12-15 10:25:02 +01:00
parent 1537b5bcc2
commit 460b6e720e
2 changed files with 43 additions and 45 deletions

View File

@@ -399,13 +399,8 @@ export abstract class AbstractTimerService implements ITimerService {
_lifecycleService.when(LifecyclePhase.Restored)
]).then(() => {
// import native-browser marks
this._submitNativeMarks();
// because "our" perf.mark-util also adds native performance marks
// no extra import of "our" marks is needed, they are already imported
// by importing native perf marks (see above)
// this.submitPerformanceMarks(perf.getMarks());
// set perf mark from renderer
this.setPerformanceMarks('renderer', perf.getMarks());
return this._computeStartupMetrics();
}).then(metrics => {
@@ -414,22 +409,6 @@ export abstract class AbstractTimerService implements ITimerService {
});
}
private _submitNativeMarks(): void {
let timeOrigin = performance.timeOrigin;
if (!timeOrigin) {
// polyfill for Safari
const entry = performance.timing;
timeOrigin = entry.navigationStart || entry.redirectStart || entry.fetchStart;
}
const marks: perf.PerformanceMark[] = performance.getEntriesByType('mark').map(entry => {
return {
name: entry.name,
startTime: Math.round(timeOrigin + entry.startTime)
};
});
this.setPerformanceMarks('renderer', marks);
}
setPerformanceMarks(source: string, marks: perf.PerformanceMark[]): void {
this._marks.setMarks(source, marks);
}