Skip to content

Commit

Permalink
ui: Avoid moving initial visible window start time past its end
Browse files Browse the repository at this point in the history
- As of aosp/2649039, upon loading a trace, we move the start of the
  initial visible window to the first ftrace event.
- In some traces, the first ftrace event is after the end of the initial
  visible window calculated from the tracing metadata.
- On loading these traces, the UI would immediately crash as time spans
  of negative duration are not allowed.
- This CL limits how far back we can move the start of the visible
  window, avoiding negative time spans.

Bug: 325015524
Change-Id: I087318ed3fba51353d47afae106d7c9c51a77f00
  • Loading branch information
stevegolton committed Mar 11, 2024
1 parent 3766d8b commit e953a42
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/src/controller/trace_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,9 +1159,11 @@ async function computeVisibleTime(
visibleStart = Time.max(visibleStart, reliableRangeStart);
}

// Move start of visible window to the first ftrace event
const ftraceBounds = await computeFtraceBounds(engine);
if (ftraceBounds !== null) {
visibleStart = ftraceBounds.start;
// Avoid moving start of visible window past its end!
visibleStart = Time.min(ftraceBounds.start, visibleEnd);
}
return HighPrecisionTimeSpan.fromTime(visibleStart, visibleEnd);
}

0 comments on commit e953a42

Please sign in to comment.