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

Side by Side Diff: Source/devtools/front_end/timeline/TracingModel.js

Issue 318093002: Convert timestamp to milliseconds when creating TracingModel.Event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @extends {WebInspector.TargetAwareObject} 9 * @extends {WebInspector.TargetAwareObject}
10 */ 10 */
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 process = new WebInspector.TracingModel.Process(payload.pid); 180 process = new WebInspector.TracingModel.Process(payload.pid);
181 this._processById[payload.pid] = process; 181 this._processById[payload.pid] = process;
182 } 182 }
183 var thread = process.threadById(payload.tid); 183 var thread = process.threadById(payload.tid);
184 if (payload.ph === WebInspector.TracingModel.Phase.SnapshotObject) { 184 if (payload.ph === WebInspector.TracingModel.Phase.SnapshotObject) {
185 var event = thread.addEvent(payload); 185 var event = thread.addEvent(payload);
186 process.addObject(event); 186 process.addObject(event);
187 return; 187 return;
188 } 188 }
189 if (payload.ph !== WebInspector.TracingModel.Phase.Metadata) { 189 if (payload.ph !== WebInspector.TracingModel.Phase.Metadata) {
190 var timestamp = payload.ts; 190 var timestamp = payload.ts / 1000;
191 // We do allow records for unrelated threads to arrive out-of-order, 191 // We do allow records for unrelated threads to arrive out-of-order,
192 // so there's a chance we're getting records from the past. 192 // so there's a chance we're getting records from the past.
193 if (timestamp && (!this._minimumRecordTime || timestamp < this._mini mumRecordTime)) 193 if (timestamp && (!this._minimumRecordTime || timestamp < this._mini mumRecordTime))
194 this._minimumRecordTime = timestamp; 194 this._minimumRecordTime = timestamp;
195 if (!this._maximumRecordTime || timestamp > this._maximumRecordTime) 195 if (!this._maximumRecordTime || timestamp > this._maximumRecordTime)
196 this._maximumRecordTime = timestamp; 196 this._maximumRecordTime = timestamp;
197 var event = thread.addEvent(payload); 197 var event = thread.addEvent(payload);
198 if (event && event.name === WebInspector.TracingModel.DevToolsMetada taEvent.TracingStartedInPage && 198 if (event && event.name === WebInspector.TracingModel.DevToolsMetada taEvent.TracingStartedInPage &&
199 event.category === WebInspector.TracingModel.DevToolsMetadataEve ntCategory && 199 event.category === WebInspector.TracingModel.DevToolsMetadataEve ntCategory &&
200 event.args["sessionId"] === this._sessionId) 200 event.args["sessionId"] === this._sessionId)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 /** 247 /**
248 * @constructor 248 * @constructor
249 * @param {!WebInspector.TracingModel.EventPayload} payload 249 * @param {!WebInspector.TracingModel.EventPayload} payload
250 * @param {number} level 250 * @param {number} level
251 * @param {?WebInspector.TracingModel.Thread} thread 251 * @param {?WebInspector.TracingModel.Thread} thread
252 */ 252 */
253 WebInspector.TracingModel.Event = function(payload, level, thread) 253 WebInspector.TracingModel.Event = function(payload, level, thread)
254 { 254 {
255 this.name = payload.name; 255 this.name = payload.name;
256 this.category = payload.cat; 256 this.category = payload.cat;
257 this.startTime = payload.ts; 257 this.startTime = payload.ts / 1000;
258 this.args = payload.args; 258 this.args = payload.args;
259 this.phase = payload.ph; 259 this.phase = payload.ph;
260 this.level = level; 260 this.level = level;
261 261
262 if (payload.id) 262 if (payload.id)
263 this.id = payload.id; 263 this.id = payload.id;
264 264
265 this.thread = thread; 265 this.thread = thread;
266 266
267 /** @type {?string} */ 267 /** @type {?string} */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 console.assert(false, "Open/close event mismatch: " + this.name + " vs. " + payload.name); 300 console.assert(false, "Open/close event mismatch: " + this.name + " vs. " + payload.name);
301 return; 301 return;
302 } 302 }
303 if (payload.args) { 303 if (payload.args) {
304 for (var name in payload.args) { 304 for (var name in payload.args) {
305 if (name in this.args) 305 if (name in this.args)
306 console.error("Same argument name (" + name + ") is used fo r begin and end phases of " + this.name); 306 console.error("Same argument name (" + name + ") is used fo r begin and end phases of " + this.name);
307 this.args[name] = payload.args[name]; 307 this.args[name] = payload.args[name];
308 } 308 }
309 } 309 }
310 var duration = payload.ts - this.startTime; 310 var duration = payload.ts / 1000 - this.startTime;
311 if (duration < 0) { 311 if (duration < 0) {
312 console.assert(false, "Event out of order: " + this.name); 312 console.assert(false, "Event out of order: " + this.name);
313 return; 313 return;
314 } 314 }
315 this._setDuration(duration); 315 this._setDuration(duration);
316 } 316 }
317 } 317 }
318 318
319 /** 319 /**
320 * @param {!WebInspector.TracingModel.Event} a 320 * @param {!WebInspector.TracingModel.Event} a
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 var openEvent = this._stack.pop(); 476 var openEvent = this._stack.pop();
477 // Quietly ignore unbalanced close events, they're legit (we could h ave missed start one). 477 // Quietly ignore unbalanced close events, they're legit (we could h ave missed start one).
478 if (openEvent) 478 if (openEvent)
479 openEvent._complete(payload); 479 openEvent._complete(payload);
480 return null; 480 return null;
481 } 481 }
482 482
483 var event = new WebInspector.TracingModel.Event(payload, this._stack.len gth, this); 483 var event = new WebInspector.TracingModel.Event(payload, this._stack.len gth, this);
484 if (payload.ph === WebInspector.TracingModel.Phase.Begin || payload.ph = == WebInspector.TracingModel.Phase.Complete) { 484 if (payload.ph === WebInspector.TracingModel.Phase.Begin || payload.ph = == WebInspector.TracingModel.Phase.Complete) {
485 if (payload.ph === WebInspector.TracingModel.Phase.Complete) 485 if (payload.ph === WebInspector.TracingModel.Phase.Complete)
486 event._setDuration(payload.dur); 486 event._setDuration(payload.dur / 1000);
487 this._stack.push(event); 487 this._stack.push(event);
488 if (this._maxStackDepth < this._stack.length) 488 if (this._maxStackDepth < this._stack.length)
489 this._maxStackDepth = this._stack.length; 489 this._maxStackDepth = this._stack.length;
490 } 490 }
491 if (this._events.length && this._events.peekLast().startTime > event.sta rtTime) 491 if (this._events.length && this._events.peekLast().startTime > event.sta rtTime)
492 console.assert(false, "Event is our of order: " + event.name); 492 console.assert(false, "Event is our of order: " + event.name);
493 this._events.push(event); 493 this._events.push(event);
494 return event; 494 return event;
495 }, 495 },
496 496
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 dataCollected: function(data) 548 dataCollected: function(data)
549 { 549 {
550 this._tracingModel._eventsCollected(data); 550 this._tracingModel._eventsCollected(data);
551 }, 551 },
552 552
553 tracingComplete: function() 553 tracingComplete: function()
554 { 554 {
555 this._tracingModel._tracingComplete(); 555 this._tracingModel._tracingComplete();
556 } 556 }
557 } 557 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698