<!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>[196290] trunk/PerformanceTests</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/196290">196290</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2016-02-08 19:30:23 -0800 (Mon, 08 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Allow adding any number of markers to the graph. The markers can be labeled
and contain timestamp and sample index data. Make it a part of the controller
rather than keeping it in the sampler.

* Animometer/resources/debug-runner/animometer.css: Add styles for markers
* Animometer/resources/debug-runner/graph.js: Create the markers and add
text labels.
* Animometer/resources/runner/animometer.js: Assume the samplingTimeOffset
is just one of the marks provided.
* Animometer/resources/strings.js: Add Strings.json.marks.
* Animometer/tests/resources/main.js:
(Controller): Keep marks here. They are keyed by the marker name, so no two
markers should have the same name.
(recordFirstSample): Refactor to use mark.
(mark): Allows for arbitrary data if needed later. The timestamp maintained
is relative to the absolute start timestamp.
(containsMark): Checks whether a mark with a specific comment exists.
(processSamples): Removes the _startTimestamp offset from the marks before
setting it in results.
* Animometer/tests/resources/sampler.js: Remove marks.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometerresourcesdebugrunneranimometercss">trunk/PerformanceTests/Animometer/resources/debug-runner/animometer.css</a></li>
<li><a href="#trunkPerformanceTestsAnimometerresourcesdebugrunnergraphjs">trunk/PerformanceTests/Animometer/resources/debug-runner/graph.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometerresourcesrunneranimometerjs">trunk/PerformanceTests/Animometer/resources/runner/animometer.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometerresourcesstringsjs">trunk/PerformanceTests/Animometer/resources/strings.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsresourcesmainjs">trunk/PerformanceTests/Animometer/tests/resources/main.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsresourcessamplerjs">trunk/PerformanceTests/Animometer/tests/resources/sampler.js</a></li>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsAnimometerresourcesdebugrunneranimometercss"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/debug-runner/animometer.css (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/debug-runner/animometer.css        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/Animometer/resources/debug-runner/animometer.css        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -403,10 +403,14 @@
</span><span class="cx">     shape-rendering: crispEdges;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.sample-time {
</del><ins>+.marker line {
</ins><span class="cx">     stroke: #5493D6;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.marker text {
+    fill: #999;
+}
+
</ins><span class="cx"> .left-mean {
</span><span class="cx">     stroke: #7ADD49;
</span><span class="cx">     opacity: .8;
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesdebugrunnergraphjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/debug-runner/graph.js (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/debug-runner/graph.js        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/Animometer/resources/debug-runner/graph.js        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -85,14 +85,27 @@
</span><span class="cx">                 .style(&quot;text-anchor&quot;, &quot;end&quot;)
</span><span class="cx">                 .text(axes[1]);
</span><span class="cx"> 
</span><del>-        // samplingTimeOffset
-        svg.append(&quot;line&quot;)
-            .attr(&quot;x1&quot;, x(graphData.samplingTimeOffset))
-            .attr(&quot;x2&quot;, x(graphData.samplingTimeOffset))
-            .attr(&quot;y1&quot;, yLeft(0))
-            .attr(&quot;y2&quot;, yLeft(yAxisLeft.scale().domain()[1]))
-            .attr(&quot;class&quot;, &quot;sample-time marker&quot;);
</del><ins>+        // marks
+        var yMin = yLeft(0);
+        var yMax = yLeft(yAxisLeft.scale().domain()[1]);
+        for (var markName in graphData.marks) {
+            var mark = graphData.marks[markName];
+            var xLocation = x(mark.time);
</ins><span class="cx"> 
</span><ins>+            var markerGroup = svg.append(&quot;g&quot;)
+                .attr(&quot;class&quot;, &quot;marker&quot;)
+                .attr(&quot;transform&quot;, &quot;translate(&quot; + xLocation + &quot;, 0)&quot;);
+            markerGroup.append(&quot;text&quot;)
+                    .attr(&quot;transform&quot;, &quot;translate(10, &quot; + (yMin - 10) + &quot;) rotate(-90)&quot;)
+                    .style(&quot;text-anchor&quot;, &quot;start&quot;)
+                    .text(markName)
+            markerGroup.append(&quot;line&quot;)
+                    .attr(&quot;x1&quot;, 0)
+                    .attr(&quot;x2&quot;, 0)
+                    .attr(&quot;y1&quot;, yMin)
+                    .attr(&quot;y2&quot;, yMax);
+        }
+
</ins><span class="cx">         // left-mean
</span><span class="cx">         svg.append(&quot;line&quot;)
</span><span class="cx">             .attr(&quot;x1&quot;, x(0))
</span><span class="lines">@@ -124,8 +137,8 @@
</span><span class="cx">         cursorGroup.append(&quot;line&quot;)
</span><span class="cx">             .attr(&quot;x1&quot;, 0)
</span><span class="cx">             .attr(&quot;x2&quot;, 0)
</span><del>-            .attr(&quot;y1&quot;, yLeft(0))
-            .attr(&quot;y2&quot;, yLeft(0));
</del><ins>+            .attr(&quot;y1&quot;, yMin)
+            .attr(&quot;y2&quot;, yMin);
</ins><span class="cx"> 
</span><span class="cx">         // Data
</span><span class="cx">         var allData = graphData.samples;
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesrunneranimometerjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/runner/animometer.js (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/runner/animometer.js        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/Animometer/resources/runner/animometer.js        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">                     testResults[Strings.json.experiments.frameRate][Strings.json.measurements.average]
</span><span class="cx">                 ],
</span><span class="cx">                 samples: data,
</span><del>-                samplingTimeOffset: testResults[Strings.json.samplingTimeOffset]
</del><ins>+                marks: testResults[Strings.json.marks]
</ins><span class="cx">             }
</span><span class="cx">             if (testResults[Strings.json.targetFPS])
</span><span class="cx">                 graphData.targetFPS = testResults[Strings.json.targetFPS];
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesstringsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/strings.js (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/strings.js        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/Animometer/resources/strings.js        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">     json: {
</span><span class="cx">         score: &quot;score&quot;,
</span><span class="cx">         samples: &quot;samples&quot;,
</span><ins>+        marks: &quot;marks&quot;,
</ins><span class="cx"> 
</span><span class="cx">         targetFPS: &quot;targetFPS&quot;,
</span><span class="cx">         samplingTimeOffset: &quot;samplingTimeOffset&quot;,
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsresourcesmainjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/resources/main.js (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/resources/main.js        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/Animometer/tests/resources/main.js        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -8,6 +8,7 @@
</span><span class="cx">         // Default data series: timestamp, complexity, estimatedFrameLength
</span><span class="cx">         this._sampler = new Sampler(options[&quot;series-count&quot;] || 3, 60 * testLength, this);
</span><span class="cx">         this._estimator = new SimpleKalmanEstimator(options[&quot;kalman-process-error&quot;], options[&quot;kalman-measurement-error&quot;]);
</span><ins>+        this._marks = {};
</ins><span class="cx"> 
</span><span class="cx">         this.initialComplexity = 0;
</span><span class="cx">     }, {
</span><span class="lines">@@ -22,9 +23,20 @@
</span><span class="cx">     recordFirstSample: function(stage, startTimestamp)
</span><span class="cx">     {
</span><span class="cx">         this._sampler.record(startTimestamp, stage.complexity(), -1);
</span><del>-        this._sampler.mark(Strings.json.samplingTimeOffset, { time: 0 });
</del><ins>+        this.mark(Strings.json.samplingTimeOffset, startTimestamp);
</ins><span class="cx">     },
</span><span class="cx"> 
</span><ins>+    mark: function(comment, timestamp, data) {
+        data = data || {};
+        data.time = timestamp;
+        data.index = this._sampler.sampleCount;
+        this._marks[comment] = data;
+    },
+
+    containsMark: function(comment) {
+        return comment in this._marks;
+    },
+
</ins><span class="cx">     update: function(stage, timestamp)
</span><span class="cx">     {
</span><span class="cx">         this._estimator.sample(timestamp - this._sampler.samples[0][this._sampler.sampleCount - 1]);
</span><span class="lines">@@ -49,12 +61,16 @@
</span><span class="cx">         var samples = this._sampler.samples;
</span><span class="cx"> 
</span><span class="cx">         var samplingIndex = 0;
</span><del>-        var samplingMark = this._sampler.marks[Strings.json.samplingTimeOffset];
</del><ins>+        var samplingMark = this._marks[Strings.json.samplingTimeOffset];
</ins><span class="cx">         if (samplingMark) {
</span><span class="cx">             samplingIndex = samplingMark.index;
</span><span class="cx">             results[Strings.json.samplingTimeOffset] = samplingMark.time;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        for (var markName in this._marks)
+            this._marks[markName].time -= this._startTimestamp;
+        results[Strings.json.marks] = this._marks;
+
</ins><span class="cx">         results[Strings.json.samples] = samples[0].map(function(timestamp, i) {
</span><span class="cx">             var result = {
</span><span class="cx">                 // Represent time in seconds
</span><span class="lines">@@ -140,9 +156,7 @@
</span><span class="cx">     {
</span><span class="cx">         if (!this._startedSampling &amp;&amp; timestamp &gt; this._samplingTimestamp) {
</span><span class="cx">             this._startedSampling = true;
</span><del>-            this._sampler.mark(Strings.json.samplingTimeOffset, {
-                time: this._samplingTimestamp - this._startTimestamp
-            });
</del><ins>+            this.mark(Strings.json.samplingTimeOffset, this._samplingTimestamp);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Start the work for the next frame.
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsresourcessamplerjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/resources/sampler.js (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/resources/sampler.js        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/Animometer/tests/resources/sampler.js        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -62,7 +62,6 @@
</span><span class="cx">             this.samples[i] = array;
</span><span class="cx">         }
</span><span class="cx">         this.sampleCount = 0;
</span><del>-        this.marks = {};
</del><span class="cx">     }, {
</span><span class="cx"> 
</span><span class="cx">     record: function() {
</span><span class="lines">@@ -73,14 +72,6 @@
</span><span class="cx">         ++this.sampleCount;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    mark: function(comment, data) {
-        data = data || {};
-        // The mark exists after the last recorded sample
-        data.index = this.sampleCount;
-
-        this.marks[comment] = data;
-    },
-
</del><span class="cx">     process: function()
</span><span class="cx">     {
</span><span class="cx">         var results = {};
</span></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (196289 => 196290)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/ChangeLog        2016-02-09 03:30:23 UTC (rev 196290)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2016-02-07  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Allow adding any number of markers to the graph. The markers can be labeled
+        and contain timestamp and sample index data. Make it a part of the controller
+        rather than keeping it in the sampler.
+
+        * Animometer/resources/debug-runner/animometer.css: Add styles for markers
+        * Animometer/resources/debug-runner/graph.js: Create the markers and add
+        text labels.
+        * Animometer/resources/runner/animometer.js: Assume the samplingTimeOffset
+        is just one of the marks provided.
+        * Animometer/resources/strings.js: Add Strings.json.marks.
+        * Animometer/tests/resources/main.js:
+        (Controller): Keep marks here. They are keyed by the marker name, so no two
+        markers should have the same name.
+        (recordFirstSample): Refactor to use mark.
+        (mark): Allows for arbitrary data if needed later. The timestamp maintained
+        is relative to the absolute start timestamp.
+        (containsMark): Checks whether a mark with a specific comment exists.
+        (processSamples): Removes the _startTimestamp offset from the marks before
+        setting it in results.
+        * Animometer/tests/resources/sampler.js: Remove marks.
+
+2016-02-07  Jon Lee  &lt;jonlee@apple.com&gt;
+
</ins><span class="cx">         Get rid of options member variable in Benchmark.
</span><span class="cx"> 
</span><span class="cx">         Options are only needed when initializing the stage or benchmark, so there's no
</span></span></pre>
</div>
</div>

</body>
</html>