Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2210)

Unified Diff: Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 306803003: Correctly show self time in trace event details pie chart (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineUIUtils.js
diff --git a/Source/devtools/front_end/timeline/TimelineUIUtils.js b/Source/devtools/front_end/timeline/TimelineUIUtils.js
index de69a605746b8ba491363105066310ffc51a1ff1..f912de5b8182a75b2d39596188c1923d2aa15145 100644
--- a/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -738,7 +738,10 @@ WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronously = function(eve
{
var fragment = document.createDocumentFragment();
var stats = WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent(model, event);
- fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(stats));
+ var pieChart = stats.hasChildren ?
+ WebInspector.TimelineUIUtils.generatePieChart(stats.aggregatedStats, WebInspector.TimelineUIUtils.styleForTimelineEvent(event.name).category, event.selfTime) :
+ WebInspector.TimelineUIUtils.generatePieChart(stats.aggregatedStats);
+ fragment.appendChild(pieChart);
var recordTypes = WebInspector.TimelineModel.RecordType;
@@ -888,7 +891,7 @@ WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronously = function(eve
/**
* @param {!WebInspector.TracingModel} model
* @param {!WebInspector.TracingModel.Event} event
- * @return {!Object}
+ * @return {!{ aggregatedStats: !Object, hasChildren: boolean }}
*/
WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(model, event)
{
@@ -903,20 +906,23 @@ WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(model, eve
return startTime - e.startTime;
}
var index = events.binaryIndexOf(event.startTime, eventComparator);
+ var hasChildren = false;
var aggregatedStats = {};
var endTime = event.endTime;
- if (!endTime)
- return aggregatedStats;
- for (; index < events.length; index++) {
- var nextEvent = events[index];
- if (nextEvent.startTime > endTime)
- break;
- if (!nextEvent.selfTime)
- continue;
- var category = WebInspector.TimelineUIUtils.styleForTimelineEvent(nextEvent.name).category.name;
- aggregatedStats[category] = (aggregatedStats[category] || 0) + nextEvent.selfTime;
+ if (endTime) {
+ for (var i = index; i < events.length; i++) {
+ var nextEvent = events[i];
+ if (nextEvent.startTime >= endTime)
+ break;
+ if (!nextEvent.selfTime)
+ continue;
+ if (i > index)
+ hasChildren = true;
+ var category = WebInspector.TimelineUIUtils.styleForTimelineEvent(nextEvent.name).category.name;
+ aggregatedStats[category] = (aggregatedStats[category] || 0) + nextEvent.selfTime / 1000;
+ }
}
- return aggregatedStats;
+ return { aggregatedStats: aggregatedStats, hasChildren: hasChildren };
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698