| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * @fileoverview Imports text files in the Linux event trace format into the | 6 * @fileoverview Imports text files in the Linux event trace format into the |
| 7 * timeline model. This format is output both by sched_trace and by Linux's perf | 7 * timeline model. This format is output both by sched_trace and by Linux's perf |
| 8 * tool. | 8 * tool. |
| 9 * | 9 * |
| 10 * This importer assumes the events arrive as a string. The unit tests provide | 10 * This importer assumes the events arrive as a string. The unit tests provide |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (!this.isAdditionalImport_) | 305 if (!this.isAdditionalImport_) |
| 306 return; | 306 return; |
| 307 | 307 |
| 308 // Remove the newly imported CPU slices from the model. | 308 // Remove the newly imported CPU slices from the model. |
| 309 this.abortImport(); | 309 this.abortImport(); |
| 310 return false; | 310 return false; |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Shift all the slice times based on the sync record. | 313 // Shift all the slice times based on the sync record. |
| 314 var sync = this.clockSyncRecords_[0]; | 314 var sync = this.clockSyncRecords_[0]; |
| 315 // NB: parentTS of zero denotes no times-shift; this is |
| 316 // used when user and kernel event clocks are identical. |
| 317 if (sync.parentTS == 0 || sync.parentTS == sync.perfTS) |
| 318 return true; |
| 315 var timeShift = sync.parentTS - sync.perfTS; | 319 var timeShift = sync.parentTS - sync.perfTS; |
| 316 for (var cpuNumber in this.cpuStates_) { | 320 for (var cpuNumber in this.cpuStates_) { |
| 317 var cpuState = this.cpuStates_[cpuNumber]; | 321 var cpuState = this.cpuStates_[cpuNumber]; |
| 318 var cpu = cpuState.cpu; | 322 var cpu = cpuState.cpu; |
| 319 | 323 |
| 320 for (var i = 0; i < cpu.slices.length; i++) { | 324 for (var i = 0; i < cpu.slices.length; i++) { |
| 321 var slice = cpu.slices[i]; | 325 var slice = cpu.slices[i]; |
| 322 slice.start = slice.start + timeShift; | 326 slice.start = slice.start + timeShift; |
| 323 slice.duration = slice.duration; | 327 slice.duration = slice.duration; |
| 324 } | 328 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 }; | 633 }; |
| 630 | 634 |
| 631 tracing.TimelineModel.registerImporter(LinuxPerfImporter); | 635 tracing.TimelineModel.registerImporter(LinuxPerfImporter); |
| 632 | 636 |
| 633 return { | 637 return { |
| 634 LinuxPerfImporter: LinuxPerfImporter, | 638 LinuxPerfImporter: LinuxPerfImporter, |
| 635 _LinuxPerfImporterTestExports: TestExports | 639 _LinuxPerfImporterTestExports: TestExports |
| 636 }; | 640 }; |
| 637 | 641 |
| 638 }); | 642 }); |
| OLD | NEW |