Commit 675269aa authored by caseq's avatar caseq Committed by Commit bot

Timeline: do not show percent columns in Events tree view

Review URL: https://codereview.chromium.org/1470783003

Cr-Commit-Position: refs/heads/master@{#361203}
parent 1f6b8713
...@@ -64,6 +64,14 @@ WebInspector.TimelineTreeView.prototype = { ...@@ -64,6 +64,14 @@ WebInspector.TimelineTreeView.prototype = {
this._refreshTree(); this._refreshTree();
}, },
/**
* @return {boolean}
*/
_exposePercentages: function()
{
return false;
},
/** /**
* @param {!Element} parent * @param {!Element} parent
*/ */
...@@ -336,25 +344,9 @@ WebInspector.TimelineTreeView.GridNode.prototype = { ...@@ -336,25 +344,9 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
{ {
if (columnIdentifier !== "self" && columnIdentifier !== "total" && columnIdentifier !== "startTime") if (columnIdentifier !== "self" && columnIdentifier !== "total" && columnIdentifier !== "startTime")
return null; return null;
/**
* @param {number} time
* @return {string}
*/
function formatMilliseconds(time)
{
return WebInspector.UIString("%.1f\u2009ms", time);
}
/**
* @param {number} value
* @return {string}
*/
function formatPercent(value)
{
return WebInspector.UIString("%.1f\u2009%%", value);
}
var showPercents = false;
var value; var value;
var percentText;
var maxTime; var maxTime;
switch (columnIdentifier) { switch (columnIdentifier) {
case "startTime": case "startTime":
...@@ -362,13 +354,13 @@ WebInspector.TimelineTreeView.GridNode.prototype = { ...@@ -362,13 +354,13 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
break; break;
case "self": case "self":
value = this._profileNode.selfTime; value = this._profileNode.selfTime;
percentText = formatPercent(this._profileNode.selfTime / this._grandTotalTime * 100);
maxTime = this._maxSelfTime; maxTime = this._maxSelfTime;
showPercents = true;
break; break;
case "total": case "total":
value = this._profileNode.totalTime; value = this._profileNode.totalTime;
percentText = formatPercent(this._profileNode.totalTime / this._grandTotalTime * 100);
maxTime = this._maxTotalTime; maxTime = this._maxTotalTime;
showPercents = true;
break; break;
default: default:
return null; return null;
...@@ -376,13 +368,14 @@ WebInspector.TimelineTreeView.GridNode.prototype = { ...@@ -376,13 +368,14 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
var cell = this.createTD(columnIdentifier); var cell = this.createTD(columnIdentifier);
cell.className = "numeric-column"; cell.className = "numeric-column";
var textDiv = cell.createChild("div"); var textDiv = cell.createChild("div");
textDiv.createChild("span").textContent = formatMilliseconds(value); textDiv.createChild("span").textContent = WebInspector.UIString("%.1f\u2009ms", value);
if (percentText) {
textDiv.createChild("span", "percent-column").textContent = percentText; if (showPercents && this._treeView._exposePercentages())
textDiv.classList.add("profile-multiple-values"); textDiv.createChild("span", "percent-column").textContent = WebInspector.UIString("%.1f\u2009%%", value / this._grandTotalTime * 100);
} if (maxTime) {
if (maxTime) textDiv.classList.add("background-percent-bar");
cell.createChild("div", "background-bar-container").createChild("div", "background-bar").style.width = (value * 100 / maxTime).toFixed(1) + "%"; cell.createChild("div", "background-bar-container").createChild("div", "background-bar").style.width = (value * 100 / maxTime).toFixed(1) + "%";
}
return cell; return cell;
}, },
...@@ -475,6 +468,15 @@ WebInspector.AggregatedTimelineTreeView.prototype = { ...@@ -475,6 +468,15 @@ WebInspector.AggregatedTimelineTreeView.prototype = {
panelToolbar.appendToolbarItem(this._groupByCombobox); panelToolbar.appendToolbarItem(this._groupByCombobox);
}, },
/**
* @override
* @return {boolean}
*/
_exposePercentages: function()
{
return true;
},
_onGroupByChanged: function() _onGroupByChanged: function()
{ {
this._groupBySetting.set(this._groupByCombobox.selectedOption().value); this._groupBySetting.set(this._groupByCombobox.selectedOption().value);
......
...@@ -971,7 +971,7 @@ ...@@ -971,7 +971,7 @@
position: relative; position: relative;
} }
.timeline-tree-view .data-grid div.profile-multiple-values { .timeline-tree-view .data-grid div.background-percent-bar {
float: right; float: right;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment