| 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/range.html"> | 10 <link rel="import" href="/tracing/base/math/range.html"> |
| 11 <link rel="import" href="/tracing/base/statistics.html"> | 11 <link rel="import" href="/tracing/base/math/statistics.html"> |
| 12 <link rel="import" href="/tracing/base/unit.html"> | 12 <link rel="import" href="/tracing/base/unit.html"> |
| 13 <link rel="import" href="/tracing/model/event_set.html"> | 13 <link rel="import" href="/tracing/model/event_set.html"> |
| 14 <link rel="import" href="/tracing/ui/analysis/analysis_link.html"> | 14 <link rel="import" href="/tracing/ui/analysis/analysis_link.html"> |
| 15 <link rel="import" href="/tracing/ui/analysis/multi_event_summary.html"> | 15 <link rel="import" href="/tracing/ui/analysis/multi_event_summary.html"> |
| 16 <link rel="import" href="/tracing/ui/base/table.html"> | 16 <link rel="import" href="/tracing/ui/base/table.html"> |
| 17 <link rel="import" href="/tracing/value/ui/scalar_span.html"> | 17 <link rel="import" href="/tracing/value/ui/scalar_span.html"> |
| 18 | 18 |
| 19 <dom-module id='tr-ui-a-multi-event-summary-table'> | 19 <dom-module id='tr-ui-a-multi-event-summary-table'> |
| 20 <template> | 20 <template> |
| 21 <style> | 21 <style> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return rowA.title.localeCompare(rowB.title); | 79 return rowA.title.localeCompare(rowB.title); |
| 80 } | 80 } |
| 81 }); | 81 }); |
| 82 if (this.eventsHaveDuration_) { | 82 if (this.eventsHaveDuration_) { |
| 83 columns.push({ | 83 columns.push({ |
| 84 title: 'Wall Duration', | 84 title: 'Wall Duration', |
| 85 value: function(row) { | 85 value: function(row) { |
| 86 return tr.v.ui.createScalarSpan(row.duration, { | 86 return tr.v.ui.createScalarSpan(row.duration, { |
| 87 unit: tr.b.Unit.byName.timeDurationInMs, | 87 unit: tr.b.Unit.byName.timeDurationInMs, |
| 88 customContextRange: row.totalsRow ? undefined : | 88 customContextRange: row.totalsRow ? undefined : |
| 89 tr.b.Range.fromExplicitRange(0, maxValues.duration), | 89 tr.b.math.Range.fromExplicitRange(0, maxValues.duration), |
| 90 ownerDocument: ownerDocument, | 90 ownerDocument: ownerDocument, |
| 91 }); | 91 }); |
| 92 }, | 92 }, |
| 93 width: '<upated further down>', | 93 width: '<upated further down>', |
| 94 cmp: function(rowA, rowB) { | 94 cmp: function(rowA, rowB) { |
| 95 return rowA.duration - rowB.duration; | 95 return rowA.duration - rowB.duration; |
| 96 } | 96 } |
| 97 }); | 97 }); |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (this.eventsHaveDuration_ && hasCpuData) { | 100 if (this.eventsHaveDuration_ && hasCpuData) { |
| 101 columns.push({ | 101 columns.push({ |
| 102 title: 'CPU Duration', | 102 title: 'CPU Duration', |
| 103 value: function(row) { | 103 value: function(row) { |
| 104 return tr.v.ui.createScalarSpan(row.cpuDuration, { | 104 return tr.v.ui.createScalarSpan(row.cpuDuration, { |
| 105 unit: tr.b.Unit.byName.timeDurationInMs, | 105 unit: tr.b.Unit.byName.timeDurationInMs, |
| 106 customContextRange: row.totalsRow ? undefined : | 106 customContextRange: row.totalsRow ? undefined : |
| 107 tr.b.Range.fromExplicitRange(0, maxValues.cpuDuration), | 107 tr.b.math.Range.fromExplicitRange(0, maxValues.cpuDuration), |
| 108 ownerDocument: ownerDocument, | 108 ownerDocument: ownerDocument, |
| 109 }); | 109 }); |
| 110 }, | 110 }, |
| 111 width: '<upated further down>', | 111 width: '<upated further down>', |
| 112 cmp: function(rowA, rowB) { | 112 cmp: function(rowA, rowB) { |
| 113 return rowA.cpuDuration - rowB.cpuDuration; | 113 return rowA.cpuDuration - rowB.cpuDuration; |
| 114 } | 114 } |
| 115 }); | 115 }); |
| 116 } | 116 } |
| 117 | 117 |
| 118 if (this.eventsHaveSubRows_ && this.eventsHaveDuration_) { | 118 if (this.eventsHaveSubRows_ && this.eventsHaveDuration_) { |
| 119 columns.push({ | 119 columns.push({ |
| 120 title: 'Self time', | 120 title: 'Self time', |
| 121 value: function(row) { | 121 value: function(row) { |
| 122 return tr.v.ui.createScalarSpan(row.selfTime, { | 122 return tr.v.ui.createScalarSpan(row.selfTime, { |
| 123 unit: tr.b.Unit.byName.timeDurationInMs, | 123 unit: tr.b.Unit.byName.timeDurationInMs, |
| 124 customContextRange: row.totalsRow ? undefined : | 124 customContextRange: row.totalsRow ? undefined : |
| 125 tr.b.Range.fromExplicitRange(0, maxValues.selfTime), | 125 tr.b.math.Range.fromExplicitRange(0, maxValues.selfTime), |
| 126 ownerDocument: ownerDocument, | 126 ownerDocument: ownerDocument, |
| 127 }); | 127 }); |
| 128 }, | 128 }, |
| 129 width: '<upated further down>', | 129 width: '<upated further down>', |
| 130 cmp: function(rowA, rowB) { | 130 cmp: function(rowA, rowB) { |
| 131 return rowA.selfTime - rowB.selfTime; | 131 return rowA.selfTime - rowB.selfTime; |
| 132 } | 132 } |
| 133 }); | 133 }); |
| 134 } | 134 } |
| 135 | 135 |
| 136 if (this.eventsHaveSubRows_ && this.eventsHaveDuration_ && hasCpuData) { | 136 if (this.eventsHaveSubRows_ && this.eventsHaveDuration_ && hasCpuData) { |
| 137 columns.push({ | 137 columns.push({ |
| 138 title: 'CPU Self Time', | 138 title: 'CPU Self Time', |
| 139 value: function(row) { | 139 value: function(row) { |
| 140 return tr.v.ui.createScalarSpan(row.cpuSelfTime, { | 140 return tr.v.ui.createScalarSpan(row.cpuSelfTime, { |
| 141 unit: tr.b.Unit.byName.timeDurationInMs, | 141 unit: tr.b.Unit.byName.timeDurationInMs, |
| 142 customContextRange: row.totalsRow ? undefined : | 142 customContextRange: row.totalsRow ? undefined : |
| 143 tr.b.Range.fromExplicitRange(0, maxValues.cpuSelfTime), | 143 tr.b.math.Range.fromExplicitRange(0, maxValues.cpuSelfTime), |
| 144 ownerDocument: ownerDocument, | 144 ownerDocument: ownerDocument, |
| 145 }); | 145 }); |
| 146 }, | 146 }, |
| 147 width: '<upated further down>', | 147 width: '<upated further down>', |
| 148 cmp: function(rowA, rowB) { | 148 cmp: function(rowA, rowB) { |
| 149 return rowA.cpuSelfTime - rowB.cpuSelfTime; | 149 return rowA.cpuSelfTime - rowB.cpuSelfTime; |
| 150 } | 150 } |
| 151 }); | 151 }); |
| 152 } | 152 } |
| 153 | 153 |
| 154 if (this.eventsHaveDuration_) { | 154 if (this.eventsHaveDuration_) { |
| 155 columns.push({ | 155 columns.push({ |
| 156 title: 'Average ' + (hasCpuData ? 'CPU' : 'Wall') + ' Duration', | 156 title: 'Average ' + (hasCpuData ? 'CPU' : 'Wall') + ' Duration', |
| 157 value: function(row) { | 157 value: function(row) { |
| 158 var totalDuration = hasCpuData ? row.cpuDuration : row.duration; | 158 var totalDuration = hasCpuData ? row.cpuDuration : row.duration; |
| 159 return tr.v.ui.createScalarSpan(totalDuration / row.numEvents, { | 159 return tr.v.ui.createScalarSpan(totalDuration / row.numEvents, { |
| 160 unit: tr.b.Unit.byName.timeDurationInMs, | 160 unit: tr.b.Unit.byName.timeDurationInMs, |
| 161 customContextRange: row.totalsRow ? undefined : | 161 customContextRange: row.totalsRow ? undefined : |
| 162 tr.b.Range.fromExplicitRange(0, maxValues.duration), | 162 tr.b.math.Range.fromExplicitRange(0, maxValues.duration), |
| 163 ownerDocument: ownerDocument, | 163 ownerDocument: ownerDocument, |
| 164 }); | 164 }); |
| 165 }, | 165 }, |
| 166 width: '<upated further down>', | 166 width: '<upated further down>', |
| 167 cmp: function(rowA, rowB) { | 167 cmp: function(rowA, rowB) { |
| 168 if (hasCpuData) { | 168 if (hasCpuData) { |
| 169 return rowA.cpuDuration / rowA.numEvents - | 169 return rowA.cpuDuration / rowA.numEvents - |
| 170 rowB.cpuDuration / rowB.numEvents; | 170 rowB.cpuDuration / rowB.numEvents; |
| 171 } | 171 } |
| 172 return rowA.duration / rowA.numEvents - | 172 return rowA.duration / rowA.numEvents - |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 var maxValues = { | 307 var maxValues = { |
| 308 duration: undefined, | 308 duration: undefined, |
| 309 selfTime: undefined, | 309 selfTime: undefined, |
| 310 cpuSelfTime: undefined, | 310 cpuSelfTime: undefined, |
| 311 cpuDuration: undefined | 311 cpuDuration: undefined |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 if (this.eventsHaveDuration) { | 314 if (this.eventsHaveDuration) { |
| 315 for (var column in maxValues) { | 315 for (var column in maxValues) { |
| 316 maxValues[column] = tr.b.Statistics.max(rows, function(event) { | 316 maxValues[column] = tr.b.math.Statistics.max(rows, function(event) { |
| 317 return event[column]; | 317 return event[column]; |
| 318 }); | 318 }); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 var footerRows = []; | 322 var footerRows = []; |
| 323 | 323 |
| 324 if (this.showTotals_) { | 324 if (this.showTotals_) { |
| 325 var multiEventSummary = new tr.ui.analysis.MultiEventSummary( | 325 var multiEventSummary = new tr.ui.analysis.MultiEventSummary( |
| 326 'Totals', allEvents); | 326 'Totals', allEvents); |
| 327 footerRows.push(multiEventSummary); | 327 footerRows.push(multiEventSummary); |
| 328 } | 328 } |
| 329 | 329 |
| 330 | 330 |
| 331 this.updateTableColumns_(rows, maxValues); | 331 this.updateTableColumns_(rows, maxValues); |
| 332 this.$.table.tableRows = rows; | 332 this.$.table.tableRows = rows; |
| 333 | 333 |
| 334 // TODO(selection bounds). | 334 // TODO(selection bounds). |
| 335 | 335 |
| 336 // TODO(sorting) | 336 // TODO(sorting) |
| 337 | 337 |
| 338 this.$.table.footerRows = footerRows; | 338 this.$.table.footerRows = footerRows; |
| 339 this.$.table.rebuild(); | 339 this.$.table.rebuild(); |
| 340 } | 340 } |
| 341 }); | 341 }); |
| 342 </script> | 342 </script> |
| OLD | NEW |