Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions GUI/SummaryView.hs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ setSummaryStats view SummaryStats{..} hasHeapEvents = do
setTimeStats :: SummaryView -> TimeStats -> IO ()
setTimeStats SummaryView{..} TimeStats{..} =
mapM_ (\(label, text) -> set label [ labelText := text ])
[ (labelTimeTotal , showFFloat (Just 2) (timeToSecondsDbl timeTotal) "s")
, (labelTimeMutator , showFFloat (Just 2) (timeToSecondsDbl timeMutator) "s")
, (labelTimeGC , showFFloat (Just 2) (timeToSecondsDbl timeGC) "s")
[ (labelTimeTotal , showTimeWithUnit timeTotal)
, (labelTimeMutator , showTimeWithUnit timeMutator)
, (labelTimeGC , showTimeWithUnit timeGC)
, (labelTimeProductivity, showFFloat (Just 1) (timeProductivity * 100) "% of mutator vs total")
]

Expand Down Expand Up @@ -563,6 +563,17 @@ sparkStats StatsAccum{dsparkTable} =

------------------------------------------------------------------------------

showTimeWithUnit :: Integral a => a -> String
showTimeWithUnit t =
showFFloat (Just 3) t'' unit
where
(t'', unit) =
case timeToSecondsDbl t of
t' | t' < 1e-6 -> (t' / 1e-9, "ns")
| t' < 1e-3 -> (t' / 1e-6, "μs")
| t' < 1 -> (t' / 1e-3, "ms")
| otherwise -> (t', "s")

timeToSecondsDbl :: Integral a => a -> Double
timeToSecondsDbl t = timeToSeconds $ fromIntegral t

Expand Down