Title: [210673] trunk/Websites/perf.webkit.org
Revision
210673
Author
[email protected]
Date
2017-01-12 11:32:20 -0800 (Thu, 12 Jan 2017)

Log Message

Outliers are not hidden in v3 UI
https://bugs.webkit.org/show_bug.cgi?id=166966

Reviewed by Andreas Kling.

Fixed the typo in addToSeries. An outlier has markedOutlier set to true, not isOutlier.

Also fixed a bug unveiled by new tests in MeasurementRootSet.ensureSingleton. It was was creating
a new MeasurementRootSet each time it was called instead of finding an existing instance. Fixed the bug
by merging the static maps of MeasurementRootSet and RootSet.

* public/v3/models/measurement-cluster.js:
(MeasurementCluster.prototype.addToSeries): Fixed the bug.
* public/v3/models/root-set.js:
(MeasurementRootSet.prototype.namedStaticMap): Added.
(MeasurementRootSet.prototype.ensureNamedStaticMap): Added.
(MeasurementRootSet.namedStaticMap): Added.
(MeasurementRootSet.ensureNamedStaticMap): Added.
* unit-tests/measurement-set-tests.js: Added tests for adopting time series data from a cluster.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (210672 => 210673)


--- trunk/Websites/perf.webkit.org/ChangeLog	2017-01-12 19:27:54 UTC (rev 210672)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2017-01-12 19:32:20 UTC (rev 210673)
@@ -1,5 +1,27 @@
 2017-01-12  Ryosuke Niwa  <[email protected]>
 
+        Outliers are not hidden in v3 UI
+        https://bugs.webkit.org/show_bug.cgi?id=166966
+
+        Reviewed by Andreas Kling.
+
+        Fixed the typo in addToSeries. An outlier has markedOutlier set to true, not isOutlier.
+
+        Also fixed a bug unveiled by new tests in MeasurementRootSet.ensureSingleton. It was was creating
+        a new MeasurementRootSet each time it was called instead of finding an existing instance. Fixed the bug
+        by merging the static maps of MeasurementRootSet and RootSet.
+
+        * public/v3/models/measurement-cluster.js:
+        (MeasurementCluster.prototype.addToSeries): Fixed the bug.
+        * public/v3/models/root-set.js:
+        (MeasurementRootSet.prototype.namedStaticMap): Added.
+        (MeasurementRootSet.prototype.ensureNamedStaticMap): Added.
+        (MeasurementRootSet.namedStaticMap): Added.
+        (MeasurementRootSet.ensureNamedStaticMap): Added.
+        * unit-tests/measurement-set-tests.js: Added tests for adopting time series data from a cluster.
+
+2017-01-12  Ryosuke Niwa  <[email protected]>
+
         Hide the UI to trigger an A/B testing when there are no triggerables
         https://bugs.webkit.org/show_bug.cgi?id=166964
 

Modified: trunk/Websites/perf.webkit.org/public/v3/models/measurement-cluster.js (210672 => 210673)


--- trunk/Websites/perf.webkit.org/public/v3/models/measurement-cluster.js	2017-01-12 19:27:54 UTC (rev 210672)
+++ trunk/Websites/perf.webkit.org/public/v3/models/measurement-cluster.js	2017-01-12 19:32:20 UTC (rev 210673)
@@ -19,7 +19,7 @@
         var self = this;
         for (var row of rawMeasurements) {
             var point = this._adaptor.applyTo(row);
-            if (point.id in idMap || (!includeOutliers && point.isOutlier))
+            if (point.id in idMap || (!includeOutliers && point.markedOutlier))
                 continue;
             series.append(point);
             idMap[point.id] = point.seriesIndex;

Modified: trunk/Websites/perf.webkit.org/public/v3/models/root-set.js (210672 => 210673)


--- trunk/Websites/perf.webkit.org/public/v3/models/root-set.js	2017-01-12 19:27:54 UTC (rev 210672)
+++ trunk/Websites/perf.webkit.org/public/v3/models/root-set.js	2017-01-12 19:32:20 UTC (rev 210673)
@@ -29,6 +29,7 @@
         return commit ? commit.revision() : null;
     }
 
+    // FIXME: This should return a Date object.
     latestCommitTime()
     {
         if (this._latestCommitTime == null) {
@@ -86,6 +87,13 @@
         }
     }
 
