Negative elapsed time in the third-party-module ping
Categories
(Core :: mozglue, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: toshi, Assigned: toshi)
References
Details
Attachments
(1 file)
We can see a number of instances of the third-party-module ping have a negative number in payload.processes[PID].value.elapsed
like -9,223,362,128.71
, which is unexpected. Probably it's caused by int64 overflow (-9223372036854775808 = 80000000`00000000) somewehere.
Assignee | ||
Comment 1•6 years ago
|
||
GetProcessTimes
is based on QPC, while GetSystemTime
is based on clock
interruption whose accuracy is lower than QPC. This means in a process's early
stage, GetSystemTime
may return a timestamp earlier than creation timestamp.
If this happens we'll have a negative process uptime.
Win8+ has a handy API GetSystemTimePreciseAsFileTime
that solves everything.
On Win7, GetSystemTimeAsFileTime
still solves this issue. In the worst case,
it returns the exact same timestamp as process creation, but it's ok.
Because the system time is stored as a FILETIME
in KUSER
, converting it to
a SYSTEMTIME
with GetSystemTime
drops accuracy. We shoudl avoid it unless
needed.
This patch also moves the call to GetProcessTimes
before getting the current
timestamp in case clock interruption happens in between those two function calls.
Updated•6 years ago
|
Comment 3•6 years ago
|
||
bugherder |
Description
•