Changeset 225898 in webkit


Ignore:
Timestamp:
Dec 14, 2017 1:49:37 AM (6 years ago)
Author:
Dewei Zhu
Message:

Add a test freshness page.
https://bugs.webkit.org/show_bug.cgi?id=180126

Reviewed by Ryosuke Niwa.

Added a page to show freshness of a test.
The test freshness page reports on the same set of tests as the one shown in the summary page.
Use a logistic function to evaluate the freshness of the data points.
This function has the desired property which increase dramatically when it close to the center of the graph.
'acceptableLastDataPointDurationInHour' configs the center of the graph.

  • public/include/manifest-generator.php:
  • public/v3/components/freshness-indicator.js: Added.

(FreshnessIndicator): A cell of the test freshness table, color will transit from green to red.
(FreshnessIndicator.prototype.update): Update the the data point information and triggers
the cell to re-render if anything changes.
(FreshnessIndicator.prototype._renderIndicator): Re-render the indicator.
(FreshnessIndicator.prototype.render): Render the box color base on a logistic function.
(FreshnessIndicator.prototype._createIndicator):
(FreshnessIndicator.htmlTemplate):
(FreshnessIndicator.cssTemplate):

  • public/v3/index.html:
  • public/v3/main.js: Added test freshness page.

(main):

  • public/v3/models/build-request.js: Refactored waitingTime function to make it reusable.

(BuildRequest.formatTimeInterval): Format time interval in million seconds to more user friendly text.
(BuildRequest.prototype.waitingTime):

  • public/v3/pages/test-freshness-page.js: Added.

(TestFreshnessPage):
(TestFreshnessPage.prototype.name):
(TestFreshnessPage.prototype._loadConfig): Load config from summary page configurations.
(TestFreshnessPage.prototype.open):
(TestFreshnessPage.prototype._fetchTestResults):
(TestFreshnessPage.prototype.render):
(TestFreshnessPage.prototype._renderTable):
(TestFreshnessPage.prototype._isValidPlatformMetricCombination): Return whether a platform
and metric combination is valid.
(TestFreshnessPage.prototype._constructTableCell):
(TestFreshnessPage.cssTemplate):
(TestFreshnessPage.prototype.routeName):

  • server-tests/api-manifest-tests.js: Added 'warningHourBaseline' so that we can config the

parameter of logistic funciton.

  • unit-tests/build-request-tests.js: Added unit tests for formatTimeInterval.
