Fix a bug from r226303 that latest build time is not correctly calculated.
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 01:55:13 +0000 (01:55 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Mar 2019 01:55:13 +0000 (01:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195912

Reviewed by Ryosuke Niwa.

Time series is ordered by revision time which does not grantee the build time is
monotonically increasing.

* public/v3/pages/test-freshness-page.js: Use the latest build time instead of the build time of
last point on the chart.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243123 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/v3/pages/test-freshness-page.js

index c33ed1e..b2e9109 100644 (file)
@@ -1,3 +1,16 @@
+2019-03-18  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Fix a bug from r226303 that latest build time is not correctly calculated.
+        https://bugs.webkit.org/show_bug.cgi?id=195912
+
+        Reviewed by Ryosuke Niwa.
+
+        Time series is ordered by revision time which does not grantee the build time is
+        monotonically increasing.
+
+        * public/v3/pages/test-freshness-page.js: Use the latest build time instead of the build time of
+        last point on the chart.
+
 2019-03-13  Dewei Zhu  <dewei_zhu@apple.com>
 
         Test freshness page should improve the ability to correlating issues from same builder.
index 2023348..5ed433d 100644 (file)
@@ -88,17 +88,26 @@ class TestFreshnessPage extends PageWithHeading {
                 measurementSet.fetchBetween(startTime, this._measurementSetFetchTime).then(() => {
                     const currentTimeSeries = measurementSet.fetchedTimeSeries('current', false, false);
 
-                    let timeForLastDataPoint = startTime;
+                    let timeForLatestBuild = startTime;
                     let lastBuildLink = null;
                     let builder = null;
                     const lastPoint = currentTimeSeries.lastPoint();
                     if (lastPoint) {
-                        timeForLastDataPoint = lastPoint.build().buildTime();
-                        lastBuildLink = lastPoint.build().url();
-                        builder = lastPoint.build().builder();
+                        timeForLatestBuild = lastPoint.build().buildTime().getTime();
+                        const view = currentTimeSeries.viewBetweenPoints(currentTimeSeries.firstPoint(), lastPoint);
+                        for (const point of view) {
+                            const build = point.build();
+                            if (!build)
+                                continue;
+                            if (build.buildTime().getTime() >= timeForLatestBuild) {
+                                timeForLatestBuild = build.buildTime().getTime();
+                                lastBuildLink = build.url();
+                                builder = build.builder();
+                            }
+                        }
                     }
 
-                    lastDataPointByMetric.set(metric, {time: timeForLastDataPoint, hasCurrentDataPoint: !!currentTimeSeries.lastPoint(),
+                    lastDataPointByMetric.set(metric, {time: timeForLatestBuild, hasCurrentDataPoint: !!lastPoint,
                         lastBuildLink, builder});
                     this.enqueueToRender();
                 });