@@ -12,6 +12,7 @@ import {
1212import { startBrowser } from "./puppeteerAccess.js" ;
1313import { computeResultsCPU , computeResultsJS , computeResultsPaint , fileNameTrace } from "./timeline.js" ;
1414import * as fs from "node:fs" ;
15+ import { performance } from "node:perf_hooks" ;
1516
1617let config : Config = defaultConfig ;
1718
@@ -283,21 +284,23 @@ export async function executeBenchmark(
283284 benchmarkId : string ,
284285 benchmarkOptions : BenchmarkOptions
285286) : Promise < ErrorAndWarning < any > > {
287+ const startTime = performance . now ( ) ;
286288 let runBenchmarks : Array < BenchmarkPuppeteer > = benchmarks . filter (
287289 ( b ) =>
288290 benchmarkId === b . benchmarkInfo . id && ( b instanceof CPUBenchmarkPuppeteer || b instanceof MemBenchmarkPuppeteer )
289291 ) as Array < BenchmarkPuppeteer > ;
290292 if ( runBenchmarks . length != 1 ) throw `Benchmark name ${ benchmarkId } is not unique (puppeteer)` ;
291293
292294 let benchmark = runBenchmarks [ 0 ] ;
293-
294295 let errorAndWarnings : ErrorAndWarning < any > ;
295296 if ( benchmark . type == BenchmarkType . CPU ) {
296297 errorAndWarnings = await runCPUBenchmark ( framework , benchmark as CPUBenchmarkPuppeteer , benchmarkOptions ) ;
297298 } else {
298299 errorAndWarnings = await runMemBenchmark ( framework , benchmark as MemBenchmarkPuppeteer , benchmarkOptions ) ;
299300 }
300301 if ( config . LOG_DEBUG ) console . log ( "benchmark finished - got errors promise" , errorAndWarnings ) ;
302+ const duration = performance . now ( ) - startTime ;
303+ console . log ( `=> Duration for ${ benchmark . benchmarkInfo . id } and framework ${ framework . name } : ${ duration . toFixed ( 2 ) } ms` )
301304 return errorAndWarnings ;
302305}
303306
0 commit comments