Skip to content

Commit a3467aa

Browse files
committed
render durations up to milliseconds
1 parent e85a7e0 commit a3467aa

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

ghcide/bench/lib/Experiments.hs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import System.FilePath ((<.>), (</>))
6161
import System.Process
6262
import System.Time.Extra
6363
import Text.ParserCombinators.ReadP (readP_to_S)
64+
import Text.Printf
6465
charEdit :: Position -> TextDocumentContentChangeEvent
6566
charEdit p =
6667
TextDocumentContentChangeEvent
@@ -368,15 +369,15 @@ runBenchmarksFun dir allBenchmarks = do
368369
[ [ name,
369370
show success,
370371
show samples,
371-
show startup,
372-
show runSetup',
373-
show userWaits,
374-
show delayedWork,
375-
show $ firstResponse+firstResponseDelayed,
372+
showMs startup,
373+
showMs runSetup',
374+
showMs userWaits,
375+
showMs delayedWork,
376+
showMs $ firstResponse+firstResponseDelayed,
376377
-- Exclude first response as it has a lot of setup time included
377378
-- Assume that number of requests = number of modules * number of samples
378-
show ((userWaits - firstResponse)/((fromIntegral samples - 1)*modules)),
379-
show runExperiment,
379+
showMs ((userWaits - firstResponse)/((fromIntegral samples - 1)*modules)),
380+
showMs runExperiment,
380381
show rulesBuilt,
381382
show rulesChanged,
382383
show rulesVisited,
@@ -443,6 +444,9 @@ runBenchmarksFun dir allBenchmarks = do
443444
lspTestCaps =
444445
fullCaps {_window = Just $ WindowClientCapabilities (Just True) Nothing Nothing }
445446

447+
showMs :: Seconds -> String
448+
showMs = printf "%.2f"
449+
446450
data BenchRun = BenchRun
447451
{ startup :: !Seconds,
448452
runSetup :: !Seconds,

0 commit comments

Comments
 (0)