OLD | NEW |
1 // Copyright (c) 2011 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 |
11 * examples of the trace format. | 11 * examples of the trace format. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 * Imports the data in this.events_ into model_. | 185 * Imports the data in this.events_ into model_. |
186 */ | 186 */ |
187 importEvents: function() { | 187 importEvents: function() { |
188 this.importCpuData(); | 188 this.importCpuData(); |
189 if (!this.alignClocks()) | 189 if (!this.alignClocks()) |
190 return; | 190 return; |
191 this.buildPerThreadCpuSlicesFromCpuState(); | 191 this.buildPerThreadCpuSlicesFromCpuState(); |
192 }, | 192 }, |
193 | 193 |
194 /** | 194 /** |
| 195 * Called by the TimelineModel after all other importers have imported their |
| 196 * events. |
| 197 */ |
| 198 finalizeImport: function() { |
| 199 }, |
| 200 |
| 201 /** |
195 * Builds the cpuSlices array on each thread based on our knowledge of what | 202 * Builds the cpuSlices array on each thread based on our knowledge of what |
196 * each Cpu is doing. This is done only for TimelineThreads that are | 203 * each Cpu is doing. This is done only for TimelineThreads that are |
197 * already in the model, on the assumption that not having any traced data | 204 * already in the model, on the assumption that not having any traced data |
198 * on a thread means that it is not of interest to the user. | 205 * on a thread means that it is not of interest to the user. |
199 */ | 206 */ |
200 buildPerThreadCpuSlicesFromCpuState: function() { | 207 buildPerThreadCpuSlicesFromCpuState: function() { |
201 // Push the cpu slices to the threads that they run on. | 208 // Push the cpu slices to the threads that they run on. |
202 for (var cpuNumber in this.cpuStates_) { | 209 for (var cpuNumber in this.cpuStates_) { |
203 var cpuState = this.cpuStates_[cpuNumber]; | 210 var cpuState = this.cpuStates_[cpuNumber]; |
204 var cpu = cpuState.cpu; | 211 var cpu = cpuState.cpu; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 }; | 501 }; |
495 | 502 |
496 tracing.TimelineModel.registerImporter(LinuxPerfImporter); | 503 tracing.TimelineModel.registerImporter(LinuxPerfImporter); |
497 | 504 |
498 return { | 505 return { |
499 LinuxPerfImporter: LinuxPerfImporter, | 506 LinuxPerfImporter: LinuxPerfImporter, |
500 _LinuxPerfImporterTestExports: TestExports | 507 _LinuxPerfImporterTestExports: TestExports |
501 }; | 508 }; |
502 | 509 |
503 }); | 510 }); |
OLD | NEW |