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
3 // found in the LICENSE file.
8 * @fileoverview Provides the Process class.
10 tvcm.require('tracing.trace_model.cpu');
11 tvcm.require('tracing.trace_model.process_base');
13 tvcm.exportTo('tracing.trace_model', function() {
15 var Cpu = tracing.trace_model.Cpu;
16 var ProcessBase = tracing.trace_model.ProcessBase;
19 * The Kernel represents kernel-level objects in the
23 function Kernel(model) {
24 if (model === undefined)
25 throw new Error('model must be provided');
26 ProcessBase.call(this, model);
31 * Comparison between kernels is pretty meaningless.
33 Kernel.compare = function(x, y) {
38 __proto__: ProcessBase.prototype,
40 compareTo: function(that) {
41 return Kernel.compare(this, that);
44 get userFriendlyName() {
48 get userFriendlyDetails() {
53 * @return {Cpu} Gets a specific Cpu or creates one if
56 getOrCreateCpu: function(cpuNumber) {
57 if (!this.cpus[cpuNumber])
58 this.cpus[cpuNumber] = new Cpu(this, cpuNumber);
59 return this.cpus[cpuNumber];
62 shiftTimestampsForward: function(amount) {
63 ProcessBase.prototype.shiftTimestampsForward.call(this);
64 for (var cpuNumber in this.cpus)
65 this.cpus[cpuNumber].shiftTimestampsForward(amount);
68 updateBounds: function() {
69 ProcessBase.prototype.updateBounds.call(this);
70 for (var cpuNumber in this.cpus) {
71 var cpu = this.cpus[cpuNumber];
73 this.bounds.addRange(cpu.bounds);
77 createSubSlices: function() {
78 ProcessBase.prototype.createSubSlices.call(this);
79 for (var cpuNumber in this.cpus) {
80 var cpu = this.cpus[cpuNumber];
81 cpu.createSubSlices();
85 addCategoriesToDict: function(categoriesDict) {
86 ProcessBase.prototype.addCategoriesToDict.call(this, categoriesDict);
87 for (var cpuNumber in this.cpus)
88 this.cpus[cpuNumber].addCategoriesToDict(categoriesDict);
91 getSettingsKey: function() {
95 iterateAllEvents: function(callback, opt_this) {
96 for (var cpuNumber in this.cpus)
97 this.cpus[cpuNumber].iterateAllEvents(callback, opt_this);
99 ProcessBase.prototype.iterateAllEvents.call(this, callback, opt_this);