New Browsertime with support for enableProfileRun
This commit is contained in:
parent
7a6cfff3bb
commit
cab5f79f8b
|
|
@ -1 +1 @@
|
|||
17.8.1
|
||||
17.9.0
|
||||
|
|
@ -69,6 +69,7 @@ firefox
|
|||
--firefox.memoryReport Measure firefox resident memory after each iteration. [boolean] [default: false]
|
||||
--firefox.memoryReportParams.minizeFirst Force a collection before dumping and measuring the memory report. [boolean] [default: false]
|
||||
--firefox.geckoProfiler Collect a profile using the internal gecko profiler [boolean] [default: false]
|
||||
--firefox.geckoProfilerRecordingType Expose the start/stop commands for the gecko profiler [string] [choices: "pageload", "custom"] [default: "pageload"]
|
||||
--firefox.geckoProfilerParams.features Enabled features during gecko profiling [string] [default: "js,stackwalk,leaf"]
|
||||
--firefox.geckoProfilerParams.threads Threads to profile. [string] [default: "GeckoMain,Compositor,Renderer"]
|
||||
--firefox.geckoProfilerParams.interval Sampling interval in ms. Defaults to 1 on desktop, and 4 on android. [number]
|
||||
|
|
@ -150,6 +151,7 @@ debug
|
|||
|
||||
Options:
|
||||
--cpu Easy way to enable both chrome.timeline for Chrome and geckoProfile for Firefox [boolean]
|
||||
--enableProfileRun Make one extra run that collects the profiling trace log (no other metrics is collected). For Chrome it will collect the timeline trace, for Firefox it will get the Geckoprofiler trace. This means you do not need to get the trace for all runs and can skip the overhead it produces. [boolean]
|
||||
--video Record a video and store the video. Set it to false to remove the video that is created by turning on visualMetrics. To remove fully turn off video recordings, make sure to set video and visualMetrics to false. Requires FFMpeg to be installed. [boolean]
|
||||
--visualMetrics Collect Visual Metrics like First Visual Change, SpeedIndex, Perceptual Speed Index and Last Visual Change. Requires FFMpeg and Python dependencies [boolean]
|
||||
--visualElements, --visuaElements Collect Visual Metrics from elements. Works only with --visualMetrics turned on. By default you will get visual metrics from the largest image within the view port and the largest h1. You can also configure to pickup your own defined elements with --scriptInput.visualElements [boolean]
|
||||
|
|
|
|||
|
|
@ -548,6 +548,12 @@ export async function parseCommandLine() {
|
|||
'Easy way to enable both chrome.timeline and CPU long tasks for Chrome and geckoProfile for Firefox',
|
||||
group: 'Browser'
|
||||
})
|
||||
.option('browsertime.enableProfileRun', {
|
||||
alias: 'enableProfileRun',
|
||||
type: 'boolean',
|
||||
describe:
|
||||
'Make one extra run that collects the profiling trace log (no other metrics is collected). For Chrome it will collect the timeline trace, for Firefox it will get the Geckoprofiler trace. This means you do not need to get the trace for all runs and can skip the overhead it produces.'
|
||||
})
|
||||
.option('browsertime.videoParams.filmstripFullSize', {
|
||||
alias: 'videoParams.filmstripFullSize',
|
||||
type: 'boolean',
|
||||
|
|
@ -788,7 +794,7 @@ export async function parseCommandLine() {
|
|||
describe:
|
||||
'Collect the timeline data. Drag and drop the JSON in your Chrome detvools timeline panel or check out the CPU metrics.',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
default: false,
|
||||
group: 'Chrome'
|
||||
})
|
||||
.option('browsertime.chrome.appendToUserAgent', {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import forEach from 'lodash.foreach';
|
|||
import set from 'lodash.set';
|
||||
import get from 'lodash.get';
|
||||
import coach from 'coach-core';
|
||||
import { BrowsertimeEngine, browserScripts } from 'browsertime';
|
||||
const { getDomAdvice } = coach;
|
||||
import intel from 'intel';
|
||||
const log = intel.getLogger('plugin.browsertime');
|
||||
|
|
@ -52,7 +53,6 @@ async function preWarmServer(urls, options, scriptOrMultiple) {
|
|||
}
|
||||
}
|
||||
|
||||
const { BrowsertimeEngine } = await import('browsertime');
|
||||
const engine = new BrowsertimeEngine(preWarmOptions);
|
||||
|
||||
await engine.start();
|
||||
|
|
@ -65,6 +65,26 @@ async function preWarmServer(urls, options, scriptOrMultiple) {
|
|||
return delay(options.preWarmServerWaitTime || 5000);
|
||||
}
|
||||
|
||||
async function extraProfileRun(urls, options, scriptOrMultiple) {
|
||||
log.info('Make one extra run to collect trace information');
|
||||
options.iterations = 1;
|
||||
if (options.browser === 'firefox') {
|
||||
options.firefox.geckoProfiler = true;
|
||||
} else if (options.browser === 'chrome') {
|
||||
options.chrome.enableTraceScreenshots = true;
|
||||
options.chrome.traceCategory = ['disabled-by-default-v8.cpu_profiler'];
|
||||
options.chrome.timeline = true;
|
||||
}
|
||||
options.video = false;
|
||||
options.visualMetrics = false;
|
||||
const traceEngine = new BrowsertimeEngine(options);
|
||||
await traceEngine.start();
|
||||
await (scriptOrMultiple
|
||||
? traceEngine.runMultiple(urls, {})
|
||||
: traceEngine.run(urls, {}));
|
||||
await traceEngine.stop();
|
||||
}
|
||||
|
||||
async function parseUserScripts(scripts) {
|
||||
const { browserScripts } = await import('browsertime');
|
||||
if (!Array.isArray(scripts)) scripts = [scripts];
|
||||
|
|
@ -138,7 +158,6 @@ export async function analyzeUrl(
|
|||
btOptions.userAgent = iphone6UserAgent;
|
||||
}
|
||||
}
|
||||
const { BrowsertimeEngine, browserScripts } = await import('browsertime');
|
||||
const scriptCategories = await browserScripts.allScriptCategories();
|
||||
let scriptsByCategory = await browserScripts.getScriptsForCategories(
|
||||
scriptCategories
|
||||
|
|
@ -169,9 +188,15 @@ export async function analyzeUrl(
|
|||
await engine.start();
|
||||
if (scriptOrMultiple) {
|
||||
const res = await engine.runMultiple(url, scriptsByCategory, asyncScript);
|
||||
if (btOptions.enableProfileRun) {
|
||||
await extraProfileRun(url, btOptions, scriptOrMultiple);
|
||||
}
|
||||
return res;
|
||||
} else {
|
||||
const res = await engine.run(url, scriptsByCategory, asyncScript);
|
||||
if (btOptions.enableProfileRun) {
|
||||
await extraProfileRun(url, btOptions, scriptOrMultiple);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -21,20 +21,32 @@ small
|
|||
a#cpu
|
||||
h2 CPU
|
||||
|
||||
if browsertime && browsertime.cpu && browsertime.cpu.events
|
||||
if browsertime && browsertime.cpu && browsertime.cpu.events && !options.browsertime.enableProfileRun
|
||||
p Download the Chrome trace log and drag and drop it into Developer Tools / Performance in Chrome.
|
||||
.downloads
|
||||
if options.browsertime.chrome && options.browsertime.chrome.timeline
|
||||
- const tracePath = 'data/trace-' + (runNumber? runNumber : 1) + '.json.gz'
|
||||
a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download trace log
|
||||
|
||||
if options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler && options.browser === 'firefox'
|
||||
if options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler && options.browser === 'firefox' && !options.browsertime.enableProfileRun
|
||||
p Download the Firefox Geckoprofiler trace and drag and drop it into
|
||||
a(href='https://profiler.firefox.com') https://profiler.firefox.com
|
||||
.downloads
|
||||
- const tracePath = 'data/geckoProfile-' + (runNumber? runNumber : 1) + '.json.gz'
|
||||
a.button.button-download(href=tracePath, download=downloadName + '-geckoProfile.json.gz') Download trace
|
||||
|
||||
if options.browsertime && options.browsertime.enableProfileRun
|
||||
if options.browser === 'firefox'
|
||||
p Download the Firefox Geckoprofiler trace and drag and drop it into
|
||||
a(href='https://profiler.firefox.com') https://profiler.firefox.com
|
||||
.downloads
|
||||
- const tracePath = 'data/geckoProfile-1-extra.json.gz'
|
||||
a.button.button-download(href=tracePath, download=downloadName + '-geckoProfile.json.gz') Download extra run trace log
|
||||
else if options.browser === 'chrome'
|
||||
p Download the Chrome trace log and drag and drop it into Developer Tools / Performance in Chrome.
|
||||
- const tracePath = 'data/trace-1-extra-run.json.gz'
|
||||
a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download extra run trace log
|
||||
|
||||
if browsertime && browsertime.cpu && browsertime.cpu.longTasks
|
||||
a#long-tasks
|
||||
h3 Long Tasks
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ block content
|
|||
section#pagexray-panel
|
||||
include ../pagexray/index.pug
|
||||
|
||||
if options.cpu || (options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks) || (options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler)
|
||||
if options.cpu || (options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks) || (options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler || options.browsertime &&options.browsertime.enableProfileRun)
|
||||
section#cpu-panel
|
||||
include ../cpu/index.pug
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
if d.pagexray && d.pagexray.run
|
||||
a(id='pagexray', href='#pagexray', onclick='return selectTab(this, true);')
|
||||
| PageXray
|
||||
if options.cpu || options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks || options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler
|
||||
if options.cpu || options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks || options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler || options.browsertime &&options.browsertime.enableProfileRun
|
||||
a(id='cpu', href='#cpu', onclick='return selectTab(this, true);')
|
||||
| CPU
|
||||
if d.thirdparty && d.thirdparty.run
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ block content
|
|||
section#pagexray-panel
|
||||
include ../pagexray/index.pug
|
||||
|
||||
if options.cpu || options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks || (options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler)
|
||||
if options.cpu || options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks || (options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler || options.browsertime &&options.browsertime.enableProfileRun)
|
||||
section#cpu-panel
|
||||
include ../cpu/index.pug
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
if d.pagexray && d.pagexray.pageSummary
|
||||
a(id='pagexray', href='#pagexray', onclick='return selectTab(this, true);')
|
||||
| PageXray
|
||||
if options.cpu || options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks || options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler
|
||||
if options.cpu || options.browsertime && options.browsertime.chrome && options.browsertime.chrome.collectLongTasks || options.browsertime && options.browsertime.firefox && options.browsertime.firefox.geckoProfiler || options.browsertime &&options.browsertime.enableProfileRun
|
||||
a(id='cpu', href='#cpu', onclick='return selectTab(this, true);')
|
||||
| CPU
|
||||
if d.thirdparty && d.thirdparty.pageSummary
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"@tgwf/co2": "0.12.2",
|
||||
"aws-sdk": "2.1327.0",
|
||||
"axe-core": "4.6.3",
|
||||
"browsertime": "17.8.1",
|
||||
"browsertime": "17.9.0",
|
||||
"cli-color": "2.0.3",
|
||||
"coach-core": "7.1.3",
|
||||
"concurrent-queue": "7.0.2",
|
||||
|
|
@ -1843,9 +1843,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/browsertime": {
|
||||
"version": "17.8.1",
|
||||
"resolved": "https://registry.npmjs.org/browsertime/-/browsertime-17.8.1.tgz",
|
||||
"integrity": "sha512-vLrfi67Eq3Q+gCgkstQ63Pg2cuiFqnfi0oh4IdfimQrw7Oloy0Tri12jpxf25pNWwF4RnGXxscAZsPZmpJdKDQ==",
|
||||
"version": "17.9.0",
|
||||
"resolved": "https://registry.npmjs.org/browsertime/-/browsertime-17.9.0.tgz",
|
||||
"integrity": "sha512-WuM5iGebb/paJBA2qDOJcbpTNQVB/HE90e6jDBoXzxRXAQRkxtbbyDVUnp5sJ0eBfGjmxaofZMcg7QT3Gf+oXQ==",
|
||||
"dependencies": {
|
||||
"@cypress/xvfb": "1.2.4",
|
||||
"@devicefarmer/adbkit": "2.11.3",
|
||||
|
|
@ -1856,9 +1856,9 @@
|
|||
"@sitespeed.io/tracium": "0.3.3",
|
||||
"btoa": "1.2.1",
|
||||
"chrome-har": "0.13.1",
|
||||
"chrome-remote-interface": "0.32.1",
|
||||
"chrome-remote-interface": "0.32.2",
|
||||
"dayjs": "1.11.7",
|
||||
"execa": "7.0.0",
|
||||
"execa": "7.1.1",
|
||||
"fast-stats": "0.0.6",
|
||||
"ff-test-bidi-har-export": "0.0.10",
|
||||
"find-up": "6.3.0",
|
||||
|
|
@ -2127,9 +2127,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/chrome-remote-interface": {
|
||||
"version": "0.32.1",
|
||||
"resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.32.1.tgz",
|
||||
"integrity": "sha512-CU3/K/8YlU2H0DjsLRbxPsG4piiSGUcIy6GkGXF11SqOYoIeuUBivOsGXScaZnTyC1p4wFSR+GNmAM434/ALWw==",
|
||||
"version": "0.32.2",
|
||||
"resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.32.2.tgz",
|
||||
"integrity": "sha512-3UbFKtEmqApehPQnqdblcggx7KveQphEMKQmdJZsOguE9ylw2N2/9Z7arO7xS55+DBJ/hyP8RrayLt4MMdJvQg==",
|
||||
"dependencies": {
|
||||
"commander": "2.11.x",
|
||||
"ws": "^7.2.0"
|
||||
|
|
@ -3637,9 +3637,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/execa": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.0.0.tgz",
|
||||
"integrity": "sha512-tQbH0pH/8LHTnwTrsKWideqi6rFB/QNUawEwrn+WHyz7PX1Tuz2u7wfTvbaNBdP5JD5LVWxNo8/A8CHNZ3bV6g==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz",
|
||||
"integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
|
|
@ -4623,9 +4623,9 @@
|
|||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/human-signals": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.0.tgz",
|
||||
"integrity": "sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ==",
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
|
||||
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==",
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
}
|
||||
|
|
@ -10632,9 +10632,9 @@
|
|||
}
|
||||
},
|
||||
"browsertime": {
|
||||
"version": "17.8.1",
|
||||
"resolved": "https://registry.npmjs.org/browsertime/-/browsertime-17.8.1.tgz",
|
||||
"integrity": "sha512-vLrfi67Eq3Q+gCgkstQ63Pg2cuiFqnfi0oh4IdfimQrw7Oloy0Tri12jpxf25pNWwF4RnGXxscAZsPZmpJdKDQ==",
|
||||
"version": "17.9.0",
|
||||
"resolved": "https://registry.npmjs.org/browsertime/-/browsertime-17.9.0.tgz",
|
||||
"integrity": "sha512-WuM5iGebb/paJBA2qDOJcbpTNQVB/HE90e6jDBoXzxRXAQRkxtbbyDVUnp5sJ0eBfGjmxaofZMcg7QT3Gf+oXQ==",
|
||||
"requires": {
|
||||
"@cypress/xvfb": "1.2.4",
|
||||
"@devicefarmer/adbkit": "2.11.3",
|
||||
|
|
@ -10645,9 +10645,9 @@
|
|||
"@sitespeed.io/tracium": "0.3.3",
|
||||
"btoa": "1.2.1",
|
||||
"chrome-har": "0.13.1",
|
||||
"chrome-remote-interface": "0.32.1",
|
||||
"chrome-remote-interface": "0.32.2",
|
||||
"dayjs": "1.11.7",
|
||||
"execa": "7.0.0",
|
||||
"execa": "7.1.1",
|
||||
"fast-stats": "0.0.6",
|
||||
"ff-test-bidi-har-export": "0.0.10",
|
||||
"find-up": "6.3.0",
|
||||
|
|
@ -10840,9 +10840,9 @@
|
|||
}
|
||||
},
|
||||
"chrome-remote-interface": {
|
||||
"version": "0.32.1",
|
||||
"resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.32.1.tgz",
|
||||
"integrity": "sha512-CU3/K/8YlU2H0DjsLRbxPsG4piiSGUcIy6GkGXF11SqOYoIeuUBivOsGXScaZnTyC1p4wFSR+GNmAM434/ALWw==",
|
||||
"version": "0.32.2",
|
||||
"resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.32.2.tgz",
|
||||
"integrity": "sha512-3UbFKtEmqApehPQnqdblcggx7KveQphEMKQmdJZsOguE9ylw2N2/9Z7arO7xS55+DBJ/hyP8RrayLt4MMdJvQg==",
|
||||
"requires": {
|
||||
"commander": "2.11.x",
|
||||
"ws": "^7.2.0"
|
||||
|
|
@ -11989,9 +11989,9 @@
|
|||
}
|
||||
},
|
||||
"execa": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.0.0.tgz",
|
||||
"integrity": "sha512-tQbH0pH/8LHTnwTrsKWideqi6rFB/QNUawEwrn+WHyz7PX1Tuz2u7wfTvbaNBdP5JD5LVWxNo8/A8CHNZ3bV6g==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz",
|
||||
"integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==",
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
|
|
@ -12722,9 +12722,9 @@
|
|||
}
|
||||
},
|
||||
"human-signals": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.0.tgz",
|
||||
"integrity": "sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ=="
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
|
||||
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ=="
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.1.13",
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
"@tgwf/co2": "0.12.2",
|
||||
"aws-sdk": "2.1327.0",
|
||||
"axe-core": "4.6.3",
|
||||
"browsertime": "17.8.1",
|
||||
"browsertime": "17.9.0",
|
||||
"coach-core": "7.1.3",
|
||||
"cli-color": "2.0.3",
|
||||
"concurrent-queue": "7.0.2",
|
||||
|
|
|
|||
Loading…
Reference in New Issue