Title: [196290] trunk/PerformanceTests
Revision
196290
Author
jon...@apple.com
Date
2016-02-08 19:30:23 -0800 (Mon, 08 Feb 2016)

Log Message

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.

Modified Paths

Diff

Modified: trunk/PerformanceTests/Animometer/resources/debug-runner/animometer.css (196289 => 196290)


--- 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)
@@ -403,10 +403,14 @@
     shape-rendering: crispEdges;
 }
 
-.sample-time {
+.marker line {
     stroke: #5493D6;
 }
 
+.marker text {
+    fill: #999;
+}
+
 .left-mean {
     stroke: #7ADD49;
     opacity: .8;

Modified: trunk/PerformanceTests/Animometer/resources/debug-runner/graph.js (196289 => 196290)


--- 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)
@@ -85,14 +85,27 @@
                 .style("text-anchor", "end")
                 .text(axes[1]);
 
-        // samplingTimeOffset
-        svg.append("line")
-            .attr("x1", x(graphData.samplingTimeOffset))
-            .attr("x2", x(graphData.samplingTimeOffset))
-            .attr("y1", yLeft(0))
-            .attr("y2", yLeft(yAxisLeft.scale().domain()[1]))
-            .attr("class", "sample-time marker");
+        // 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);
 
+            var markerGroup = svg.append("g")
+                .attr("class", "marker")
+                .attr("transform", "translate(" + xLocation + ", 0)");
+            markerGroup.append("text")
+                    .attr("transform", "translate(10, " + (yMin - 10) + ") rotate(-90)")
+                    .style("text-anchor", "start")
+                    .text(markName)
+            markerGroup.append("line")
+                    .attr("x1", 0)
+                    .attr("x2", 0)
+                    .attr("y1", yMin)
+                    .attr("y2", yMax);
+        }
+
         // left-mean
         svg.append("line")
             .attr("x1", x(0))
@@ -124,8 +137,8 @@
         cursorGroup.append("line")
             .attr("x1", 0)
             .attr("x2", 0)
-            .attr("y1", yLeft(0))
-            .attr("y2", yLeft(0));
+            .attr("y1", yMin)
+            .attr("y2", yMin);
 
         // Data
         var allData = graphData.samples;

Modified: trunk/PerformanceTests/Animometer/resources/runner/animometer.js (196289 => 196290)


--- 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)
@@ -126,7 +126,7 @@
                     testResults[Strings.json.experiments.frameRate][Strings.json.measurements.average]
                 ],
                 samples: data,
-                samplingTimeOffset: testResults[Strings.json.samplingTimeOffset]
+                marks: testResults[Strings.json.marks]
             }
             if (testResults[Strings.json.targetFPS])
                 graphData.targetFPS = testResults[Strings.json.targetFPS];

Modified: trunk/PerformanceTests/Animometer/resources/strings.js (196289 => 196290)


--- 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)
@@ -25,6 +25,7 @@
     json: {
         score: "score",
         samples: "samples",
+        marks: "marks",
 
         targetFPS: "targetFPS",
         samplingTimeOffset: "samplingTimeOffset",

Modified: trunk/PerformanceTests/Animometer/tests/resources/main.js (196289 => 196290)


--- 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)
@@ -8,6 +8,7 @@
         // Default data series: timestamp, complexity, estimatedFrameLength
         this._sampler = new Sampler(options["series-count"] || 3, 60 * testLength, this);
         this._estimator = new SimpleKalmanEstimator(options["kalman-process-error"], options["kalman-measurement-error"]);
+        this._marks = {};
 
         this.initialComplexity = 0;
     }, {
@@ -22,9 +23,20 @@
     recordFirstSample: function(stage, startTimestamp)
     {
         this._sampler.record(startTimestamp, stage.complexity(), -1);
-        this._sampler.mark(Strings.json.samplingTimeOffset, { time: 0 });
+        this.mark(Strings.json.samplingTimeOffset, startTimestamp);
     },
 
+    mark: function(comment, timestamp, data) {
+        data = "" || {};
+        data.time = timestamp;
+        data.index = this._sampler.sampleCount;
+        this._marks[comment] = data;
+    },
+
+    containsMark: function(comment) {
+        return comment in this._marks;
+    },
+
     update: function(stage, timestamp)
     {
         this._estimator.sample(timestamp - this._sampler.samples[0][this._sampler.sampleCount - 1]);
@@ -49,12 +61,16 @@
         var samples = this._sampler.samples;
 
         var samplingIndex = 0;
-        var samplingMark = this._sampler.marks[Strings.json.samplingTimeOffset];
+        var samplingMark = this._marks[Strings.json.samplingTimeOffset];
         if (samplingMark) {
             samplingIndex = samplingMark.index;
             results[Strings.json.samplingTimeOffset] = samplingMark.time;
         }
 
+        for (var markName in this._marks)
+            this._marks[markName].time -= this._startTimestamp;
+        results[Strings.json.marks] = this._marks;
+
         results[Strings.json.samples] = samples[0].map(function(timestamp, i) {
             var result = {
                 // Represent time in seconds
@@ -140,9 +156,7 @@
     {
         if (!this._startedSampling && timestamp > this._samplingTimestamp) {
             this._startedSampling = true;
-            this._sampler.mark(Strings.json.samplingTimeOffset, {
-                time: this._samplingTimestamp - this._startTimestamp
-            });
+            this.mark(Strings.json.samplingTimeOffset, this._samplingTimestamp);
         }
 
         // Start the work for the next frame.

Modified: trunk/PerformanceTests/Animometer/tests/resources/sampler.js (196289 => 196290)


--- 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)
@@ -62,7 +62,6 @@
             this.samples[i] = array;
         }
         this.sampleCount = 0;
-        this.marks = {};
     }, {
 
     record: function() {
@@ -73,14 +72,6 @@
         ++this.sampleCount;
     },
 
-    mark: function(comment, data) {
-        data = "" || {};
-        // The mark exists after the last recorded sample
-        data.index = this.sampleCount;
-
-        this.marks[comment] = data;
-    },
-
     process: function()
     {
         var results = {};

Modified: trunk/PerformanceTests/ChangeLog (196289 => 196290)


--- trunk/PerformanceTests/ChangeLog	2016-02-09 03:30:18 UTC (rev 196289)
+++ trunk/PerformanceTests/ChangeLog	2016-02-09 03:30:23 UTC (rev 196290)
@@ -1,5 +1,28 @@
 2016-02-07  Jon Lee  <jon...@apple.com>
 
+        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  <jon...@apple.com>
+
         Get rid of options member variable in Benchmark.
 
         Options are only needed when initializing the stage or benchmark, so there's no
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to