From d36498abe9ed6fea63cdcb8ca7e5b575b94f7383 Mon Sep 17 00:00:00 2001 From: Stefan Krause Date: Tue, 7 Nov 2023 20:33:10 +0100 Subject: [PATCH] new tab per run --- .../src/forkedBenchmarkRunnerPuppeteer.ts | 16 ++++++++++------ webdriver-ts/src/parseTrace.ts | 14 +++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts b/webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts index 9c60dd09f..653606704 100644 --- a/webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts +++ b/webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts @@ -60,16 +60,18 @@ async function runCPUBenchmark( console.log("benchmarking", framework, benchmark.benchmarkInfo.id); let browser: Browser = null; - let page: Page = null; + // let page: Page = null; try { browser = await startBrowser(benchmarkOptions); - page = await browser.newPage(); + // page = await browser.newPage(); // if (config.LOG_DETAILS) { - page.on("console", (msg) => { - for (let i = 0; i < msg.args().length; ++i) console.log(`BROWSER: ${msg.args()[i]}`); - }); + // page.on("console", (msg) => { + // for (let i = 0; i < msg.args().length; ++i) console.log(`BROWSER: ${msg.args()[i]}`); + // }); // } for (let i = 0; i < benchmarkOptions.batchSize; i++) { + const page = await browser.newPage(); + page.on("console", (msg) => console.log('BROWSER:', ...msg.args())); try { await page.goto(`http://${benchmarkOptions.host}:${benchmarkOptions.port}/${framework.uri}/index.html`, { waitUntil: "networkidle0", @@ -120,12 +122,13 @@ async function runCPUBenchmark( screenshots: false, categories: categories, }); + await wait(50); await forceGC(page, client); console.log("runBenchmark"); let m1 = await page.metrics(); await runBenchmark(page, benchmark, framework); - await wait(40); + await wait(50); await page.tracing.stop(); let m2 = await page.metrics(); if (throttleCPU) { @@ -142,6 +145,7 @@ async function runCPUBenchmark( ); console.log("**** resultScript =", resultScript); if (m2.Timestamp == m1.Timestamp) throw new Error("Page metrics timestamp didn't change"); + await page.close(); results.push({ total: result.duration, script: resultScript }); console.log(`duration for ${framework.name} and ${benchmark.benchmarkInfo.id}: ${JSON.stringify(result)}`); if (result.duration < 0) throw new Error(`duration ${result} < 0`); diff --git a/webdriver-ts/src/parseTrace.ts b/webdriver-ts/src/parseTrace.ts index 3b4d53e53..a98a78bfd 100644 --- a/webdriver-ts/src/parseTrace.ts +++ b/webdriver-ts/src/parseTrace.ts @@ -4,20 +4,20 @@ import { computeResultsCPU, parseCPUTrace, PlausibilityCheck } from "./timeline. async function debugSingle() { let values = []; - // for (let i = 0; i < 12; i++) { - const trace = `unittests/dojo-v8.0.0-keyed_02_replace1k_0.json`; + for (let i = 0; i < 15; i++) { + const trace = `traces/anansi-v0.14.0-keyed_01_run1k_${i}.json`; // const trace = `traces/alpine-v3.12.0-keyed_07_create10k_${i}.json`; // const trace = `traces/alpine-v3.12.0-keyed_07_create10k_0.jsontraces/1more-v0.1.18-keyed_01_run1k_0.json`; // const trace = `traces/alpine-v3.12.0-keyed_07_create10k_0.json`; // const trace = `traces/arrowjs-v1.0.0-alpha.9-keyed_07_create10k_0.json`; // const trace = `traces/better-react-v1.1.3-keyed_04_select1k_1.json`; // const trace = `traces/1more-v0.1.18-keyed_01_run1k_0.json`; - console.log("analyzing trace", trace); - const cpuTrace = await computeResultsCPU(trace); - console.log(trace, cpuTrace); - values.push(cpuTrace.duration); + console.log("analyzing trace", trace); + const cpuTrace = await computeResultsCPU(trace); + console.log(trace, cpuTrace); + values.push(cpuTrace.duration); // console.log(trace, await computeResultsJS(cpuTrace, config, trace, DurationMeasurementMode.LAST_PAINT)) - // } + } console.log(values); }