Skip to content

Commit d36498a

Browse files
committed
new tab per run
1 parent 5badc01 commit d36498a

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,18 @@ async function runCPUBenchmark(
6060

6161
console.log("benchmarking", framework, benchmark.benchmarkInfo.id);
6262
let browser: Browser = null;
63-
let page: Page = null;
63+
// let page: Page = null;
6464
try {
6565
browser = await startBrowser(benchmarkOptions);
66-
page = await browser.newPage();
66+
// page = await browser.newPage();
6767
// if (config.LOG_DETAILS) {
68-
page.on("console", (msg) => {
69-
for (let i = 0; i < msg.args().length; ++i) console.log(`BROWSER: ${msg.args()[i]}`);
70-
});
68+
// page.on("console", (msg) => {
69+
// for (let i = 0; i < msg.args().length; ++i) console.log(`BROWSER: ${msg.args()[i]}`);
70+
// });
7171
// }
7272
for (let i = 0; i < benchmarkOptions.batchSize; i++) {
73+
const page = await browser.newPage();
74+
page.on("console", (msg) => console.log('BROWSER:', ...msg.args()));
7375
try {
7476
await page.goto(`http://${benchmarkOptions.host}:${benchmarkOptions.port}/${framework.uri}/index.html`, {
7577
waitUntil: "networkidle0",
@@ -120,12 +122,13 @@ async function runCPUBenchmark(
120122
screenshots: false,
121123
categories: categories,
122124
});
125+
await wait(50);
123126
await forceGC(page, client);
124127
console.log("runBenchmark");
125128
let m1 = await page.metrics();
126129
await runBenchmark(page, benchmark, framework);
127130

128-
await wait(40);
131+
await wait(50);
129132
await page.tracing.stop();
130133
let m2 = await page.metrics();
131134
if (throttleCPU) {
@@ -142,6 +145,7 @@ async function runCPUBenchmark(
142145
);
143146
console.log("**** resultScript =", resultScript);
144147
if (m2.Timestamp == m1.Timestamp) throw new Error("Page metrics timestamp didn't change");
148+
await page.close();
145149
results.push({ total: result.duration, script: resultScript });
146150
console.log(`duration for ${framework.name} and ${benchmark.benchmarkInfo.id}: ${JSON.stringify(result)}`);
147151
if (result.duration < 0) throw new Error(`duration ${result} < 0`);

webdriver-ts/src/parseTrace.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import { computeResultsCPU, parseCPUTrace, PlausibilityCheck } from "./timeline.
44

55
async function debugSingle() {
66
let values = [];
7-
// for (let i = 0; i < 12; i++) {
8-
const trace = `unittests/dojo-v8.0.0-keyed_02_replace1k_0.json`;
7+
for (let i = 0; i < 15; i++) {
8+
const trace = `traces/anansi-v0.14.0-keyed_01_run1k_${i}.json`;
99
// const trace = `traces/alpine-v3.12.0-keyed_07_create10k_${i}.json`;
1010
// const trace = `traces/alpine-v3.12.0-keyed_07_create10k_0.jsontraces/1more-v0.1.18-keyed_01_run1k_0.json`;
1111
// const trace = `traces/alpine-v3.12.0-keyed_07_create10k_0.json`;
1212
// const trace = `traces/arrowjs-v1.0.0-alpha.9-keyed_07_create10k_0.json`;
1313
// const trace = `traces/better-react-v1.1.3-keyed_04_select1k_1.json`;
1414
// const trace = `traces/1more-v0.1.18-keyed_01_run1k_0.json`;
15-
console.log("analyzing trace", trace);
16-
const cpuTrace = await computeResultsCPU(trace);
17-
console.log(trace, cpuTrace);
18-
values.push(cpuTrace.duration);
15+
console.log("analyzing trace", trace);
16+
const cpuTrace = await computeResultsCPU(trace);
17+
console.log(trace, cpuTrace);
18+
values.push(cpuTrace.duration);
1919
// console.log(trace, await computeResultsJS(cpuTrace, config, trace, DurationMeasurementMode.LAST_PAINT))
20-
// }
20+
}
2121
console.log(values);
2222
}
2323

0 commit comments

Comments
 (0)