Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: tracing/tracing/extras/chrome/estimated_input_latency.html

Issue 2871573006: Gracefully handle floating-point precision errors in the EQT metric. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tracing/tracing/extras/chrome/estimated_input_latency_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/extras/chrome/estimated_input_latency.html
diff --git a/tracing/tracing/extras/chrome/estimated_input_latency.html b/tracing/tracing/extras/chrome/estimated_input_latency.html
index 01e12528d5340020b3f1dcb9f11c980456f87dc9..34be38a3a1fb895a2b0f516d818977267fb569ba 100644
--- a/tracing/tracing/extras/chrome/estimated_input_latency.html
+++ b/tracing/tracing/extras/chrome/estimated_input_latency.html
@@ -313,14 +313,21 @@ tr.exportTo('tr.e.chrome', function() {
for (let i = 1; i < sortedTasks.length; i++) {
// Due to floating-point precision errors it might happen that the end
// of the previous task is larger than the start of the current task.
- // Here is an example from a real trace of system-health benchmark:
- // Task 1: start=1932.0179090499878 end=1932.070909049988.
- // Task 2: start=1932.0709090232850 end=1932.118909023285.
+ // Here is an example from a real trace:
+ // Task 1: start=25851.0181016922 end=25851.0481016922
+ // Task 2: start=25851.0251016616 end=34496.0291013717.
// To account for precision errors we consider tasks as overlapping
// if the overlap is sufficiently large.
- if (sortedTasks[i - 1].end > sortedTasks[i].start + 1e-3) {
+ const PRECISION_MS = 0.1;
+ if (sortedTasks[i - 1].end > sortedTasks[i].start + PRECISION_MS) {
throw Error('Tasks must not overlap');
}
+ // Ensure that the previous task finishes not later than the current task.
+ if (sortedTasks[i - 1].end > sortedTasks[i].start) {
+ const midpoint = (sortedTasks[i - 1].end + sortedTasks[i].start) / 2;
+ sortedTasks[i - 1].end = midpoint;
+ sortedTasks[i].start = midpoint;
+ }
}
// Collect all time points that the sliding window needs to stop at.
« no previous file with comments | « no previous file | tracing/tracing/extras/chrome/estimated_input_latency_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698