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

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

Issue 322763002: Timeline: fix trace event nesting computation after r175746 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: compute endTime & duration with better precision Created 6 years, 6 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/TracingModel.js
diff --git a/Source/devtools/front_end/timeline/TracingModel.js b/Source/devtools/front_end/timeline/TracingModel.js
index 9265df8f85ed53dc19a50f0c38eebfd2e0098db3..0db8da8117480dfbc1c9ce1eaff3040212fbce32 100644
--- a/Source/devtools/front_end/timeline/TracingModel.js
+++ b/Source/devtools/front_end/timeline/TracingModel.js
@@ -263,6 +263,11 @@ WebInspector.TracingModel.Event = function(payload, level, thread)
this.phase = payload.ph;
this.level = level;
+ if (payload.dur) {
+ this.endTime = (payload.ts + payload.dur) / 1000;
+ this.duration = payload.dur / 1000;
yurys 2014/06/09 11:38:47 I'd probably write it as this.duration = this.endT
+ }
+
if (payload.id)
this.id = payload.id;
@@ -287,15 +292,6 @@ WebInspector.TracingModel.Event = function(payload, level, thread)
WebInspector.TracingModel.Event.prototype = {
/**
- * @param {number} duration
- */
- _setDuration: function(duration)
- {
- this.endTime = this.startTime + duration;
- this.duration = duration;
- },
-
- /**
* @param {!WebInspector.TracingModel.EventPayload} payload
*/
_complete: function(payload)
@@ -311,12 +307,13 @@ WebInspector.TracingModel.Event.prototype = {
this.args[name] = payload.args[name];
}
}
- var duration = payload.ts / 1000 - this.startTime;
- if (duration < 0) {
+ var timestamp = payload.ts / 1000;
+ if (timestamp < this.startTime) {
console.assert(false, "Event out of order: " + this.name);
return;
}
- this._setDuration(duration);
+ this.endTime = timestamp;
+ this.duration = this.endTime - this.startTime;
}
}
@@ -472,7 +469,7 @@ WebInspector.TracingModel.Thread.prototype = {
*/
addEvent: function(payload)
{
- for (var top = this._stack.peekLast(); top && top.endTime && top.endTime <= payload.ts;) {
+ for (var top = this._stack.peekLast(); top && top.endTime && top.endTime <= payload.ts / 1000;) {
this._stack.pop();
top = this._stack.peekLast();
}
@@ -486,8 +483,6 @@ WebInspector.TracingModel.Thread.prototype = {
var event = new WebInspector.TracingModel.Event(payload, this._stack.length, this);
if (payload.ph === WebInspector.TracingModel.Phase.Begin || payload.ph === WebInspector.TracingModel.Phase.Complete) {
- if (payload.ph === WebInspector.TracingModel.Phase.Complete)
- event._setDuration(payload.dur / 1000);
this._stack.push(event);
if (this._maxStackDepth < this._stack.length)
this._maxStackDepth = this._stack.length;
« 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