Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 sliceID += ';' + event.args[x]; | 276 sliceID += ';' + event.args[x]; |
| 277 var slice = state.openNonNestedSlices[sliceID]; | 277 var slice = state.openNonNestedSlices[sliceID]; |
| 278 if (!slice) | 278 if (!slice) |
| 279 return; | 279 return; |
| 280 slice.slice.duration = event.ts - slice.slice.start; | 280 slice.slice.duration = event.ts - slice.slice.start; |
| 281 if (event.uts) | 281 if (event.uts) |
| 282 slice.durationInUserTime = event.uts - slice.slice.startInUserTime; | 282 slice.durationInUserTime = event.uts - slice.slice.startInUserTime; |
| 283 | 283 |
| 284 // Store the slice in a non-nested subrow. | 284 // Store the slice in a non-nested subrow. |
| 285 var thread = self.getOrCreateProcess(event.pid). | 285 var thread = self.getOrCreateProcess(event.pid). |
| 286 getOrCreateThread(event.tid); | 286 getOrCreateThread(event.tid); |
|
James Hawkins
2011/11/10 01:06:13
4 space indentation when wrapping lines.
nduca
2011/11/10 02:24:35
Done.
| |
| 287 thread.addNonNestedSlice(slice.slice); | 287 thread.addNonNestedSlice(slice.slice); |
| 288 delete state.openNonNestedSlices[name]; | 288 delete state.openNonNestedSlices[name]; |
| 289 } else { | 289 } else { |
| 290 if (state.openSlices.length == 0) { | 290 if (state.openSlices.length == 0) { |
| 291 // Ignore E events that are unmatched. | 291 // Ignore E events that are unmatched. |
| 292 return; | 292 return; |
| 293 } | 293 } |
| 294 var slice = state.openSlices.pop().slice; | 294 var slice = state.openSlices.pop().slice; |
| 295 slice.duration = event.ts - slice.start; | 295 slice.duration = event.ts - slice.start; |
| 296 if (event.uts) | 296 if (event.uts) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 } else if (event.ph == 'M') { | 331 } else if (event.ph == 'M') { |
| 332 if (event.name == 'thread_name') { | 332 if (event.name == 'thread_name') { |
| 333 var thread = this.getOrCreateProcess(event.pid) | 333 var thread = this.getOrCreateProcess(event.pid) |
| 334 .getOrCreateThread(event.tid); | 334 .getOrCreateThread(event.tid); |
| 335 thread.name = event.args.name; | 335 thread.name = event.args.name; |
| 336 } else { | 336 } else { |
| 337 this.importErrors.push('Unrecognized metadata name: ' + event.name); | 337 this.importErrors.push('Unrecognized metadata name: ' + event.name); |
| 338 } | 338 } |
| 339 } else { | 339 } else { |
| 340 this.importErrors.push('Unrecognized event phase: ' + event.ph + | 340 this.importErrors.push('Unrecognized event phase: ' + event.ph + |
| 341 '(' + event.name + ')'); | 341 '(' + event.name + ')'); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 this.pruneEmptyThreads(); | 344 this.pruneEmptyThreads(); |
| 345 this.updateBounds(); | 345 this.updateBounds(); |
| 346 | 346 |
| 347 // Add end events for any events that are still on the stack. These | 347 // Add end events for any events that are still on the stack. These |
| 348 // are events that were still open when trace was ended, and can often | 348 // are events that were still open when trace was ended, and can often |
| 349 // indicate deadlock behavior. | 349 // indicate deadlock behavior. |
| 350 for (var ptid in threadStateByPTID) { | 350 for (var ptid in threadStateByPTID) { |
| 351 var state = threadStateByPTID[ptid]; | 351 var state = threadStateByPTID[ptid]; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 }; | 450 }; |
| 451 | 451 |
| 452 return { | 452 return { |
| 453 getStringHash: getStringHash, | 453 getStringHash: getStringHash, |
| 454 TimelineSlice: TimelineSlice, | 454 TimelineSlice: TimelineSlice, |
| 455 TimelineThread: TimelineThread, | 455 TimelineThread: TimelineThread, |
| 456 TimelineProcess: TimelineProcess, | 456 TimelineProcess: TimelineProcess, |
| 457 TimelineModel: TimelineModel | 457 TimelineModel: TimelineModel |
| 458 }; | 458 }; |
| 459 }); | 459 }); |
| OLD | NEW |