@@ -37,7 +37,9 @@ import Development.IDE.Test (getBuildEdgesCount,
37
37
getBuildKeysBuilt ,
38
38
getBuildKeysChanged ,
39
39
getBuildKeysVisited ,
40
- getStoredKeys )
40
+ getStoredKeys ,
41
+ getRebuildsCount ,
42
+ )
41
43
import Development.IDE.Test.Diagnostic
42
44
import Development.Shake (CmdOption (Cwd , FileStdout ),
43
45
cmd_ )
@@ -329,12 +331,15 @@ runBenchmarksFun dir allBenchmarks = do
329
331
, " setup"
330
332
, " userTime"
331
333
, " delayedTime"
334
+ , " firstBuildTime"
335
+ , " averageTimePerResponse"
332
336
, " totalTime"
333
337
, " buildRulesBuilt"
334
338
, " buildRulesChanged"
335
339
, " buildRulesVisited"
336
340
, " buildRulesTotal"
337
341
, " buildEdges"
342
+ , " ghcRebuilds"
338
343
]
339
344
rows =
340
345
[ [ name,
@@ -344,15 +349,19 @@ runBenchmarksFun dir allBenchmarks = do
344
349
show runSetup',
345
350
show userWaits,
346
351
show delayedWork,
352
+ show $ firstResponse+ firstResponseDelayed,
353
+ show ((userWaits - firstResponse)/ ((fromIntegral samples - 1 )* modules)),
347
354
show runExperiment,
348
355
show rulesBuilt,
349
356
show rulesChanged,
350
357
show rulesVisited,
351
358
show rulesTotal,
352
- show edgesTotal
359
+ show edgesTotal,
360
+ show rebuildsTotal
353
361
]
354
362
| (Bench {name, samples}, BenchRun {.. }) <- results,
355
363
let runSetup' = if runSetup < 0.01 then 0 else runSetup
364
+ modules = fromIntegral $ length $ exampleModules $ example ? config
356
365
]
357
366
csv = unlines $ map (intercalate " , " ) (headers : rows)
358
367
writeFile (outputCSV ? config) csv
@@ -369,12 +378,14 @@ runBenchmarksFun dir allBenchmarks = do
369
378
showDuration runSetup',
370
379
showDuration userWaits,
371
380
showDuration delayedWork,
381
+ showDuration firstResponse,
372
382
showDuration runExperiment,
373
383
show rulesBuilt,
374
384
show rulesChanged,
375
385
show rulesVisited,
376
386
show rulesTotal,
377
- show edgesTotal
387
+ show edgesTotal,
388
+ show rebuildsTotal
378
389
]
379
390
| (Bench {name, samples}, BenchRun {.. }) <- results,
380
391
let runSetup' = if runSetup < 0.01 then 0 else runSetup
@@ -420,16 +431,19 @@ data BenchRun = BenchRun
420
431
runExperiment :: ! Seconds ,
421
432
userWaits :: ! Seconds ,
422
433
delayedWork :: ! Seconds ,
434
+ firstResponse :: ! Seconds ,
435
+ firstResponseDelayed :: ! Seconds ,
423
436
rulesBuilt :: ! Int ,
424
437
rulesChanged :: ! Int ,
425
438
rulesVisited :: ! Int ,
426
439
rulesTotal :: ! Int ,
427
440
edgesTotal :: ! Int ,
441
+ rebuildsTotal :: ! Int ,
428
442
success :: ! Bool
429
443
}
430
444
431
445
badRun :: BenchRun
432
- badRun = BenchRun 0 0 0 0 0 0 0 0 0 0 False
446
+ badRun = BenchRun 0 0 0 0 0 0 0 0 0 0 0 0 0 False
433
447
434
448
waitForProgressStart :: Session ()
435
449
waitForProgressStart = void $ do
@@ -482,26 +496,28 @@ runBench runSess b = handleAny (\e -> print e >> return badRun)
482
496
483
497
liftIO $ output $ " Running " <> name <> " benchmark"
484
498
(runSetup, () ) <- duration $ benchSetup docs
485
- let loop ! userWaits ! delayedWork 0 = return $ Just (userWaits, delayedWork)
486
- loop ! userWaits ! delayedWork n = do
499
+ let loop' ( Just timeForFirstResponse) ! userWaits ! delayedWork 0 = return $ Just (userWaits, delayedWork, timeForFirstResponse )
500
+ loop' timeForFirstResponse ! userWaits ! delayedWork n = do
487
501
(t, res) <- duration $ experiment docs
488
502
if not res
489
503
then return Nothing
490
504
else do
491
505
output (showDuration t)
492
506
-- Wait for the delayed actions to finish
493
507
td <- waitForBuildQueue
494
- loop (userWaits+ t) (delayedWork+ td) (n - 1 )
508
+ loop' (timeForFirstResponse <|> (Just (t,td))) (userWaits+ t) (delayedWork+ td) (n - 1 )
509
+ loop = loop' Nothing
495
510
496
511
(runExperiment, result) <- duration $ loop 0 0 samples
497
512
let success = isJust result
498
- (userWaits, delayedWork) = fromMaybe (0 ,0 ) result
513
+ (userWaits, delayedWork, (firstResponse, firstResponseDelayed)) = fromMaybe (0 ,0 ,( 0 , 0 ) ) result
499
514
500
515
rulesTotal <- length <$> getStoredKeys
501
516
rulesBuilt <- either (const 0 ) length <$> getBuildKeysBuilt
502
517
rulesChanged <- either (const 0 ) length <$> getBuildKeysChanged
503
518
rulesVisited <- either (const 0 ) length <$> getBuildKeysVisited
504
519
edgesTotal <- fromRight 0 <$> getBuildEdgesCount
520
+ rebuildsTotal <- fromRight 0 <$> getRebuildsCount
505
521
506
522
return BenchRun {.. }
507
523
0 commit comments