Closed Bug 1692921 Opened 4 years ago Closed 4 years ago

Markers 2.0 timings output null timestamps as 0.0 instead of JSON null, but front-end is not expecting zeroes

Categories

(Core :: Gecko Profiler, defect, P2)

defect

Tracking

()

RESOLVED MOVED

People

(Reporter: mozbugz, Assigned: mozbugz)

References

(Blocks 1 open bug)

Details

When markers were implemented with MarkerPayload-derived classes, some payloads had optional timing information, which could be output as JSON null for unspecified timestamps.
The front-end relies on these nulls when gauging the total visible range.

But since Markers 2.0 introduced better timing information (or maybe even before?), we now output unspecified timestamps as 0 (zero). This effectively forces all profiles to start at 0, which can be especially bad when most timestamps are later, e.g.: https://share.firefox.dev/2OCCOuF (the data is right at the end, around 27,000 seconds, but the range starts at 0 -- Thanks @Bas for reporting this issue.)

In the code, MarkerTiming::GetStartTime() and GetEndTime() return 0.0 for null timestamps, instead we should return Maybe<double>, so that DeserializeAfterKindAndStream could output nulls where appropriate.

It may also be possible for the front-end to fix "bad" profiles (from when this started until this fix lands), by detecting and ignoring unwanted zeroes.

Interestingly, a comment in MarkerTiming::timeStampToDouble says "The Phase lets us know not to use this [zero] value".

Greg, I think I stole this C++ code from your original prototype(?)
If you remember, did you imagine that the front-end would use the phase and discard these zeroes?
Looking at this front-end patch from issue #2626, the title "Teach getTimeRangeForThread about phased markers" would suggest that, but the implementation there doesn't seem to account for it. 🤔

So the cause and solution may not be as I initially thought, I'll update this bug title&priorities, and discuss this with the front-end team...

Flags: needinfo?(gtatum)
Priority: P1 → P2
Summary: Markers 2.0 timings output null timestamps as 0.0 instead of JSON null → Markers 2.0 timings output null timestamps as 0.0 instead of JSON null, but front-end is not expecting zeroes

Note: This only affects the front-end when there are no samples in the profile (otherwise only samples are used to gauge the time range).

It seems most of the front-end was already using marker phases as expected, except for the time range computation.
-> Moved to https://github.com/firefox-devtools/profiler/issues/3172

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(gtatum)
Resolution: --- → MOVED
You need to log in before you can comment on or make changes to this bug.