https://bugs.webkit.org/show_bug.cgi?id=141238
Reviewed by Darin Adler.
Safari UI tests use custom metrics that end with "Time". This patch teaches the perf dashboard how to
get the unit for a given metric based on the suffix of the metric name instead of hard-coding the mapping
between metrics and their units.
* public/js/helper-classes.js:
(PerfTestRuns): Use the suffix of the metric name to compute the unit.
* public/v2/manifest.js:
(App.Manifest.fetchRunsWithPlatformAndMetric): Ditto. Also set "useSI" property iff for "bytes".
* public/v2/interactive-chart.js:
(App.InteractiveChartComponent._constructGraphIfPossible): Respect useSI. Use toPrecision(3) otherwise.
(App.InteractiveChartComponent._relayoutDataAndAxes): Place the unit vertically on the left of ticks.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179613
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-02-04 Ryosuke Niwa <rniwa@webkit.org>
+
+ Perf dashboard doesn’t show the right unit for Safari UI tests
+ https://bugs.webkit.org/show_bug.cgi?id=141238
+
+ Reviewed by Darin Adler.
+
+ Safari UI tests use custom metrics that end with "Time". This patch teaches the perf dashboard how to
+ get the unit for a given metric based on the suffix of the metric name instead of hard-coding the mapping
+ between metrics and their units.
+
+ * public/js/helper-classes.js:
+ (PerfTestRuns): Use the suffix of the metric name to compute the unit.
+ * public/v2/manifest.js:
+ (App.Manifest.fetchRunsWithPlatformAndMetric): Ditto. Also set "useSI" property iff for "bytes".
+ * public/v2/interactive-chart.js:
+ (App.InteractiveChartComponent._constructGraphIfPossible): Respect useSI. Use toPrecision(3) otherwise.
+ (App.InteractiveChartComponent._relayoutDataAndAxes): Place the unit vertically on the left of ticks.
+
2015-02-04 Ryosuke Niwa <rniwa@webkit.org>
Interactive chart component provides two duplicate API for highlighting points
var cachedUnit = null;
var cachedScalingFactor = null;
var baselines = {};
+ var suffix = metric.name.match('([A-z][a-z]+|FrameRate)$')[0];
var unit = {'Combined': '', // Assume smaller is better for now.
'FrameRate': 'fps',
'Runs': '/s',
'Time': 'ms',
'Malloc': 'B',
- 'JSHeap': 'B',
- 'Allocations': 'B',
- 'EndAllocations': 'B',
- 'MaxAllocations': 'B',
- 'MeanAllocations': 'B'}[metric.name];
+ 'Heap': 'B',
+ 'Allocations': 'B'}[suffix];
// We can't do this in PerfTestResult because all results for each metric need to share the same unit and the same scaling factor.
function computeScalingFactorIfNeeded() {
}
if (this.get('showYAxis')) {
- this._yAxis = d3.svg.axis().scale(this._y).orient("left").ticks(6).tickFormat(d3.format("s"));
+ this._yAxis = d3.svg.axis().scale(this._y).orient("left").ticks(6).tickFormat(
+ chartData.useSI ? d3.format("s") : d3.format(".3g"));
this._yAxisLabels = svg.append("g")
.attr("class", "y axis");
}
this._yAxisLabels.call(this._yAxis);
if (this._yAxisUnitContainer)
this._yAxisUnitContainer.remove();
+ var x = - 3 * this._rem;
+ var y = this._contentHeight / 2;
this._yAxisUnitContainer = this._yAxisLabels.append("text")
- .attr("x", 0.5 * this._rem)
- .attr("y", 0.2 * this._rem)
- .attr("dy", 0.8 * this._rem)
- .style("text-anchor", "start")
- .style("z-index", "100")
+ .attr("transform", "rotate(90 0 0) translate(" + y + ", " + (-x) + ")")
+ .style("text-anchor", "middle")
.text(this._yAxisUnit);
},
_updateHighlightPositions: function () {
var platform = App.Manifest.platform(platformId);
var metric = App.Manifest.metric(metricId);
- // FIXME: Include this information in JSON and process it in RunsData.fetchRuns
- var unit = {'Combined': '', // Assume smaller is better for now.
+ var suffix = metric.get('name').match('([A-z][a-z]+|FrameRate)$')[0];
+ var unit = {
'FrameRate': 'fps',
- 'Runs': 'runs/s',
+ 'Runs': '/s',
'Time': 'ms',
'Malloc': 'bytes',
- 'JSHeap': 'bytes',
- 'Allocations': 'bytes',
- 'EndAllocations': 'bytes',
- 'MaxAllocations': 'bytes',
- 'MeanAllocations': 'bytes'}[metric.get('name')];
+ 'Heap': 'bytes',
+ 'Allocations': 'bytes'
+ }[suffix];
+
+ // FIXME: Include this information in JSON and process it in RunsData.fetchRuns
runs.unit = unit;
+ runs.useSI = unit == 'bytes';
return {platform: platform, metric: metric, runs: runs};
});