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 | 7 |
8 <link rel="import" href="/perf_insights/mappers/thread_grouping.html"> | 8 <link rel="import" href="/perf_insights/mappers/thread_grouping.html"> |
9 <link rel="import" href="/perf_insights/mre/function_handle.html"> | 9 <link rel="import" href="/perf_insights/mre/function_handle.html"> |
10 <link rel="import" href="/tracing/model/flow_event.html"> | 10 <link rel="import" href="/tracing/model/flow_event.html"> |
11 <link rel="import" href="/tracing/model/slice.html"> | 11 <link rel="import" href="/tracing/model/slice.html"> |
12 <link rel="import" href="/tracing/value/histogram.html"> | 12 <link rel="import" href="/tracing/value/histogram.html"> |
13 <link rel="import" href="/tracing/value/unit.html"> | 13 <link rel="import" href="/tracing/value/unit.html"> |
14 | 14 |
15 <script> | 15 <script> |
16 'use strict'; | 16 'use strict'; |
17 | 17 |
18 tr.exportTo('pi.m', function() { | 18 tr.exportTo('pi.m', function() { |
19 var DURATION_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear( | 19 var DURATION_BOUNDARIES = tr.v.HistogramBinBoundaries.createLinear( |
20 tr.v.Unit.byName.timeDurationInMs, | 20 0, 250, 50); |
21 tr.b.Range.fromExplicitRange(0, 250), 50); | |
22 | 21 |
23 function taskInfoMapFunction(result, model) { | 22 function taskInfoMapFunction(result, model) { |
24 var canonicalUrl = model.canonicalUrl; | 23 var canonicalUrl = model.canonicalUrl; |
25 var threadGrouping = new pi.m.ThreadGrouping(); | 24 var threadGrouping = new pi.m.ThreadGrouping(); |
26 threadGrouping.autoInitUsingHelpers(model); | 25 threadGrouping.autoInitUsingHelpers(model); |
27 addTimeInQueue(result, canonicalUrl, model, threadGrouping); | 26 addTimeInQueue(result, canonicalUrl, model, threadGrouping); |
28 addTopLevelTasksDuration(result, canonicalUrl, model, threadGrouping); | 27 addTopLevelTasksDuration(result, canonicalUrl, model, threadGrouping); |
29 } | 28 } |
30 | 29 |
31 function eatTrailingDigits(str) { | 30 function eatTrailingDigits(str) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // slice above it is. | 90 // slice above it is. |
92 function isTopLevelTask(slice) { | 91 function isTopLevelTask(slice) { |
93 if (!slice.inFlowEvents.length) | 92 if (!slice.inFlowEvents.length) |
94 return false; | 93 return false; |
95 return !slice.parentSlice || !isTopLevelTask(slice.parentSlice); | 94 return !slice.parentSlice || !isTopLevelTask(slice.parentSlice); |
96 } | 95 } |
97 | 96 |
98 function addToHistogram(dict, processName, threadName, value, url) { | 97 function addToHistogram(dict, processName, threadName, value, url) { |
99 dict[processName] = dict[processName] || {}; | 98 dict[processName] = dict[processName] || {}; |
100 dict[processName][threadName] = dict[processName][threadName] || | 99 dict[processName][threadName] = dict[processName][threadName] || |
101 DURATION_NUMERIC_BUILDER.build(); | 100 new tr.v.Histogram(tr.v.Unit.byName.timeDurationInMs, |
| 101 DURATION_BOUNDARIES); |
102 dict[processName][threadName].add(value, url); | 102 dict[processName][threadName].add(value, url); |
103 } | 103 } |
104 | 104 |
105 pi.FunctionRegistry.register(taskInfoMapFunction); | 105 pi.FunctionRegistry.register(taskInfoMapFunction); |
106 | 106 |
107 // Exporting for tests. | 107 // Exporting for tests. |
108 return { | 108 return { |
109 taskInfoMapFunctionForTest: taskInfoMapFunction | 109 taskInfoMapFunctionForTest: taskInfoMapFunction |
110 }; | 110 }; |
111 }); | 111 }); |
112 </script> | 112 </script> |
OLD | NEW |