Skip to content

Commit 380cc22

Browse files
committed
Mute all errors from GC finite state machine assumption failures
unless assertions are turned on. This is to avoid any future breakages due to wrong events order, as in #35 (and probably in #46). For any events where the order is indeed wrong, the TS GC stats for that particular GC are more ore less inaccurate. This probably doesn't happen if the eventlogs are collected on an OS with a good resolution of a time source (e.g., on modern Linux).
1 parent 9ad9987 commit 380cc22

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

GUI/SummaryView.hs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,10 @@ emptyGenStat = GenStat
687687
, gcMaxPause = 0
688688
}
689689

690+
-- Fail only when assertions are turned on.
691+
errorAs :: String -> a -> a
692+
errorAs msg a = assert (error msg) a
693+
690694
accumEvent :: StatsAccum -> CapEvent -> StatsAccum
691695
accumEvent !statsAccum (CapEvent mcap ev) =
692696
let -- For events that contain a counter with a running sum.
@@ -775,8 +779,8 @@ accumEvent !statsAccum (CapEvent mcap ev) =
775779
ModeEnd -> dGC { gcMode = ModeIdle }
776780
ModeIdle -> dGC
777781
-- Impossible.
778-
ModeInit -> error "scanEvents: GlobalSyncGC ModeInit"
779-
ModeSync{} -> error "scanEvents: GlobalSyncGC ModeSync"
782+
ModeInit -> errorAs "scanEvents: GlobalSyncGC ModeInit" dGC
783+
ModeSync{} -> errorAs "scanEvents: GlobalSyncGC ModeSync" dGC
780784
ModeGHC{} -> -- error "scanEvents: GlobalSyncGC ModeGHC"
781785
dGC -- workaround for #46
782786
GCStatsGHC{..} ->
@@ -838,7 +842,7 @@ accumEvent !statsAccum (CapEvent mcap ev) =
838842
-- Cap not in the current GC, leave it alone.
839843
ModeIdle -> dGC
840844
-- Impossible.
841-
ModeInit -> error "scanEvents: GCStatsGHC ModeInit"
845+
ModeInit -> errorAs "scanEvents: GCStatsGHC ModeInit" dGC
842846
ModeGHC{} -> -- error "scanEvents: GCStatsGHC ModeGHC"
843847
dGC -- workaround for #46
844848
-- The last two cases are copied from case @GlobalSyncGC@
@@ -917,8 +921,9 @@ accumEvent !statsAccum (CapEvent mcap ev) =
917921
in sd { dGCTable = IM.insert cap newTime dGCTable
918922
, dGCMain = Just newMain
919923
}
920-
ModeEnd -> error "scanEvents: EndGC ModeEnd"
921-
ModeIdle -> error "scanEvents: EndGC ModeIdle"
924+
ModeEnd -> errorAs "scanEvents: EndGC ModeEnd" sd
925+
ModeIdle -> errorAs "scanEvents: EndGC ModeIdle"
926+
$ sd { dGCTable = IM.insert cap endedGC dGCTable }
922927
SparkCounters crt dud ovf cnv fiz gcd _rem ->
923928
-- We are guranteed the first spark counters event has all zeroes,
924929
-- do we don't need to rig the counters for maximal interval.

0 commit comments

Comments
 (0)