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

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

Issue 10137006: Allow linux trace events to not be time-shifted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/resources/tracing/linux_perf_importer_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/tracing/linux_perf_importer_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698