| 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/base.html"> | 8 <link rel="import" href="/tracing/base/base.html"> |
| 9 <link rel="import" href="/tracing/base/iteration_helpers.html"> | 9 <link rel="import" href="/tracing/base/iteration_helpers.html"> |
| 10 <link rel="import" href="/tracing/base/statistics.html"> | 10 <link rel="import" href="/tracing/base/math/statistics.html"> |
| 11 | 11 |
| 12 <script> | 12 <script> |
| 13 'use strict'; | 13 'use strict'; |
| 14 tr.exportTo('tr.ui.analysis', function() { | 14 tr.exportTo('tr.ui.analysis', function() { |
| 15 function MultiEventSummary(title, events) { | 15 function MultiEventSummary(title, events) { |
| 16 this.title = title; | 16 this.title = title; |
| 17 this.duration_ = undefined; | 17 this.duration_ = undefined; |
| 18 this.selfTime_ = undefined; | 18 this.selfTime_ = undefined; |
| 19 this.events_ = events; | 19 this.events_ = events; |
| 20 | 20 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 this.totalsRow = true; | 37 this.totalsRow = true; |
| 38 this.title_ = title; | 38 this.title_ = title; |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 get title() { | 41 get title() { |
| 42 return this.title_; | 42 return this.title_; |
| 43 }, | 43 }, |
| 44 | 44 |
| 45 get duration() { | 45 get duration() { |
| 46 if (this.duration_ === undefined) { | 46 if (this.duration_ === undefined) { |
| 47 this.duration_ = tr.b.Statistics.sum( | 47 this.duration_ = tr.b.math.Statistics.sum( |
| 48 this.events_, function(event) { | 48 this.events_, function(event) { |
| 49 return event.duration; | 49 return event.duration; |
| 50 }); | 50 }); |
| 51 } | 51 } |
| 52 return this.duration_; | 52 return this.duration_; |
| 53 }, | 53 }, |
| 54 | 54 |
| 55 get cpuSelfTime() { | 55 get cpuSelfTime() { |
| 56 this.computeCpuTimesIfNeeded_(); | 56 this.computeCpuTimesIfNeeded_(); |
| 57 return this.cpuSelfTime_; | 57 return this.cpuSelfTime_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 get events() { | 100 get events() { |
| 101 return this.events_; | 101 return this.events_; |
| 102 }, | 102 }, |
| 103 | 103 |
| 104 get numEvents() { | 104 get numEvents() { |
| 105 return this.events_.length; | 105 return this.events_.length; |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 get numAlerts() { | 108 get numAlerts() { |
| 109 if (this.numAlerts_ === undefined) { | 109 if (this.numAlerts_ === undefined) { |
| 110 this.numAlerts_ = tr.b.Statistics.sum(this.events_, function(event) { | 110 this.numAlerts_ = tr.b.math.Statistics.sum(this.events_, event => |
| 111 return event.associatedAlerts.length; | 111 event.associatedAlerts.length |
| 112 }); | 112 ); |
| 113 } | 113 } |
| 114 return this.numAlerts_; | 114 return this.numAlerts_; |
| 115 }, | 115 }, |
| 116 | 116 |
| 117 get untotallableArgs() { | 117 get untotallableArgs() { |
| 118 this.updateArgsIfNeeded_(); | 118 this.updateArgsIfNeeded_(); |
| 119 return this.untotallableArgs_; | 119 return this.untotallableArgs_; |
| 120 }, | 120 }, |
| 121 | 121 |
| 122 get totalledArgs() { | 122 get totalledArgs() { |
| 123 this.updateArgsIfNeeded_(); | 123 this.updateArgsIfNeeded_(); |
| 124 return this.totalledArgs_; | 124 return this.totalledArgs_; |
| 125 }, | 125 }, |
| 126 | 126 |
| 127 | 127 |
| 128 get maxDuration() { | 128 get maxDuration() { |
| 129 if (this.maxDuration_ === undefined) { | 129 if (this.maxDuration_ === undefined) { |
| 130 this.maxDuration_ = tr.b.Statistics.max( | 130 this.maxDuration_ = tr.b.math.Statistics.max( |
| 131 this.events_, function(event) { | 131 this.events_, function(event) { |
| 132 return event.duration; | 132 return event.duration; |
| 133 }); | 133 }); |
| 134 } | 134 } |
| 135 return this.maxDuration_; | 135 return this.maxDuration_; |
| 136 }, | 136 }, |
| 137 | 137 |
| 138 | 138 |
| 139 get maxCpuDuration() { | 139 get maxCpuDuration() { |
| 140 if (this.maxCpuDuration_ === undefined) { | 140 if (this.maxCpuDuration_ === undefined) { |
| 141 this.maxCpuDuration_ = tr.b.Statistics.max( | 141 this.maxCpuDuration_ = tr.b.math.Statistics.max( |
| 142 this.events_, function(event) { | 142 this.events_, function(event) { |
| 143 return event.cpuDuration; | 143 return event.cpuDuration; |
| 144 }); | 144 }); |
| 145 } | 145 } |
| 146 return this.maxCpuDuration_; | 146 return this.maxCpuDuration_; |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 | 149 |
| 150 get maxSelfTime() { | 150 get maxSelfTime() { |
| 151 if (this.maxSelfTime_ === undefined) { | 151 if (this.maxSelfTime_ === undefined) { |
| 152 this.maxSelfTime_ = tr.b.Statistics.max( | 152 this.maxSelfTime_ = tr.b.math.Statistics.max( |
| 153 this.events_, function(event) { | 153 this.events_, function(event) { |
| 154 return event.selfTime; | 154 return event.selfTime; |
| 155 }); | 155 }); |
| 156 } | 156 } |
| 157 return this.maxSelfTime_; | 157 return this.maxSelfTime_; |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 | 160 |
| 161 get maxCpuSelfTime() { | 161 get maxCpuSelfTime() { |
| 162 if (this.maxCpuSelfTime_ === undefined) { | 162 if (this.maxCpuSelfTime_ === undefined) { |
| 163 this.maxCpuSelfTime_ = tr.b.Statistics.max( | 163 this.maxCpuSelfTime_ = tr.b.math.Statistics.max( |
| 164 this.events_, function(event) { | 164 this.events_, function(event) { |
| 165 return event.cpuSelfTime; | 165 return event.cpuSelfTime; |
| 166 }); | 166 }); |
| 167 } | 167 } |
| 168 return this.maxCpuSelfTime_; | 168 return this.maxCpuSelfTime_; |
| 169 }, | 169 }, |
| 170 | 170 |
| 171 | 171 |
| 172 updateArgsIfNeeded_: function() { | 172 updateArgsIfNeeded_: function() { |
| 173 if (this.totalledArgs_ !== undefined) | 173 if (this.totalledArgs_ !== undefined) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 196 this.untotallableArgs_ = Object.keys(untotallableArgs); | 196 this.untotallableArgs_ = Object.keys(untotallableArgs); |
| 197 this.totalledArgs_ = totalledArgs; | 197 this.totalledArgs_ = totalledArgs; |
| 198 } | 198 } |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 return { | 201 return { |
| 202 MultiEventSummary, | 202 MultiEventSummary, |
| 203 }; | 203 }; |
| 204 }); | 204 }); |
| 205 </script> | 205 </script> |
| OLD | NEW |