| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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 <link rel="import" href="/perf_insights/mappers/reduce.html"> | 7 <link rel="import" href="/perf_insights/mappers/reduce.html"> |
| 8 <link rel="import" href="/tracing/extras/ads/domain_category.html"> | 8 <link rel="import" href="/tracing/extras/ads/domain_category.html"> |
| 9 <link rel="import" href="/tracing/extras/chrome/slice_title_fixer.html"> | 9 <link rel="import" href="/tracing/extras/chrome/slice_title_fixer.html"> |
| 10 <link rel="import" href="/tracing/model/source_info/js_source_info.html"> | 10 <link rel="import" href="/tracing/model/source_info/js_source_info.html"> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 sliceCostInfo.jsTimeByState[sourceInfo.state] = sample.weight; | 130 sliceCostInfo.jsTimeByState[sourceInfo.state] = sample.weight; |
| 131 } | 131 } |
| 132 var key = sliceCostInfo.threadGroup + '/' + | 132 var key = sliceCostInfo.threadGroup + '/' + |
| 133 sliceCostInfo.railTypeName + '/' + | 133 sliceCostInfo.railTypeName + '/' + |
| 134 sliceCostInfo.title + '/' + | 134 sliceCostInfo.title + '/' + |
| 135 sliceCostInfo.domain; | 135 sliceCostInfo.domain; |
| 136 reduce.push(key, sliceCostInfo); | 136 reduce.push(key, sliceCostInfo); |
| 137 }); | 137 }); |
| 138 } | 138 } |
| 139 | 139 |
| 140 model.iterateAllEvents(function(event) { | 140 for (var event of model.descendentEvents()) { |
| 141 if (!(event instanceof tr.model.ThreadSlice)) | 141 if (!(event instanceof tr.model.ThreadSlice)) |
| 142 return; | 142 continue; |
| 143 if (filterFunction && !filterFunction(event)) | 143 if (filterFunction && !filterFunction(event)) |
| 144 return; | 144 continue; |
| 145 | 145 |
| 146 var threadSlice = event; | 146 var threadSlice = event; |
| 147 if (threadSlice.title === 'V8.Execute') { | 147 if (threadSlice.title === 'V8.Execute') { |
| 148 generateDomainCosts(threadSlice); | 148 generateDomainCosts(threadSlice); |
| 149 return; | 149 continue; |
| 150 } | 150 } |
| 151 | 151 |
| 152 var sliceCostInfo = new SliceCostInfo(); | 152 var sliceCostInfo = new SliceCostInfo(); |
| 153 sliceCostInfo.threadGroup = threadGrouping.getGroupNameForEvent( | 153 sliceCostInfo.threadGroup = threadGrouping.getGroupNameForEvent( |
| 154 threadSlice); | 154 threadSlice); |
| 155 sliceCostInfo.railTypeName = railTypeNameByGUID[threadSlice.guid]; | 155 sliceCostInfo.railTypeName = railTypeNameByGUID[threadSlice.guid]; |
| 156 var ufc = model.getUserFriendlyCategoryFromEvent(threadSlice); | 156 var ufc = model.getUserFriendlyCategoryFromEvent(threadSlice); |
| 157 sliceCostInfo.userFriendlyCategory = ufc || 'other'; | 157 sliceCostInfo.userFriendlyCategory = ufc || 'other'; |
| 158 sliceCostInfo.title = tr.e.chrome.SliceTitleFixer.fromEvent(threadSlice); | 158 sliceCostInfo.title = tr.e.chrome.SliceTitleFixer.fromEvent(threadSlice); |
| 159 // For all other events, just generate one sliceCostInfo. | 159 // For all other events, just generate one sliceCostInfo. |
| 160 sliceCostInfo.selfTime = threadSlice.selfTime; | 160 sliceCostInfo.selfTime = threadSlice.selfTime; |
| 161 sliceCostInfo.cpuSelfTime = threadSlice.cpuSelfTime; | 161 sliceCostInfo.cpuSelfTime = threadSlice.cpuSelfTime; |
| 162 if (dataCB !== undefined) | 162 if (dataCB !== undefined) |
| 163 sliceCostInfo.data = dataCB(event); | 163 sliceCostInfo.data = dataCB(event); |
| 164 | 164 |
| 165 var key = sliceCostInfo.threadGroup + '/' + | 165 var key = sliceCostInfo.threadGroup + '/' + |
| 166 sliceCostInfo.railTypeName + '/' + | 166 sliceCostInfo.railTypeName + '/' + |
| 167 sliceCostInfo.title; | 167 sliceCostInfo.title; |
| 168 reduce.push(key, sliceCostInfo); | 168 reduce.push(key, sliceCostInfo); |
| 169 }); | 169 } |
| 170 | 170 |
| 171 var sliceCostInfos = []; | 171 var sliceCostInfos = []; |
| 172 reduce.finalizeAndIterResults(function(key, sliceCostInfo) { | 172 reduce.finalizeAndIterResults(function(key, sliceCostInfo) { |
| 173 sliceCostInfos.push(sliceCostInfo); | 173 sliceCostInfos.push(sliceCostInfo); |
| 174 }); | 174 }); |
| 175 return sliceCostInfos; | 175 return sliceCostInfos; |
| 176 } | 176 } |
| 177 | 177 |
| 178 return { | 178 return { |
| 179 SliceCostInfo: SliceCostInfo, | 179 SliceCostInfo: SliceCostInfo, |
| 180 | 180 |
| 181 getSliceCostReport: getSliceCostReport | 181 getSliceCostReport: getSliceCostReport |
| 182 }; | 182 }; |
| 183 }); | 183 }); |
| 184 </script> | 184 </script> |
| OLD | NEW |