OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 8 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
9 <link rel="import" href="/tracing/model/cpu.html"> | 9 <link rel="import" href="/tracing/model/cpu.html"> |
10 <link rel="import" href="/tracing/model/process_base.html"> | 10 <link rel="import" href="/tracing/model/process_base.html"> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 get stableId() { | 55 get stableId() { |
56 return 'Kernel'; | 56 return 'Kernel'; |
57 }, | 57 }, |
58 | 58 |
59 /** | 59 /** |
60 * @return {Cpu} Gets a specific Cpu or creates one if | 60 * @return {Cpu} Gets a specific Cpu or creates one if |
61 * it does not exist. | 61 * it does not exist. |
62 */ | 62 */ |
63 getOrCreateCpu: function(cpuNumber) { | 63 getOrCreateCpu: function(cpuNumber) { |
64 if (!this.cpus[cpuNumber]) | 64 if (!this.cpus[cpuNumber]) { |
65 this.cpus[cpuNumber] = new Cpu(this, cpuNumber); | 65 this.cpus[cpuNumber] = new Cpu(this, cpuNumber); |
| 66 } |
66 return this.cpus[cpuNumber]; | 67 return this.cpus[cpuNumber]; |
67 }, | 68 }, |
68 | 69 |
69 get softwareMeasuredCpuCount() { | 70 get softwareMeasuredCpuCount() { |
70 return this.softwareMeasuredCpuCount_; | 71 return this.softwareMeasuredCpuCount_; |
71 }, | 72 }, |
72 | 73 |
73 set softwareMeasuredCpuCount(softwareMeasuredCpuCount) { | 74 set softwareMeasuredCpuCount(softwareMeasuredCpuCount) { |
74 if (this.softwareMeasuredCpuCount_ !== undefined && | 75 if (this.softwareMeasuredCpuCount_ !== undefined && |
75 this.softwareMeasuredCpuCount_ !== softwareMeasuredCpuCount) { | 76 this.softwareMeasuredCpuCount_ !== softwareMeasuredCpuCount) { |
76 throw new Error( | 77 throw new Error( |
77 'Cannot change the softwareMeasuredCpuCount once it is set'); | 78 'Cannot change the softwareMeasuredCpuCount once it is set'); |
78 } | 79 } |
79 | 80 |
80 this.softwareMeasuredCpuCount_ = softwareMeasuredCpuCount; | 81 this.softwareMeasuredCpuCount_ = softwareMeasuredCpuCount; |
81 }, | 82 }, |
82 | 83 |
83 /** | 84 /** |
84 * Estimates how many cpus are in the system, for use in system load | 85 * Estimates how many cpus are in the system, for use in system load |
85 * estimation. | 86 * estimation. |
86 * | 87 * |
87 * If kernel trace was provided, uses that data. Otherwise, uses the | 88 * If kernel trace was provided, uses that data. Otherwise, uses the |
88 * software measured cpu count. | 89 * software measured cpu count. |
89 */ | 90 */ |
90 get bestGuessAtCpuCount() { | 91 get bestGuessAtCpuCount() { |
91 var realCpuCount = tr.b.dictionaryLength(this.cpus); | 92 var realCpuCount = tr.b.dictionaryLength(this.cpus); |
92 if (realCpuCount !== 0) | 93 if (realCpuCount !== 0) { |
93 return realCpuCount; | 94 return realCpuCount; |
| 95 } |
94 return this.softwareMeasuredCpuCount; | 96 return this.softwareMeasuredCpuCount; |
95 }, | 97 }, |
96 | 98 |
97 updateBounds: function() { | 99 updateBounds: function() { |
98 ProcessBase.prototype.updateBounds.call(this); | 100 ProcessBase.prototype.updateBounds.call(this); |
99 for (var cpuNumber in this.cpus) { | 101 for (var cpuNumber in this.cpus) { |
100 var cpu = this.cpus[cpuNumber]; | 102 var cpu = this.cpus[cpuNumber]; |
101 cpu.updateBounds(); | 103 cpu.updateBounds(); |
102 this.bounds.addRange(cpu.bounds); | 104 this.bounds.addRange(cpu.bounds); |
103 } | 105 } |
104 }, | 106 }, |
105 | 107 |
106 createSubSlices: function() { | 108 createSubSlices: function() { |
107 ProcessBase.prototype.createSubSlices.call(this); | 109 ProcessBase.prototype.createSubSlices.call(this); |
108 for (var cpuNumber in this.cpus) { | 110 for (var cpuNumber in this.cpus) { |
109 var cpu = this.cpus[cpuNumber]; | 111 var cpu = this.cpus[cpuNumber]; |
110 cpu.createSubSlices(); | 112 cpu.createSubSlices(); |
111 } | 113 } |
112 }, | 114 }, |
113 | 115 |
114 addCategoriesToDict: function(categoriesDict) { | 116 addCategoriesToDict: function(categoriesDict) { |
115 ProcessBase.prototype.addCategoriesToDict.call(this, categoriesDict); | 117 ProcessBase.prototype.addCategoriesToDict.call(this, categoriesDict); |
116 for (var cpuNumber in this.cpus) | 118 for (var cpuNumber in this.cpus) { |
117 this.cpus[cpuNumber].addCategoriesToDict(categoriesDict); | 119 this.cpus[cpuNumber].addCategoriesToDict(categoriesDict); |
| 120 } |
118 }, | 121 }, |
119 | 122 |
120 getSettingsKey: function() { | 123 getSettingsKey: function() { |
121 return 'kernel'; | 124 return 'kernel'; |
122 }, | 125 }, |
123 | 126 |
124 childEventContainers: function* () { | 127 childEventContainers: function* () { |
125 yield* ProcessBase.prototype.childEventContainers.call(this); | 128 yield* ProcessBase.prototype.childEventContainers.call(this); |
126 yield* tr.b.dictionaryValues(this.cpus); | 129 yield* tr.b.dictionaryValues(this.cpus); |
127 }, | 130 }, |
128 }; | 131 }; |
129 | 132 |
130 return { | 133 return { |
131 Kernel, | 134 Kernel, |
132 }; | 135 }; |
133 }); | 136 }); |
134 </script> | 137 </script> |
OLD | NEW |