Location:
trunk/Websites/perf.webkit.org
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/perf.webkit.org/ChangeLog

    r224551 r225898  
     12017-12-13  Dewei Zhu  <dewei_zhu@apple.com>
     2
     3        Add a test freshness page.
     4        https://bugs.webkit.org/show_bug.cgi?id=180126
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Added a page to show freshness of a test.
     9        The test freshness page reports on the same set of tests as the one shown in the summary page.
     10        Use a logistic function to evaluate the freshness of the data points.
     11        This function has the desired property which increase dramatically when it close to the center of the graph.
     12        'acceptableLastDataPointDurationInHour' configs the center of the graph.
     13
     14        * public/include/manifest-generator.php:
     15        * public/v3/components/freshness-indicator.js: Added.
     16        (FreshnessIndicator): A cell of the test freshness table, color will transit from green to red.
     17        (FreshnessIndicator.prototype.update): Update the the data point information and triggers
     18        the cell to re-render if anything changes.
     19        (FreshnessIndicator.prototype._renderIndicator): Re-render the indicator.
     20        (FreshnessIndicator.prototype.render): Render the box color base on a logistic function.
     21        (FreshnessIndicator.prototype._createIndicator):
     22        (FreshnessIndicator.htmlTemplate):
     23        (FreshnessIndicator.cssTemplate):
     24        * public/v3/index.html:
     25        * public/v3/main.js: Added test freshness page.
     26        (main):
     27        * public/v3/models/build-request.js: Refactored waitingTime function to make it reusable.
     28        (BuildRequest.formatTimeInterval): Format time interval in million seconds to more user friendly text.
     29        (BuildRequest.prototype.waitingTime):
     30        * public/v3/pages/test-freshness-page.js: Added.
     31        (TestFreshnessPage):
     32        (TestFreshnessPage.prototype.name):
     33        (TestFreshnessPage.prototype._loadConfig): Load config from summary page configurations.
     34        (TestFreshnessPage.prototype.open):
     35        (TestFreshnessPage.prototype._fetchTestResults):
     36        (TestFreshnessPage.prototype.render):
     37        (TestFreshnessPage.prototype._renderTable):
     38        (TestFreshnessPage.prototype._isValidPlatformMetricCombination): Return whether a platform
     39        and metric combination is valid.
     40        (TestFreshnessPage.prototype._constructTableCell):
     41        (TestFreshnessPage.cssTemplate):
     42        (TestFreshnessPage.prototype.routeName):
     43        * server-tests/api-manifest-tests.js: Added 'warningHourBaseline' so that we can config the
     44        parameter of logistic funciton.
     45        * unit-tests/build-request-tests.js: Added unit tests for formatTimeInterval.
     46
    1472017-11-02  Dewei Zhu  <dewei_zhu@apple.com>
    248
  • trunk/Websites/perf.webkit.org/public/include/manifest-generator.php

    r215987 r225898  
    4545            'summaryPages' => config('summaryPages'),
    4646            'fileUploadSizeLimit' => config('uploadFileLimitInMB', 0) * 1024 * 1024,
     47            'testAgeToleranceInHours' => config('testAgeToleranceInHours'),
    4748        );
    4849
  • trunk/Websites/perf.webkit.org/public/v3/index.html

    r222227 r225898  
    9999        <script src="components/custom-configuration-test-group-form.js"></script>
    100100        <script src="components/instant-file-uploader.js"></script>
     101        <script src="components/freshness-indicator.js"></script>
    101102
    102103        <script src="pages/page.js"></script>
     
    118119        <script src="pages/build-request-queue-page.js"></script>
    119120        <script src="pages/summary-page.js"></script>
     121        <script src="pages/test-freshness-page.js"></script>
    120122
    121123        <script src="main.js"></script>
  • trunk/Websites/perf.webkit.org/public/v3/main.js

    r211196 r225898  
    4848        buildRequestQueuePage.setParentPage(analysisCategoryPage);
    4949
     50        const testHealthPage = new TestFreshnessPage(manifest.summaryPages, manifest.testAgeToleranceInHours);
     51
    5052        var heading = new Heading(manifest.siteTitle);
    51         heading.addPageGroup(summaryPages.concat([chartsPage, analysisCategoryPage]));
     53        heading.addPageGroup(summaryPages.concat([chartsPage, analysisCategoryPage, testHealthPage]));
    5254
    5355        heading.setTitle(manifest.siteTitle);
     
    6264        router.addPage(buildRequestQueuePage);
    6365        router.addPage(analysisCategoryPage);
     66        router.addPage(testHealthPage);
    6467        for (var page of dashboardPages)
    6568            router.addPage(page);
  • trunk/Websites/perf.webkit.org/public/v3/models/build-request.js

    r222219 r225898  
    8585    createdAt() { return this._createdAt; }
    8686
    87     waitingTime(referenceTime)
    88     {
    89         var units = [
     87    static formatTimeInterval(intervalInMillionSeconds) {
     88        let intervalInSeconds = intervalInMillionSeconds / 1000;
     89        const units = [
    9090            {unit: 'week', length: 7 * 24 * 3600},
    9191            {unit: 'day', length: 24 * 3600},
     
    9494        ];
    9595
    96         var diff = (referenceTime - this.createdAt()) / 1000;
    9796
    98         var indexOfFirstSmallEnoughUnit = units.length - 1;
    99         for (var i = 0; i < units.length; i++) {
    100             if (diff > 1.5 * units[i].length) {
     97        let indexOfFirstSmallEnoughUnit = units.length - 1;
     98        for (let i = 0; i < units.length; i++) {
     99            if (intervalInSeconds > 1.5 * units[i].length) {
    101100                indexOfFirstSmallEnoughUnit = i;
    102101                break;
     
    104103        }
    105104
    106         var label = '';
    107         var lastUnit = false;
    108         for (var i = indexOfFirstSmallEnoughUnit; !lastUnit; i++) {
     105        let label = '';
     106        let lastUnit = false;
     107        for (let i = indexOfFirstSmallEnoughUnit; !lastUnit; i++) {
    109108            lastUnit = i == indexOfFirstSmallEnoughUnit + 1 || i == units.length - 1;
    110             var length = units[i].length;
    111             var valueForUnit = lastUnit ? Math.round(diff / length) : Math.floor(diff / length);
     109            const length = units[i].length;
     110            const valueForUnit = lastUnit ? Math.round(intervalInSeconds / length) : Math.floor(intervalInSeconds / length);
    112111
    113             var unit = units[i].unit + (valueForUnit == 1 ? '' : 's');
     112            const unit = units[i].unit + (valueForUnit == 1 ? '' : 's');
    114113            if (label)
    115114                label += ' ';
    116115            label += `${valueForUnit} ${unit}`;
    117116
    118             diff = diff - valueForUnit * length;
     117            intervalInSeconds = intervalInSeconds - valueForUnit * length;
    119118        }
    120119
    121120        return label;
     121    }
     122
     123    waitingTime(referenceTime)
     124    {
     125        return BuildRequest.formatTimeInterval(referenceTime - this.createdAt());
    122126    }
    123127
  • trunk/Websites/perf.webkit.org/server-tests/api-manifest-tests.js

    r215987 r225898  
    1515        return TestServer.remoteAPI().getJSON('/api/manifest').then((manifest) => {
    1616            assert.deepEqual(Object.keys(manifest).sort(), ['all', 'bugTrackers', 'builders', 'dashboard', 'dashboards',
    17                 'elapsedTime', 'fileUploadSizeLimit', 'metrics', 'repositories', 'siteTitle', 'status', 'summaryPages', 'tests', 'triggerables']);
     17                'elapsedTime', 'fileUploadSizeLimit', 'metrics', 'repositories', 'siteTitle', 'status', 'summaryPages', 'testAgeToleranceInHours', 'tests', 'triggerables']);
    1818
    1919            assert.equal(typeof(manifest.elapsedTime), 'number');
     
    3030                metrics: {},
    3131                repositories: {},
     32                testAgeToleranceInHours: null,
    3233                tests: {},
    3334                triggerables: {},
  • trunk/Websites/perf.webkit.org/unit-tests/build-request-tests.js

    r215987 r225898  
    159159    });
    160160
     161    describe('formatTimeInterval', () => {
     162        it('should return "0 minutes" when formatting for 0 second in million seconds', () => {
     163            assert.equal(BuildRequest.formatTimeInterval(0), '0 minutes');
     164        });
     165
     166        it('should return "1 minute" when formatting for 60 seconds in million seconds', () => {
     167            assert.equal(BuildRequest.formatTimeInterval(60 * 1000), '1 minute');
     168        });
     169
     170        it('should return "1 minute" when formatting for  75 seconds in million seconds', () => {
     171            assert.equal(BuildRequest.formatTimeInterval(75 * 1000), '1 minute');
     172        });
     173
     174        it('should return "2 minutes" when formatting for 118 seconds in million seconds', () => {
     175            assert.equal(BuildRequest.formatTimeInterval(118 * 1000), '2 minutes');
     176        });
     177
     178        it('should return "75 minutes" when formatting for 75 minutes in million seconds', () => {
     179            assert.equal(BuildRequest.formatTimeInterval(75 * 60 * 1000), '75 minutes');
     180        });
     181
     182        it('should return "1 hour 58 minutes" when formatting for 118 minutes in million seconds', () => {
     183            assert.equal(BuildRequest.formatTimeInterval(118 * 60 * 1000), '1 hour 58 minutes');
     184        });
     185
     186        it('should return "3 hours 2 minutes" when formatting for 182 minutes in million seconds', () => {
     187            assert.equal(BuildRequest.formatTimeInterval(182 * 60 * 1000), '3 hours 2 minutes');
     188        });
     189
     190        it('should return "27 hours 14 minutes" when formatting for 27 hours 14 minutes in million seconds', () => {
     191            assert.equal(BuildRequest.formatTimeInterval((27 * 3600 + 14 * 60) * 1000), '27 hours 14 minutes');
     192        });
     193
     194        it('should return "2 days 3 hours" when formatting for 51 hours 14 minutes in million seconds', () => {
     195            assert.equal(BuildRequest.formatTimeInterval((51 * 3600 + 14 * 60) * 1000), '2 days 3 hours');
     196        });
     197
     198        it('should return "2 days 0 hours" when formatting for 48 hours 1 minutes in million seconds', () => {
     199            assert.equal(BuildRequest.formatTimeInterval((48 * 3600 + 1 * 60) * 1000), '2 days 0 hours');
     200        });
     201
     202        it('should return "2 days 2 hours" when formatting for 49 hours 59 minutes in million seconds', () => {
     203            assert.equal(BuildRequest.formatTimeInterval((49 * 3600 + 59 * 60) * 1000), '2 days 2 hours');
     204        });
     205
     206        it('should return "2 weeks 6 days" when formatting for 20 days 5 hours 21 minutes in million seconds', () => {
     207            assert.equal(BuildRequest.formatTimeInterval(((20 * 24 + 5) * 3600 + 21 * 60) * 1000), '2 weeks 6 days');
     208        });
     209    });
     210
    161211});
Note: See TracChangeset for help on using the changeset viewer.