Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions resources/developer-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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";
Expand Down
6 changes: 6 additions & 0 deletions resources/shared/params.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions resources/suite-runner.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
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));
return undefined;
}

export class SuiteRunner {
#frame;
#page;
Expand Down Expand Up @@ -72,6 +78,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)
Expand All @@ -84,6 +92,8 @@ export class SuiteRunner {
}
performance.mark(suiteEndLabel);

await delay(this.#params.waitAfterSuite);

performance.measure(`suite-${suiteName}`, suiteStartLabel, suiteEndLabel);
this._validateSuiteResults();
await this._updateClient();
Expand Down Expand Up @@ -178,11 +188,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,
Expand Down
Loading