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

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

Issue 305623007: Add aggregated stats to selected trace event details (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comment 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 924dd5475db37272c07d4f872a221b24bcf5106b..de69a605746b8ba491363105066310ffc51a1ff1 100644
--- a/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -737,6 +737,9 @@ WebInspector.TimelineUIUtils.buildTraceEventDetails = function(event, model, lin
WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronously = function(event, model, linkifier, imagePreviewElement, relatedNode, loadedFromFile, bindings, target)
{
var fragment = document.createDocumentFragment();
+ var stats = WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent(model, event);
+ fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(stats));
+
var recordTypes = WebInspector.TimelineModel.RecordType;
// The messages may vary per event.name;
@@ -883,6 +886,40 @@ WebInspector.TimelineUIUtils._buildTraceEventDetailsSynchronously = function(eve
}
/**
+ * @param {!WebInspector.TracingModel} model
+ * @param {!WebInspector.TracingModel.Event} event
+ * @return {!Object}
+ */
+WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent = function(model, event)
+{
+ var events = model.inspectedTargetEvents();
+ /**
+ * @param {number} startTime
+ * @param {!WebInspector.TracingModel.Event} e
+ * @return {number}
+ */
+ function eventComparator(startTime, e)
+ {
+ return startTime - e.startTime;
+ }
+ var index = events.binaryIndexOf(event.startTime, eventComparator);
+ 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;
+ }
+ return aggregatedStats;
+}
+
+/**
* @param {!Array.<number>} quad
* @return {number}
*/
« 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