[perf.webkit.org] Update summary page calculations to use mean instead of median
authordean_johnson@apple.com <dean_johnson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 18:20:43 +0000 (18:20 +0000)
committerdean_johnson@apple.com <dean_johnson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 18:20:43 +0000 (18:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199050

Reviewed by Dewei Zhu.

* public/v3/pages/summary-page.js:
(SummaryPageConfigurationGroup): Updated 'median' references to 'mean'.
(SummaryPageConfigurationGroup.set _startAndEndPointForTimeRange): Factored out logic for finding data
points in a timeSeries, within a specified timeRange.
(SummaryPageConfigurationGroup.set _meanForTimeRange): New. Returns the mean of a timeSeries across a
given timeRange.

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

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

index 625a3fd..ace89f2 100644 (file)
@@ -1,3 +1,17 @@
+2019-06-24  Dean Johnson  <dean_johnson@apple.com>
+
+        [perf.webkit.org] Update summary page calculations to use mean instead of median
+        https://bugs.webkit.org/show_bug.cgi?id=199050
+
+        Reviewed by Dewei Zhu.
+
+        * public/v3/pages/summary-page.js:
+        (SummaryPageConfigurationGroup): Updated 'median' references to 'mean'.
+        (SummaryPageConfigurationGroup.set _startAndEndPointForTimeRange): Factored out logic for finding data
+        points in a timeSeries, within a specified timeRange.
+        (SummaryPageConfigurationGroup.set _meanForTimeRange): New. Returns the mean of a timeSeries across a
+        given timeRange.
+
 2019-06-20  Dewei Zhu  <dewei_zhu@apple.com>
 
         Fix a bug that 'test_metrics' and 'tests' tables are not joined correctly in CommitLogFetcher.fetch_latest_for_platform
index 05c6013..e4619b1 100644 (file)
@@ -346,21 +346,21 @@ class SummaryPageConfigurationGroup {
             var baselineTimeSeries = set.fetchedTimeSeries('baseline', false, false);
             var currentTimeSeries = set.fetchedTimeSeries('current', false, false);
 
-            var baselineMedian = SummaryPageConfigurationGroup._medianForTimeRange(baselineTimeSeries, timeRange);
-            var currentMedian = SummaryPageConfigurationGroup._medianForTimeRange(currentTimeSeries, timeRange);
+            const baselineMean = SummaryPageConfigurationGroup._meanForTimeRange(baselineTimeSeries, timeRange);
+            const currentMean = SummaryPageConfigurationGroup._meanForTimeRange(currentTimeSeries, timeRange);
             var platform = Platform.findById(set.platformId());
-            if (!currentMedian)
+            if (!currentMean)
                 self._missingPlatforms.add(platform);
-            else if (!baselineMedian)
+            else if (!baselineMean)
                 self._platformsWithoutBaseline.add(platform);
 
-            setToRatio.set(set, currentMedian / baselineMedian);
+            setToRatio.set(set, currentMean / baselineMean);
         }).catch(function () {
             setToRatio.set(set, NaN);
         });
     }
 
-    static _medianForTimeRange(timeSeries, timeRange)
+    static _startAndEndPointForTimeRange(timeSeries, timeRange)
     {
         if (!timeSeries.firstPoint())
             return NaN;
@@ -371,6 +371,12 @@ class SummaryPageConfigurationGroup {
         if (!endPoint || startPoint == afterEndPoint)
             endPoint = afterEndPoint;
 
-        return Statistics.median(timeSeries.viewBetweenPoints(startPoint, endPoint).values());
+        return [startPoint, endPoint];
+    }
+
+    static _meanForTimeRange(timeSeries, timeRange)
+    {
+        const [startPoint, endPoint] = SummaryPageConfigurationGroup._startAndEndPointForTimeRange(timeSeries, timeRange);
+        return Statistics.mean(timeSeries.viewBetweenPoints(startPoint, endPoint).values());
     }
 }