+    // Use RootSet's static maps because MeasurementRootSet and RootSet are logically of the same type.
+    // FIXME: Idaelly, DataModel should take care of this but traversing prototype chain is expensive.
+    namedStaticMap(name) { return RootSet.namedStaticMap(name); }
+    ensureNamedStaticMap(name) { return RootSet.ensureNamedStaticMap(name); }
+    static namedStaticMap(name) { return RootSet.namedStaticMap(name); }
+    static ensureNamedStaticMap(name) { return RootSet.ensureNamedStaticMap(name); }
+
     static ensureSingleton(measurementId, revisionList)
     {
         var rootSetId = measurementId + '-rootset';

Modified: trunk/Websites/perf.webkit.org/unit-tests/measurement-set-tests.js (210672 => 210673)


--- trunk/Websites/perf.webkit.org/unit-tests/measurement-set-tests.js	2017-01-12 19:27:54 UTC (rev 210672)
+++ trunk/Websites/perf.webkit.org/unit-tests/measurement-set-tests.js	2017-01-12 19:32:20 UTC (rev 210673)
@@ -1,12 +1,12 @@
 'use strict';
 
-var assert = require('assert');
+const assert = require('assert');
 if (!assert.almostEqual)
     assert.almostEqual = require('./resources/almost-equal.js');
 
-let MockRemoteAPI = require('./resources/mock-remote-api.js').MockRemoteAPI;
+const MockRemoteAPI = require('./resources/mock-remote-api.js').MockRemoteAPI;
 require('../tools/js/v3-models.js');
-let MockModels = require('./resources/mock-v3-models.js').MockModels;
+const MockModels = require('./resources/mock-v3-models.js').MockModels;
 
 describe('MeasurementSet', function () {
     MockModels.inject();
@@ -743,6 +743,245 @@
 
     });
 
+    describe('fetchedTimeSeries', () => {
+
+        // Data from https://perf.webkit.org/v3/#/charts?paneList=((15-769))&since=1476426488465
+        const sampleCluster = {
+            "clusterStart": 946684800000,
+            "clusterSize": 5184000000,
+            "configurations": {
+                "current": [
+                    [
+                        26530031, 135.26375, 80, 10821.1, 1481628.13, false,
+                        [ [27173, 1, "210096", 1482398562950] ],
+                        1482398562950, 52999, 1482413222311, "10877", 7
+                    ],
+                    [
+                        26530779, 153.2675, 80, 12261.4, 1991987.4, true, // changed to true.
+                        [ [27174,1,"210097",1482424870729] ],
+                        1482424870729, 53000, 1482424992735, "10878", 7
+                    ],
+                    [
+                        26532275, 134.2725, 80, 10741.8, 1458311.88, false,
+                        [ [ 27176, 1, "210102", 1482431464371 ] ],
+                        1482431464371, 53002, 1482436041865, "10879", 7
+                    ],
+                    [
+                        26547226, 150.9625, 80, 12077, 1908614.94, false,
+                        [ [ 27195, 1, "210168", 1482852412735 ] ],
+                        1482852412735, 53022, 1482852452143, "10902", 7
+                    ],
+                    [
+                        26559915, 141.72, 80, 11337.6, 1633126.8, false,
+                        [ [ 27211, 1, "210222", 1483347732051 ] ],
+                        1483347732051, 53039, 1483347926429, "10924", 7
+                    ],
+                    [
+                        26564388, 138.13125, 80, 11050.5, 1551157.93, false,
+                        [ [ 27217, 1, "210231", 1483412171531 ] ],
+                        1483412171531, 53045, 1483415426049, "10930", 7
+                    ],
+                    [
+                        26568867, 144.16, 80, 11532.8, 1694941.1, false,
+                        [ [ 27222, 1, "210240", 1483469584347 ] ],
+                        1483469584347, 53051, 1483469642993, "10935", 7
+                    ]
+                ]
+            },
+            "formatMap": [
+                "id", "mean", "iterationCount", "sum", "squareSum", "markedOutlier",
+                "revisions",
+                "commitTime", "build", "buildTime", "buildNumber", "builder"
+            ],
+            "startTime": 1480636800000,
+            "endTime": 1485820800000,
+            "lastModified": 1484105738736,
+            "clusterCount": 1,
+            "elapsedTime": 56.421995162964,
+            "status": "OK"
+        };
+
+        let builder;
+        let webkit;
+        beforeEach(function () {
+            builder = new Builder(7, {name: 'EFL Linux 64-bit Release WK2 (Perf)', buildUrl: 'http://build.webkit.org/builders/$builderName/$buildNumber'});
+            webkit = new Repository(1, {name: 'WebKit', url: 'http://trac.webkit.org/changeset/$1'});
+        });
+
+        function fetchSampleCluster() {
+            const set = MeasurementSet.findSet(15, 769, 1484105738736);
+            const promise = set.fetchBetween(1476426488465, 1484203801573);
+            assert.equal(requests.length, 1);
+            assert.equal(requests[0].url, '../data/measurement-set-15-769.json');
+
+            requests[0].resolve(sampleCluster);
+
+            return waitForMeasurementSet().then(() => { return set; })
+        }
+
+        it('should include all data points from the fetched cluster when includeOutliers is true', () => {
+            let points;
+            return fetchSampleCluster().then((set) => {
+                const includeOutliers = true;
+                const extendToFuture = false;
+                const fullSeries = set.fetchedTimeSeries('current', includeOutliers, extendToFuture);
+                assert.equal(fullSeries.length(), 7);
+
+                points = new Array(7);
+                for (let i = 0; i < 7; i++)
+                    points[i] = fullSeries.findPointByIndex(i);
+            }).then(() => {
+                const point = points[0];
+                assert.equal(point.id, 26530031);
+
+                const commitTime = 1482398562950;
+                const rootSet = point.rootSet();
+                assert.equal(point.rootSet(), rootSet);
+                assert.deepEqual(rootSet.repositories(), [webkit]);
+                assert.equal(rootSet.revisionForRepository(webkit), '210096');
+                const commit = rootSet.commitForRepository(webkit);
+                assert.equal(commit.repository(), webkit);
+                assert.equal(+commit.time(), commitTime);
+                assert.equal(commit.author(), null);
+                assert.equal(commit.revision(), '210096');
+                assert.equal(commit.message(), null);
+                assert.equal(commit.url(), 'http://trac.webkit.org/changeset/210096');
+                assert.equal(commit.label(), 'r210096');
+                assert.equal(commit.title(), 'WebKit at r210096');
+                assert.equal(rootSet.latestCommitTime(), commitTime);
+
+                const build = point.build();
+                assert.equal(point.build(), build);
+                assert.equal(build.builder(), builder);
+                assert.equal(build.buildNumber(), 10877);
+                const buildTime = build.buildTime();
+                assert(buildTime instanceof Date);
+                assert.equal(+buildTime, 1482413222311);
+
+                assert.equal(point.time, commitTime);
+                assert.equal(point.value, 135.26375);
+                assert.equal(point.sum, 10821.1);
+                assert.equal(point.squareSum, 1481628.13);
+                assert.equal(point.iterationCount, 80);
+                assert.equal(point.markedOutlier, false);
+            }).then(() => {
+                const point = points[1];
+                assert.equal(point.id, 26530779);
+
+                const commitTime = 1482424870729;
+                const rootSet = point.rootSet();
+                assert.equal(rootSet.revisionForRepository(webkit), '210097');
+                const commit = rootSet.commitForRepository(webkit);
+                assert.equal(+commit.time(), commitTime);
+                assert.equal(commit.revision(), '210097');
+                assert.equal(rootSet.latestCommitTime(), commitTime);
+
+                const build = point.build();
+                assert.equal(build.builder(), builder);
+                assert.equal(build.buildNumber(), 10878);
+                assert.equal(+build.buildTime(), 1482424992735);
+
+                assert.equal(point.time, commitTime);
+                assert.equal(point.value, 153.2675);
+                assert.equal(point.sum, 12261.4);
+                assert.equal(point.squareSum, 1991987.4);
+                assert.equal(point.iterationCount, 80);
+                assert.equal(point.markedOutlier, true);
+            }).then(() => {
+                assert.equal(points[2].id, 26532275);
+                assert.equal(points[2].rootSet().revisionForRepository(webkit), '210102');
+                assert.equal(+points[2].build().buildTime(), 1482436041865);
+                assert.equal(points[2].build().buildNumber(), 10879);
+                assert.equal(points[2].time, 1482431464371);
+                assert.equal(points[2].value, 134.2725);
+
+                assert.equal(points[3].id, 26547226);
+                assert.equal(points[3].rootSet().revisionForRepository(webkit), '210168');
+                assert.equal(+points[3].build().buildTime(), 1482852452143);
+                assert.equal(points[3].build().buildNumber(), 10902);
+                assert.equal(points[3].time, 1482852412735);
+                assert.equal(points[3].value, 150.9625);
+
+                assert.equal(points[4].id, 26559915);
+                assert.equal(points[4].rootSet().revisionForRepository(webkit), '210222');
+                assert.equal(+points[4].build().buildTime(), 1483347926429);
+                assert.equal(points[4].build().buildNumber(), 10924);
+                assert.equal(points[4].time, 1483347732051);
+                assert.equal(points[4].value, 141.72);
+
+                assert.equal(points[5].id, 26564388);
+                assert.equal(points[5].rootSet().revisionForRepository(webkit), '210231');
+                assert.equal(+points[5].build().buildTime(), 1483415426049);
+                assert.equal(points[5].build().buildNumber(), 10930);
+                assert.equal(points[5].time, 1483412171531);
+                assert.equal(points[5].value, 138.13125);
+
+                assert.equal(points[6].id, 26568867);
+                assert.equal(points[6].rootSet().revisionForRepository(webkit), '210240');
+                assert.equal(+points[6].build().buildTime(), 1483469642993);
+                assert.equal(points[6].build().buildNumber(), 10935);
+                assert.equal(points[6].time, 1483469584347);
+                assert.equal(points[6].value, 144.16);
+            });
+        });
+
+        it('should include all data points from the fetched cluster when includeOutliers is false', () => {
+            return fetchSampleCluster().then((set) => {
+                const includeOutliers = false;
+                const extendToFuture = false;
+                const fullSeries = set.fetchedTimeSeries('current', includeOutliers, extendToFuture);
+                assert.equal(fullSeries.length(), 6);
+
+                const points = new Array(6);
+                for (let i = 0; i < 6; i++)
+                    points[i] = fullSeries.findPointByIndex(i);
+
+                assert.equal(points[0].id, 26530031);
+                assert.equal(points[0].rootSet().revisionForRepository(webkit), '210096');
+                assert.equal(+points[0].build().buildTime(), 1482413222311);
+                assert.equal(points[0].build().buildNumber(), 10877);
+                assert.equal(points[0].time, 1482398562950);
+                assert.equal(points[0].value, 135.26375);
+
+                assert.equal(points[1].id, 26532275);
+                assert.equal(points[1].rootSet().revisionForRepository(webkit), '210102');
+                assert.equal(+points[1].build().buildTime(), 1482436041865);
+                assert.equal(points[1].build().buildNumber(), 10879);
+                assert.equal(points[1].time, 1482431464371);
+                assert.equal(points[1].value, 134.2725);
+
+                assert.equal(points[2].id, 26547226);
+                assert.equal(points[2].rootSet().revisionForRepository(webkit), '210168');
+                assert.equal(+points[2].build().buildTime(), 1482852452143);
+                assert.equal(points[2].build().buildNumber(), 10902);
+                assert.equal(points[2].time, 1482852412735);
+                assert.equal(points[2].value, 150.9625);
+
+                assert.equal(points[3].id, 26559915);
+                assert.equal(points[3].rootSet().revisionForRepository(webkit), '210222');
+                assert.equal(+points[3].build().buildTime(), 1483347926429);
+                assert.equal(points[3].build().buildNumber(), 10924);
+                assert.equal(points[3].time, 1483347732051);
+                assert.equal(points[3].value, 141.72);
+
+                assert.equal(points[4].id, 26564388);
+                assert.equal(points[4].rootSet().revisionForRepository(webkit), '210231');
+                assert.equal(+points[4].build().buildTime(), 1483415426049);
+                assert.equal(points[4].build().buildNumber(), 10930);
+                assert.equal(points[4].time, 1483412171531);
+                assert.equal(points[4].value, 138.13125);
+
+                assert.equal(points[5].id, 26568867);
+                assert.equal(points[5].rootSet().revisionForRepository(webkit), '210240');
+                assert.equal(+points[5].build().buildTime(), 1483469642993);
+                assert.equal(points[5].build().buildNumber(), 10935);
+                assert.equal(points[5].time, 1483469584347);
+                assert.equal(points[5].value, 144.16);
+            });
+        });
+
+    });
+
     describe('fetchSegmentation', function () {
 
         var simpleSegmentableValues = [
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to