Title: [184531] trunk/Websites/perf.webkit.org
Revision
184531
Author
[email protected]
Date
2015-05-18 17:24:19 -0700 (Mon, 18 May 2015)

Log Message

REGRESSION: v2 UI reports a higher memory usage
https://bugs.webkit.org/show_bug.cgi?id=145151

Reviewed by Chris Dumez.

The bug was caused by v2 UI using 1000 to divide the number of bytes instead of by 1024 as done in v1.
Fixed the bug by manually implementing the formatter as done in v1.

* public/v2/manifest.js:
(App.Manfiest._formatBytes): Added.
(App.Manifest._formatFetchedData): Use _formatByte instead of format('s').

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (184530 => 184531)


--- trunk/Websites/perf.webkit.org/ChangeLog	2015-05-19 00:09:36 UTC (rev 184530)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2015-05-19 00:24:19 UTC (rev 184531)
@@ -1,3 +1,17 @@
+2015-05-18  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION: v2 UI reports a higher memory usage
+        https://bugs.webkit.org/show_bug.cgi?id=145151
+
+        Reviewed by Chris Dumez.
+
+        The bug was caused by v2 UI using 1000 to divide the number of bytes instead of by 1024 as done in v1.
+        Fixed the bug by manually implementing the formatter as done in v1.
+
+        * public/v2/manifest.js:
+        (App.Manfiest._formatBytes): Added.
+        (App.Manifest._formatFetchedData): Use _formatByte instead of format('s').
+
 2015-05-11  Ryosuke Niwa  <[email protected]>
 
         Unreviewed build fix. Add "Duration" as a time metric.

Modified: trunk/Websites/perf.webkit.org/public/v2/manifest.js (184530 => 184531)


--- trunk/Websites/perf.webkit.org/public/v2/manifest.js	2015-05-19 00:09:36 UTC (rev 184530)
+++ trunk/Websites/perf.webkit.org/public/v2/manifest.js	2015-05-19 00:24:19 UTC (rev 184531)
@@ -315,14 +315,28 @@
             };
         });
     },
+    _formatBytes: function (sigFig, alwaysShowSign)
+    {
+        var units = ['', 'K', 'M', 'G', 'T', 'P', 'E'];
+        var threshold = sigFig >= 3 ? 1024 : 102.4;
+        return function (bytes) {
+            var i;
+            var sign = bytes >= 0 ? (alwaysShowSign ? '+' : '') : '-';
+            bytes = Math.abs(bytes);
+
+            for (i = 0; bytes >= threshold; i++)
+                bytes /= 1024;
+            return sign + bytes.toPrecision(Math.max(2, sigFig)) + units[i];
+        }
+    },
     _formatFetchedData: function (metricName, configurations)
     {
         var unit = RunsData.unitFromMetricName(metricName);
         var smallerIsBetter = RunsData.isSmallerBetter(unit);
 
-        var useSI = unit == 'bytes';
+        var isBytes = unit == 'bytes';
         var unitSuffix = unit ? ' ' + unit : '';
-        var deltaFormatterWithoutSign = useSI ? d3.format('.2s') : d3.format('.2g');
+        var deltaFormatterWithoutSign = isBytes ? this._formatBytes(2, false) : d3.format('.2g');
 
         var currentTimeSeries = configurations.current.timeSeriesByCommitTime(false);
         var baselineTimeSeries = configurations.baseline ? configurations.baseline.timeSeriesByCommitTime(false) : null;
@@ -339,8 +353,8 @@
             {
                 return this.formatter(value) + (delta && !isNaN(delta) ? ' \u00b1 ' + deltaFormatterWithoutSign(delta) : '') + unitSuffix;
             },
-            formatter: useSI ? d3.format('.4s') : d3.format('.4g'),
-            deltaFormatter: useSI ? d3.format('+.2s') : d3.format('+.2g'),
+            formatter: isBytes ? this._formatBytes(4, false) : d3.format('.4g'),
+            deltaFormatter: isBytes ? this._formatBytes(2, true) : d3.format('+.2g'),
             smallerIsBetter: smallerIsBetter,
             showOutlier: function (show)
             {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to