Add support for Firefox memory report. (#3416)

This commit is contained in:
Peter Hedenskog 2021-07-07 22:19:52 +02:00 committed by GitHub
parent 695741f183
commit 3b6671611e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 2 deletions

View File

@ -573,6 +573,21 @@ module.exports.parseCommandLine = function parseCommandLine() {
type: 'boolean',
group: 'Firefox'
})
.option('browsertime.firefox.memoryReport', {
alias: 'firefox.memoryReport',
describe: 'Measure firefox resident memory after each iteration.',
default: false,
type: 'boolean',
group: 'Firefox'
})
.option('browsertime.firefox.memoryReportParams.minizeFirst', {
alias: 'firefox.memoryReportParams.minizeFirst',
describe:
'Force a collection before dumping and measuring the memory report.',
default: false,
type: 'boolean',
group: 'Firefox'
})
.option('browsertime.firefox.geckoProfiler', {
alias: 'firefox.geckoProfiler',
describe: 'Collect a profile using the internal gecko profiler',

View File

@ -23,6 +23,15 @@ module.exports = {
);
}
if (browsertimeRunData.memory) {
statsHelpers.pushGroupStats(
this.statsPerType,
this.groups[group],
['memory'],
browsertimeRunData.memory
);
}
if (browsertimeRunData.googleWebVitals) {
statsHelpers.pushGroupStats(
this.statsPerType,
@ -223,6 +232,10 @@ module.exports = {
summary.cpu.longTasks = longTasks;
summary.cpu.categories = categories;
} else if ('memory'.indexOf(name) > -1) {
const memory = {};
statsHelpers.setStatsSummary(memory, 'memory', obj[name]);
summary.memory = memory.memory;
} else {
const categoryData = {};
forEach(obj[name], (stats, timingName) => {

View File

@ -30,6 +30,7 @@ module.exports = [
'statistics.cdp.performance.JSHeapTotalSize',
'statistics.cdp.performance.FirstMeaningfulPaint',
'statistics.errors',
'statistics.memory',
'statistics.axe.violations.*',
'statistics.pageinfo.cumulativeLayoutShift',
'statistics.pageinfo.domElements',

View File

@ -292,6 +292,10 @@ module.exports = {
run.cpu = result[resultIndex].cpu[runIndex];
}
if (result[resultIndex].memory) {
run.memory = result[resultIndex].memory[runIndex];
}
if (result[resultIndex].extras) {
run.extras = result[resultIndex].extras[runIndex];
}

View File

@ -145,6 +145,10 @@ module.exports = function(data) {
);
}
if (summary.memory) {
rows.push(row(summary.memory, 'Memory usage', 'memory', h.size.format));
}
if (summary.paintTiming) {
const paintTimings = Object.keys(summary.paintTiming);
const lookup = {

View File

@ -132,6 +132,9 @@ block content
h5(id='Logo') Logo
p The time when the logo (configured with --scriptInput.visualElements) within the viewport has finished painted at the final position on the screen. Calculated by analysing a video.
h5(id='memory') Memory usage
p The page memory usage. Only measurable in Firefox using --firefox.memoryReport.
h5(id='imageSizePerPage') Image transfer size per page
p The size of images per page.

View File

@ -59,6 +59,11 @@ block content
tr
td Total page size
td #{h.size.format(totalTransferSize)}
- memory = get(d, 'browsertime.run.memory')
if memory
tr
td Memory
td #{h.size.format(memory)}
- requests = get(d, 'pagexray.run.requests')
if (requests)
tr

View File

@ -106,7 +106,7 @@ if browsertime
tr
td
a(href=baseHelpURL + 'VisualReadiness') Visual Readiness
td.number #{h.time.ms(visualMetrics.VisualReadiness.toFixed(0))}
td.number #{h.time.ms(visualMetrics.VisualReadiness.toFixed(0))}
.one-half.column
.ct-chart.ct-minor-sixth#ct-visualprogress
include ./visualProgress.pug
@ -134,7 +134,6 @@ if browsertime
td
a(href=baseHelpURL + 'firstContentfulPaint') First Contentful Paint (FCP)
td.number #{h.time.ms(timings.paintTiming['first-contentful-paint'])}
if (timings.largestContentfulPaint)
tr
td

View File

@ -83,6 +83,11 @@ block content
tr
td Total Page Transfer Size
td #{h.size.format(totalTransferSize)}
- memory = get(d, 'browsertime.pageSummary.memory')
if memory
tr
td Memory
td #{h.size.format(memory)}
- requests = get(d, 'pagexray.pageSummary.requests')
if requests
tr