Skip to content

Commit

Permalink
Include browser benchmark in the baseline data (#4015)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Nov 29, 2023
1 parent 4cd5158 commit 308fd62
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions lib/plugins/compare/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@ function getExtras(data) {
return results;
}

function getBrowserMetrics(data) {
const browserMetrics = {
cpuBenchmark: []
};
for (const run of data.browserScripts) {
browserMetrics['cpuBenchmark'].push(run.browser.cpuBenchmark);
}

const results = {};
for (const [metricName, values] of Object.entries(browserMetrics)) {
if (!results.browser) {
results.browser = {};
}
results.browser[metricName] = new Metric(`${metricName}`, values);
}
return results;
}

function getTimings(data) {
const timingMetrics = {
ttfb: [],
Expand Down Expand Up @@ -324,24 +342,16 @@ function getRenderBlocking(data) {
}

export function getMetrics(data) {
const userTimings = getUserTimings(data);
const elementTimings = getElementTimings(data);
const visualMetrics = getVisualMetrics(data);
const rb = getRenderBlocking(data);
const gWV = getGoogleWebVitals(data);
const cdp = getCDPPerformance(data);
const cpu = getCPU(data);
const timings = getTimings(data);
const extras = getExtras(data);
return {
...extras,
...timings,
...cpu,
...cdp,
...visualMetrics,
...gWV,
...rb,
...elementTimings,
...userTimings
...getExtras(data),
...getTimings(data),
...getVisualMetrics(data),
...getGoogleWebVitals(data),
...getRenderBlocking(data),
...getElementTimings(data),
...getUserTimings(data),
...getCPU(data),
...getBrowserMetrics(data),
...getCDPPerformance(data)
};
}

0 comments on commit 308fd62

Please sign in to comment.