From 1676c96e56f23083308629064b7b66c44535068e Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 15 Jun 2026 13:27:02 +0200 Subject: [PATCH 1/2] initial-implementation --- resources/developer-mode.mjs | 10 ++++++++++ resources/shared/params.mjs | 6 ++++++ resources/suite-runner.mjs | 13 +++++++++++++ 3 files changed, 29 insertions(+) diff --git a/resources/developer-mode.mjs b/resources/developer-mode.mjs index fdd254775..9b67d1e7e 100644 --- a/resources/developer-mode.mjs +++ b/resources/developer-mode.mjs @@ -23,7 +23,9 @@ export function createDeveloperModeContainer() { settings.append(createUIForMeasurePrepare()); settings.append(createUIForWarmupSuite()); settings.append(createUIForWarmupBeforeSync()); + settings.append(createUIForWaitAfterSetup()); settings.append(createUIForSyncStepDelay()); + settings.append(createUIForWaitAfterSuite()); settings.append(createUIForAsyncSteps()); settings.append(createUIForLayoutMode()); @@ -89,6 +91,14 @@ function createUIForSyncStepDelay() { return createTimeRangeUI("Sync step delay: ", "waitBeforeSync"); } +function createUIForWaitAfterSetup() { + return createTimeRangeUI("Post setup delay: ", "waitAfterSetup"); +} + +function createUIForWaitAfterSuite() { + return createTimeRangeUI("Post suite delay: ", "waitAfterSuite"); +} + function createTimeRangeUI(labelText, paramKey, unit = "ms", min = 0, max = 1000) { const range = document.createElement("input"); range.type = "range"; diff --git a/resources/shared/params.mjs b/resources/shared/params.mjs index 520679d24..82306fd84 100644 --- a/resources/shared/params.mjs +++ b/resources/shared/params.mjs @@ -20,8 +20,12 @@ export class Params { // "timer": The classic (as in Speedometer 2.x) way using setTimeout // "raf": Using rAF callbacks, both for triggering the sync part and for measuring async time. measurementMethod = "raf"; + // Wait time after suite preparation in ms. + waitAfterSetup = 0; // Wait time before the sync step in ms. waitBeforeSync = 0; + // Wait after running a suite. + waitAfterSuite = 0; // Warmup time before the sync step in ms. warmupBeforeSync = 0; // Seed for shuffling the execution order of suites. @@ -61,7 +65,9 @@ export class Params { this.developerMode = this._parseBooleanParam(searchParams, "developerMode"); this.useWarmupSuite = this._parseBooleanParam(searchParams, "useWarmupSuite"); this.useAsyncSteps = this._parseBooleanParam(searchParams, "useAsyncSteps"); + this.waitAfterSetup = this._parseIntParam(searchParams, "waitAfterSetup", 0); this.waitBeforeSync = this._parseIntParam(searchParams, "waitBeforeSync", 0); + this.waitAfterSuite = this._parseIntParam(searchParams, "waitAfterSuite", 0); this.warmupBeforeSync = this._parseIntParam(searchParams, "warmupBeforeSync", 0); this.measurementMethod = this._parseEnumParam(searchParams, "measurementMethod", ["raf"]); this.shuffleSeed = this._parseShuffleSeed(searchParams); diff --git a/resources/suite-runner.mjs b/resources/suite-runner.mjs index bb37318b0..1a8cb11a8 100644 --- a/resources/suite-runner.mjs +++ b/resources/suite-runner.mjs @@ -1,6 +1,11 @@ import { STEP_RUNNER_LOOKUP } from "./shared/step-runner.mjs"; import { WarmupSuite } from "./benchmark-runner.mjs"; +function delay(ms) { + if (ms > 0) + return new Promise((resolve) => setTimeout(resolve, ms)); +} + export class SuiteRunner { #frame; #page; @@ -72,6 +77,8 @@ export class SuiteRunner { const suiteStartLabel = `suite-${suiteName}-start`; const suiteEndLabel = `suite-${suiteName}-end`; + await delay(this.#params.waitAfterSetup); + performance.mark(suiteStartLabel); for (const step of this.#suite.tests) { if (this.#client?.willRunTest) @@ -84,6 +91,8 @@ export class SuiteRunner { } performance.mark(suiteEndLabel); + await delay(this.#params.waitAfterSuite); + performance.measure(`suite-${suiteName}`, suiteStartLabel, suiteEndLabel); this._validateSuiteResults(); await this._updateClient(); @@ -178,11 +187,15 @@ export class RemoteSuiteRunner extends SuiteRunner { } async _runSuite() { + await delay(this.params.waitAfterSetup); + // Ask workload to run its own tests. this.frame.contentWindow.postMessage({ id: this.appId, key: "benchmark-connector", type: "benchmark-suite", name: this.suite.config?.name || "default" }, "*"); // Capture metrics from the completed tests. const response = await this._subscribeOnce("suite-complete"); + await delay(this.params.waitAfterSuite); + this.suiteResults.tests = { ...this.suiteResults.tests, ...response.result.tests, From a1826dbb21a5fe1181611988ae404f8196fe238a Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Mon, 15 Jun 2026 13:27:44 +0200 Subject: [PATCH 2/2] cleanup --- resources/suite-runner.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/suite-runner.mjs b/resources/suite-runner.mjs index 1a8cb11a8..83bd3dd31 100644 --- a/resources/suite-runner.mjs +++ b/resources/suite-runner.mjs @@ -4,6 +4,7 @@ import { WarmupSuite } from "./benchmark-runner.mjs"; function delay(ms) { if (ms > 0) return new Promise((resolve) => setTimeout(resolve, ms)); + return undefined; } export class SuiteRunner {