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

Side by Side Diff: chrome/browser/resources/tracing/timeline_model.js

Issue 8359025: Tons of timeline tweaks (Closed)
Patch Set: Style fixes Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @fileoverview TimelineModel is a parsed representation of the 7 * @fileoverview TimelineModel is a parsed representation of the
8 * TraceEvents obtained from base/trace_event in which the begin-end 8 * TraceEvents obtained from base/trace_event in which the begin-end
9 * tokens are converted into a hierarchy of processes, threads, 9 * tokens are converted into a hierarchy of processes, threads,
10 * subrows, and slices. 10 * subrows, and slices.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 this.maxTimestamp = undefined; 113 this.maxTimestamp = undefined;
114 } 114 }
115 } 115 }
116 116
117 }; 117 };
118 118
119 /** 119 /**
120 * Comparison between threads that orders first by pid, 120 * Comparison between threads that orders first by pid,
121 * then by names, then by tid. 121 * then by names, then by tid.
122 */ 122 */
123 TimelineThread.compare = function(x,y) { 123 TimelineThread.compare = function(x, y) {
124 if(x.parent.pid != y.parent.pid) { 124 if (x.parent.pid != y.parent.pid) {
125 return x.parent.pid - y.parent.pid; 125 return x.parent.pid - y.parent.pid;
126 } 126 }
127 127
128 if (x.name && y.name) { 128 if (x.name && y.name) {
129 var tmp = x.name.localeCompare(y.name); 129 var tmp = x.name.localeCompare(y.name);
130 if (tmp == 0) 130 if (tmp == 0)
131 return x.tid - y.tid; 131 return x.tid - y.tid;
132 return tmp; 132 return tmp;
133 } else if (x.name) { 133 } else if (x.name) {
134 return -1; 134 return -1;
135 } else if (y.name){ 135 } else if (y.name) {
136 return 1; 136 return 1;
137 } else { 137 } else {
138 return x.tid - y.tid; 138 return x.tid - y.tid;
139 } 139 }
140 }; 140 };
141 141
142 142
143 /** 143 /**
144 * The TimelineProcess represents a single process in the 144 * The TimelineProcess represents a single process in the
145 * trace. Right now, we keep this around purely for bookkeeping 145 * trace. Right now, we keep this around purely for bookkeeping
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 processEnd(state, event); 297 processEnd(state, event);
298 } else if (event.ph == 'M') { 298 } else if (event.ph == 'M') {
299 if (event.name == 'thread_name') { 299 if (event.name == 'thread_name') {
300 var thread = this.getProcess(event.pid).getThread(event.tid); 300 var thread = this.getProcess(event.pid).getThread(event.tid);
301 thread.name = event.args.name; 301 thread.name = event.args.name;
302 } else { 302 } else {
303 this.importErrors.push('Unrecognized metadata name: ' + event.name); 303 this.importErrors.push('Unrecognized metadata name: ' + event.name);
304 } 304 }
305 } else { 305 } else {
306 this.importErrors.push('Unrecognized event phase: ' + event.ph + 306 this.importErrors.push('Unrecognized event phase: ' + event.ph +
307 '(' + event.name + ')'); 307 '(' + event.name + ')');
308 } 308 }
309 } 309 }
310 this.pruneEmptyThreads(); 310 this.pruneEmptyThreads();
311 this.updateBounds(); 311 this.updateBounds();
312 312
313 // Add end events for any events that are still on the stack. These 313 // Add end events for any events that are still on the stack. These
314 // are events that were still open when trace was ended, and can often 314 // are events that were still open when trace was ended, and can often
315 // indicate deadlock behavior. 315 // indicate deadlock behavior.
316 for (var ptid in threadStateByPTID) { 316 for (var ptid in threadStateByPTID) {
317 var state = threadStateByPTID[ptid]; 317 var state = threadStateByPTID[ptid];
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 }; 411 };
412 412
413 return { 413 return {
414 TimelineSlice: TimelineSlice, 414 TimelineSlice: TimelineSlice,
415 TimelineThread: TimelineThread, 415 TimelineThread: TimelineThread,
416 TimelineProcess: TimelineProcess, 416 TimelineProcess: TimelineProcess,
417 TimelineModel: TimelineModel 417 TimelineModel: TimelineModel
418 }; 418 };
419 }); 419 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698