<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[184591] trunk/Websites/perf.webkit.org</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/184591">184591</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-19 14:39:46 -0700 (Tue, 19 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Don't show unit (bytes) separaetly from SI suffixes (K, M, etc...)
https://bugs.webkit.org/show_bug.cgi?id=145181

Rubber-stamped by Chris Dumez.

Show 'MB' in each y-axis label instead of showing 'bytes' separately and suffixing each label with just 'M'
for clarity. This change also reduces the code complexity.

* public/index.html:
* public/v2/app.js:
(App.AnalysisTaskController._chartDataChanged):
(App.TestGroupPane._createConfigurationSummary):
* public/v2/data.js:
(RunsData.unitFromMetricName): Use 'B' instead of 'bytes' as the unit.

* public/v2/interactive-chart.js: Removed the support for showing units separately.
(App.InteractiveChartComponent._constructGraphIfPossible):
(App.InteractiveChartComponent._relayoutDataAndAxes)

* public/v2/manifest.js:
(App.Manifest._makeFormatter): Renamed from _formatBytes. Support more SI suffixes such as micro and mili.
Now takes the unit as the first argument. Adjust the base unit if it's 'ms'.
(App.Manifest._formatFetchedData): Removed unit and formatWithUnit now that all all formatters would
automatically include unit.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicindexhtml">trunk/Websites/perf.webkit.org/public/index.html</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2appjs">trunk/Websites/perf.webkit.org/public/v2/app.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2datajs">trunk/Websites/perf.webkit.org/public/v2/data.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2interactivechartjs">trunk/Websites/perf.webkit.org/public/v2/interactive-chart.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2manifestjs">trunk/Websites/perf.webkit.org/public/v2/manifest.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (184590 => 184591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2015-05-19 21:37:49 UTC (rev 184590)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2015-05-19 21:39:46 UTC (rev 184591)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-05-19  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Don't show unit (bytes) separaetly from SI suffixes (K, M, etc...)
+        https://bugs.webkit.org/show_bug.cgi?id=145181
+
+        Rubber-stamped by Chris Dumez.
+
+        Show 'MB' in each y-axis label instead of showing 'bytes' separately and suffixing each label with just 'M'
+        for clarity. This change also reduces the code complexity.
+
+        * public/index.html:
+        * public/v2/app.js:
+        (App.AnalysisTaskController._chartDataChanged):
+        (App.TestGroupPane._createConfigurationSummary):
+        * public/v2/data.js:
+        (RunsData.unitFromMetricName): Use 'B' instead of 'bytes' as the unit.
+
+        * public/v2/interactive-chart.js: Removed the support for showing units separately.
+        (App.InteractiveChartComponent._constructGraphIfPossible):
+        (App.InteractiveChartComponent._relayoutDataAndAxes)
+
+        * public/v2/manifest.js:
+        (App.Manifest._makeFormatter): Renamed from _formatBytes. Support more SI suffixes such as micro and mili.
+        Now takes the unit as the first argument. Adjust the base unit if it's 'ms'.
+        (App.Manifest._formatFetchedData): Removed unit and formatWithUnit now that all all formatters would
+        automatically include unit.
+
</ins><span class="cx"> 2015-05-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION: v2 UI reports a higher memory usage
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicindexhtml"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/index.html (184590 => 184591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/index.html        2015-05-19 21:37:49 UTC (rev 184590)
+++ trunk/Websites/perf.webkit.org/public/index.html        2015-05-19 21:39:46 UTC (rev 184591)
</span><span class="lines">@@ -188,19 +188,6 @@
</span><span class="cx">     left: 5px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#dashboard .unit {
-    display: none;
-}
-
-#charts .unit {
-    font-size: small;
-    width: 50px;
-    text-align: center;
-    position: absolute;
-    bottom: 10px;
-    left: 245px;
-}
-
</del><span class="cx"> #charts .arrow {
</span><span class="cx">     width: 20px;
</span><span class="cx">     height: 40px;
</span><span class="lines">@@ -530,7 +517,6 @@
</span><span class="cx">             section.addClass(status.class);
</span><span class="cx">             section.find('.status tbody').html(buildLabelWithLinks(results.lastResult().build()));
</span><span class="cx">             section.find('.summaryTable tbody').html(summaryRows);
</span><del>-            section.find('.unit').html(results.unit());
</del><span class="cx">             if (results.smallerIsBetter()) {
</span><span class="cx">                 section.find('.arrow .downwardArrowHead').show();
</span><span class="cx">                 section.find('.arrow .upwardArrowHead').hide();
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2appjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/app.js (184590 => 184591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/app.js        2015-05-19 21:37:49 UTC (rev 184590)
+++ trunk/Websites/perf.webkit.org/public/v2/app.js        2015-05-19 21:39:46 UTC (rev 184591)
</span><span class="lines">@@ -1228,7 +1228,7 @@
</span><span class="cx">                 id: point.measurement.id(),
</span><span class="cx">                 measurement: point.measurement,
</span><span class="cx">                 label: 'Point ' + (index + 1),
</span><del>-                value: chartData.formatWithUnit(point.value),
</del><ins>+                value: chartData.formatter(point.value),
</ins><span class="cx">             };
</span><span class="cx">         });
</span><span class="cx"> 
</span><span class="lines">@@ -1529,7 +1529,7 @@
</span><span class="cx">                 }),
</span><span class="cx">                 value: point ? point.value : null,
</span><span class="cx">                 valueRange: range,
</span><del>-                formattedValue: point ? testResults.formatWithUnit(point.value) : null,
</del><ins>+                formattedValue: point ? testResults.formatter(point.value) : null,
</ins><span class="cx">                 buildLabel: point ? 'Build ' + point.measurement.buildNumber() : null,
</span><span class="cx">             });
</span><span class="cx">         });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2datajs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/data.js (184590 => 184591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/data.js        2015-05-19 21:37:49 UTC (rev 184590)
+++ trunk/Websites/perf.webkit.org/public/v2/data.js        2015-05-19 21:39:46 UTC (rev 184591)
</span><span class="lines">@@ -407,9 +407,9 @@
</span><span class="cx">         'Runs': '/s',
</span><span class="cx">         'Time': 'ms',
</span><span class="cx">         'Duration': 'ms',
</span><del>-        'Malloc': 'bytes',
-        'Heap': 'bytes',
-        'Allocations': 'bytes',
</del><ins>+        'Malloc': 'B',
+        'Heap': 'B',
+        'Allocations': 'B',
</ins><span class="cx">         'Score': 'pt',
</span><span class="cx">     }[suffix];
</span><span class="cx">     return unit;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2interactivechartjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/interactive-chart.js (184590 => 184591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/interactive-chart.js        2015-05-19 21:37:49 UTC (rev 184590)
+++ trunk/Websites/perf.webkit.org/public/v2/interactive-chart.js        2015-05-19 21:39:46 UTC (rev 184591)
</span><span class="lines">@@ -113,8 +113,6 @@
</span><span class="cx">         this._targetTimeSeries = chartData.target;
</span><span class="cx">         this._movingAverageTimeSeries = chartData.movingAverage;
</span><span class="cx"> 
</span><del>-        this._yAxisUnit = chartData.unit;
-
</del><span class="cx">         if (this._baselineTimeSeries) {
</span><span class="cx">             this._paths.push(this._clippedContainer
</span><span class="cx">                 .append(&quot;path&quot;)
</span><span class="lines">@@ -312,14 +310,8 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         this._yAxisLabels.call(this._yAxis);
</span><del>-        if (this._yAxisUnitContainer)
-            this._yAxisUnitContainer.remove();
</del><span class="cx">         var x = - 3.2 * this._rem;
</span><span class="cx">         var y = this._contentHeight / 2;
</span><del>-        this._yAxisUnitContainer = this._yAxisLabels.append(&quot;text&quot;)
-            .attr(&quot;transform&quot;, &quot;rotate(90 0 0) translate(&quot; + y + &quot;, &quot; + (-x) + &quot;)&quot;)
-            .style(&quot;text-anchor&quot;, &quot;middle&quot;)
-            .text(this._yAxisUnit);
</del><span class="cx">     },
</span><span class="cx">     _updateHighlightPositions: function () {
</span><span class="cx">         if (!this._highlights)
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2manifestjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/manifest.js (184590 => 184591)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/manifest.js        2015-05-19 21:37:49 UTC (rev 184590)
+++ trunk/Websites/perf.webkit.org/public/v2/manifest.js        2015-05-19 21:39:46 UTC (rev 184591)
</span><span class="lines">@@ -315,29 +315,34 @@
</span><span class="cx">             };
</span><span class="cx">         });
</span><span class="cx">     },
</span><del>-    _formatBytes: function (sigFig, alwaysShowSign)
</del><ins>+    _makeFormatter: function (unit, sigFig, alwaysShowSign)
</ins><span class="cx">     {
</span><del>-        var units = ['', 'K', 'M', 'G', 'T', 'P', 'E'];
-        var threshold = sigFig &gt;= 3 ? 1024 : 102.4;
</del><ins>+        var isMiliseconds = false;
+        if (unit == 'ms') {
+            isMiliseconds = true;
+            unit = 's';
+        }
+        var divisor = unit == 'bytes' ? 1024 : 1000;
+
+        var suffix = ['\u03BC', 'm', '', 'K', 'M', 'G', 'T', 'P', 'E'];
+        var threshold = sigFig &gt;= 3 ? divisor : (divisor / 10);
</ins><span class="cx">         return function (bytes) {
</span><span class="cx">             var i;
</span><span class="cx">             var sign = bytes &gt;= 0 ? (alwaysShowSign ? '+' : '') : '-';
</span><span class="cx">             bytes = Math.abs(bytes);
</span><del>-
-            for (i = 0; bytes &gt;= threshold; i++)
-                bytes /= 1024;
-            return sign + bytes.toPrecision(Math.max(2, sigFig)) + units[i];
</del><ins>+            for (i = isMiliseconds ? 1 : 2; bytes &lt; 1; i--)
+                bytes *= divisor;
+            for (; bytes &gt;= threshold; i++)
+                bytes /= divisor;
+            return sign + bytes.toPrecision(Math.max(2, sigFig)) + ' ' + suffix[i] + (unit || '');
</ins><span class="cx">         }
</span><span class="cx">     },
</span><span class="cx">     _formatFetchedData: function (metricName, configurations)
</span><span class="cx">     {
</span><span class="cx">         var unit = RunsData.unitFromMetricName(metricName);
</span><span class="cx">         var smallerIsBetter = RunsData.isSmallerBetter(unit);
</span><ins>+        var deltaFormatterWithoutSign = this._makeFormatter(unit, 2, false);
</ins><span class="cx"> 
</span><del>-        var isBytes = unit == 'bytes';
-        var unitSuffix = unit ? ' ' + unit : '';
-        var deltaFormatterWithoutSign = isBytes ? this._formatBytes(2, false) : d3.format('.2g');
-
</del><span class="cx">         var currentTimeSeries = configurations.current.timeSeriesByCommitTime(false);
</span><span class="cx">         var baselineTimeSeries = configurations.baseline ? configurations.baseline.timeSeriesByCommitTime(false) : null;
</span><span class="cx">         var targetTimeSeries = configurations.target ? configurations.target.timeSeriesByCommitTime(false) : null;
</span><span class="lines">@@ -347,14 +352,12 @@
</span><span class="cx">             current: currentTimeSeries,
</span><span class="cx">             baseline: baselineTimeSeries,
</span><span class="cx">             target: targetTimeSeries,
</span><del>-            unit: unit,
-            formatWithUnit: function (value) { return this.formatter(value) + unitSuffix; },
</del><span class="cx">             formatWithDeltaAndUnit: function (value, delta)
</span><span class="cx">             {
</span><del>-                return this.formatter(value) + (delta &amp;&amp; !isNaN(delta) ? ' \u00b1 ' + deltaFormatterWithoutSign(delta) : '') + unitSuffix;
</del><ins>+                return this.formatter(value) + (delta &amp;&amp; !isNaN(delta) ? ' \u00b1 ' + deltaFormatterWithoutSign(delta) : '');
</ins><span class="cx">             },
</span><del>-            formatter: isBytes ? this._formatBytes(4, false) : d3.format('.4g'),
-            deltaFormatter: isBytes ? this._formatBytes(2, true) : d3.format('+.2g'),
</del><ins>+            formatter: this._makeFormatter(unit, 4, false),
+            deltaFormatter: this._makeFormatter(unit, 2, true),
</ins><span class="cx">             smallerIsBetter: smallerIsBetter,
</span><span class="cx">             showOutlier: function (show)
</span><span class="cx">             {
</span></span></pre>
</div>
</div>

</body>
</html>