Bug 1841631 - Clamp minimum time durations to zero on Windows r=sfink
commitc9db258569f25baa7118bc06f1785cbd27f9201b
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 11 Jul 2023 08:49:30 +0000 (11 08:49 +0000)
committerJon Coppeard <jcoppeard@mozilla.com>
Tue, 11 Jul 2023 08:49:30 +0000 (11 08:49 +0000)
tree2924a85337f936ee28026712d66da8178b51b766
parentc6abc3936464f3ae23e84d01ff1e0fd7819b2fb6
Bug 1841631 - Clamp minimum time durations to zero on Windows r=sfink

This seems to be failing on Windows only. The code to calculate MMU looks
correct and I don't see how it can result in something less than zero. We know
we can get non-monotonic timestamps sometimes, so let's try to work around this
on Windows.

The patch replaces everywhere in the statistics code where we calculate the
duration between two timestamps with a function that clamps the minimum to
zero, but only on Windows. Other platforms get an assert to make sure we don't
mess up.

Differential Revision: https://phabricator.services.mozilla.com/D183169
js/src/gc/Statistics.cpp
js/src/gc/Statistics.h