Commit d6c5bb03 authored by yurys@chromium.org's avatar yurys@chromium.org

DevTools: fix aggegated pie chart for JSFrame events on Timeline

JSFrame events are added in TimelineFlameChart and their selfTime is never calculated. These events are never added into the model as they are used only to draw the flame chart. When such event is selected we calculate its selfTime on the fly as duration - sum of children times.

BUG=424507

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

git-svn-id: svn://svn.chromium.org/blink/trunk@183893 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b2ffbeaa
...@@ -531,8 +531,19 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct ...@@ -531,8 +531,19 @@ WebInspector.TracingTimelineUIUtils._buildTraceEventDetailsSynchronously = funct
var fragment = createDocumentFragment(); var fragment = createDocumentFragment();
var stats = {}; var stats = {};
var hasChildren = WebInspector.TracingTimelineUIUtils._aggregatedStatsForTraceEvent(stats, model, event); var hasChildren = WebInspector.TracingTimelineUIUtils._aggregatedStatsForTraceEvent(stats, model, event);
var selfTime = event.selfTime;
var selfCategory = WebInspector.TracingTimelineUIUtils.eventStyle(event).category;
// JSFrame events have 0 selfTime so we need to work around this below and add the event's time to scripting category.
if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame && !event.selfTime && event.duration) {
selfTime = event.duration;
for (var categoryName in stats)
selfTime -= stats[categoryName];
stats[selfCategory.name] = selfTime + (stats[selfCategory.name] || 0);
}
var pieChart = hasChildren ? var pieChart = hasChildren ?
WebInspector.TimelineUIUtils.generatePieChart(stats, WebInspector.TracingTimelineUIUtils.eventStyle(event).category, event.selfTime) : WebInspector.TimelineUIUtils.generatePieChart(stats, selfCategory, selfTime) :
WebInspector.TimelineUIUtils.generatePieChart(stats); WebInspector.TimelineUIUtils.generatePieChart(stats);
fragment.appendChild(pieChart); fragment.appendChild(pieChart);
......
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