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

Unified Diff: Source/devtools/front_end/TimelineModel.js

Issue 104523002: [DevTools] Add power profiler and power overview in timeline panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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
Index: Source/devtools/front_end/TimelineModel.js
diff --git a/Source/devtools/front_end/TimelineModel.js b/Source/devtools/front_end/TimelineModel.js
old mode 100644
new mode 100755
index 3e9f84a82485521ca461bdc326c2b04386f88521..d03cf6e91dcfd476556cf075fbba2e265d62efdf
--- a/Source/devtools/front_end/TimelineModel.js
+++ b/Source/devtools/front_end/TimelineModel.js
@@ -42,6 +42,7 @@ WebInspector.TimelineModel = function()
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded, this);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this);
+ WebInspector.powerProfiler.addEventListener(WebInspector.PowerProfiler.EventTypes.PowerEventRecorded, this._onPowerEventAdded, this);
pfeldman 2014/01/09 11:38:52 Timeline model should not depend on any of the pro
Pan 2014/02/13 06:01:40 Hi @pfeldman, @qsr, I'm thinking the first soluti
}
WebInspector.TimelineModel.TransferChunkLengthBytes = 5000000;
@@ -102,6 +103,8 @@ WebInspector.TimelineModel.RecordType = {
WebSocketSendHandshakeRequest : "WebSocketSendHandshakeRequest",
WebSocketReceiveHandshakeResponse : "WebSocketReceiveHandshakeResponse",
WebSocketDestroy : "WebSocketDestroy",
+
+ SoC_Package : "SoC_Package",
}
WebInspector.TimelineModel.Events = {
@@ -161,6 +164,10 @@ WebInspector.TimelineModel.prototype = {
{
this._clientInitiatedRecording = true;
this.reset();
+
+ if (WebInspector.experimentsSettings.powerProfile.isEnabled())
+ WebInspector.powerProfiler.startProfile();
+
var maxStackFrames = WebInspector.settings.timelineCaptureStacks.get() ? 30 : 0;
var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEnabled();
WebInspector.timelineManager.start(maxStackFrames, includeDomCounters, includeGPUEvents, this._fireRecordingStarted.bind(this));
@@ -181,6 +188,9 @@ WebInspector.TimelineModel.prototype = {
}
this._clientInitiatedRecording = false;
WebInspector.timelineManager.stop(this._fireRecordingStopped.bind(this));
+
+ if (WebInspector.experimentsSettings.powerProfile.isEnabled())
+ WebInspector.powerProfiler.stopProfile();
},
get records()
@@ -231,6 +241,21 @@ WebInspector.TimelineModel.prototype = {
this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStopped);
},
+ _onPowerEventAdded: function(event)
+ {
+ if (this._collectionEnabled) {
+ var records = event.data;
+ for(var item in records) {
+ records[item]["startTime"] = records[item].timestamp;
+ delete records[item].timestamp;
+ }
+ this._stringPool.internObjectStrings(records);
+ this._records = this._records.concat(records);
+ records.forEach(this._updateBoundaries.bind(this)); // shall we update boundary here?
+ this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordAdded, records);
+ }
+ },
+
/**
* @param {TimelineAgent.TimelineEvent} record
*/

Powered by Google App Engine
This is Rietveld 408576698