Skip to content

Commit 3ca8f60

Browse files
committed
render durations up to milliseconds
1 parent 1b5204f commit 3ca8f60

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

ghcide/bench/lib/Experiments.hs

+11-7
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
@@ -365,15 +366,15 @@ runBenchmarksFun dir allBenchmarks = do
365366
[ [ name,
366367
show success,
367368
show samples,
368-
show startup,
369-
show runSetup',
370-
show userWaits,
371-
show delayedWork,
372-
show $ firstResponse+firstResponseDelayed,
369+
showMs startup,
370+
showMs runSetup',
371+
showMs userWaits,
372+
showMs delayedWork,
373+
showMs $ firstResponse+firstResponseDelayed,
373374
-- Exclude first response as it has a lot of setup time included
374375
-- Assume that number of requests = number of modules * number of samples
375-
show ((userWaits - firstResponse)/((fromIntegral samples - 1)*modules)),
376-
show runExperiment,
376+
showMs ((userWaits - firstResponse)/((fromIntegral samples - 1)*modules)),
377+
showMs runExperiment,
377378
show rulesBuilt,
378379
show rulesChanged,
379380
show rulesVisited,
@@ -439,6 +440,9 @@ runBenchmarksFun dir allBenchmarks = do
439440
lspTestCaps =
440441
fullCaps {_window = Just $ WindowClientCapabilities (Just True) Nothing Nothing }
441442

443+
showMs :: Seconds -> String
444+
showMs = printf "%.2f"
445+
442446
data BenchRun = BenchRun
443447
{ startup :: !Seconds,
444448
runSetup :: !Seconds,

0 commit comments

Comments
 (0)