Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: tracing/tracing/metrics/system_health/estimated_input_latency_metric.html

Issue 2698003004: Add a function that computes contribution of selected events to EQT. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tracing/tracing/metrics/system_health/estimated_input_latency_metric_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2017 The Chromium Authors. All rights reserved. 3 Copyright 2017 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/extras/chrome/estimated_input_latency.html"> 9 <link rel="import" href="/tracing/extras/chrome/estimated_input_latency.html">
10 <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html"> 10 <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 max: true, 56 max: true,
57 min: false, 57 min: false,
58 std: false, 58 std: false,
59 sum: false, 59 sum: false,
60 }); 60 });
61 histogram.description = description; 61 histogram.description = description;
62 return histogram; 62 return histogram;
63 } 63 }
64 64
65 /** 65 /**
66 * Adds the input latency estimated as the maximum expected queueing time 66 * Computes the maximum expected queueing time in the sliding time window
67 * in the sliding time window of size WINDOW_SIZE_MS. 67 * of size 500ms (WINDOW_SIZE_MS). The function produces two histogram values:
68 * The result histogram contains value per renderer. 68 * - total:500ms_window:renderer_eqt,
69 * - interactive:500ms_window:renderer_eqt.
70 * The former is the metric computed for the whole trace. The latter is
71 * the metric computed for the tme while the page is interactive.
72 * Each renderer process adds one sample to the histograms.
69 */ 73 */
70 function estimatedInputLatency(values, model) { 74 function expectedQueueingTimeMetric(values, model) {
71 let chromeHelper = model.getOrCreateHelper( 75 let chromeHelper = model.getOrCreateHelper(
72 tr.model.helpers.ChromeModelHelper); 76 tr.model.helpers.ChromeModelHelper);
73 let totalHistogram = createHistogramForEQT_( 77 let totalHistogram = createHistogramForEQT_(
74 `total:${WINDOW_SIZE_MS}ms_window:renderer_eqt`, 78 `total:${WINDOW_SIZE_MS}ms_window:renderer_eqt`,
75 `The maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window` + 79 `The maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window` +
76 ' for a given renderer'); 80 ' for a given renderer');
77 let interactiveHistogram = createHistogramForEQT_( 81 let interactiveHistogram = createHistogramForEQT_(
78 `interactive:${WINDOW_SIZE_MS}ms_window:renderer_eqt`, 82 `interactive:${WINDOW_SIZE_MS}ms_window:renderer_eqt`,
79 `The maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window` + 83 `The maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window` +
80 ' for a given renderer while the page is interactive'); 84 ' for a given renderer while the page is interactive');
(...skipping 21 matching lines...) Expand all
102 .findIntersection(rendererHelper.mainThread.bounds); 106 .findIntersection(rendererHelper.mainThread.bounds);
103 interactiveHistogram.addSample( 107 interactiveHistogram.addSample(
104 tr.e.chrome.maxExpectedQueueingTimeInSlidingWindow( 108 tr.e.chrome.maxExpectedQueueingTimeInSlidingWindow(
105 interactiveWindow.min, interactiveWindow.max, 109 interactiveWindow.min, interactiveWindow.max,
106 WINDOW_SIZE_MS, tasks)); 110 WINDOW_SIZE_MS, tasks));
107 } 111 }
108 values.addHistogram(totalHistogram); 112 values.addHistogram(totalHistogram);
109 values.addHistogram(interactiveHistogram); 113 values.addHistogram(interactiveHistogram);
110 } 114 }
111 115
112 tr.metrics.MetricRegistry.register(estimatedInputLatency); 116 /**
117 * Returns the total duration of topmost subslices of the given slice
118 * that satisfy the given predicate.
tdresser 2017/02/21 15:12:58 Based on https://github.com/catapult-project/catap
ulan 2017/02/21 16:29:49 Done.
119 */
120 function durationOfTopmostSubSlices(slice, predicate) {
121 let duration = 0;
122 for (let sub of slice.findTopmostSlicesRelativeToThisSlice(predicate)) {
123 duration += sub.duration;
124 }
125 return duration;
126 }
127
128 /**
129 * Computes the contribution of the selected events to the expected queueing
130 * time. We define the contribution as the maximum expected queueing time in
131 * the sliding time window of size 500ms (WINDOW_SIZE_MS) for the trace that
132 * is modified as follows:
133 * - from each top-level task remove all subevents except the selected events.
134 * - removing subevents shrinks a task by shifting its end time closer to
135 * the start time. The start time does not change.
136 *
137 * Similar to the expectedQueueingTime this function adds two histograms:
138 * total and interactive. For example:
139 * - total:500ms_window:renderer_eqt:v8,
140 * - interactive:500ms_window:renderer_eqt:v8.
141 * Each renderer process adds one sample to the histograms.
142 *
143 * @param eventPredicate the predicate for selecting events.
144 * @param eventName the name describing the selected events. This name will be
145 * added to metric names.
146 */
147 function contributionToExpectedQueueingTime(
148 eventPredicate, eventName, values, model) {
149 let chromeHelper = model.getOrCreateHelper(
150 tr.model.helpers.ChromeModelHelper);
151 let totalHistogram = createHistogramForEQT_(
152 `total:${WINDOW_SIZE_MS}ms_window:renderer_eqt:${eventName}`,
153 `Contribution to the expected queueing time by ${eventName}` +
154 ' for a given renderer. It is computed as the maximum EQT in' +
155 ` a ${WINDOW_SIZE_MS}ms sliding window after shrinking top-level` +
156 ` tasks to contain only ${eventName} subevents`);
157 let interactiveHistogram = createHistogramForEQT_(
158 `interactive:${WINDOW_SIZE_MS}ms_window:renderer_eqt:${eventName}`,
159 `Contribution to the expected queueing time by ${eventName}` +
160 ' for a given renderer while the page is interactive. It is computed' +
161 ` as the maximum EQT in a ${WINDOW_SIZE_MS}ms sliding window after` +
162 ` shrinking top-level tasks to contain only ${eventName} subevents`);
163 let rendererHelpers = tr.b.dictionaryValues(chromeHelper.rendererHelpers);
164 for (let rendererHelper of rendererHelpers) {
165 if (rendererHelper.isChromeTracingUI) continue;
166 let tasks = rendererHelper.mainThread.sliceGroup.topLevelSlices
167 .filter(slice => slice.duration > 0 && !containsForcedGC_(slice))
168 .map(slice => {
169 return {
170 start: slice.start,
171 end: slice.start +
172 durationOfTopmostSubSlices(slice, eventPredicate)
173 };
174 });
175 totalHistogram.addSample(
176 tr.e.chrome.maxExpectedQueueingTimeInSlidingWindow(
177 rendererHelper.mainThread.bounds.min,
178 rendererHelper.mainThread.bounds.max,
179 WINDOW_SIZE_MS, tasks));
180 let interactiveTimestamps =
181 tr.e.chrome.getInteractiveTimestamps(model).get(rendererHelper.pid);
182 if (interactiveTimestamps.length === 0) continue;
183 if (interactiveTimestamps.length > 1) {
184 // TODO(ulan): Support multiple interactive time windows when
185 // https://crbug.com/692112 is fixed.
186 continue;
187 }
188 let interactiveWindow =
189 tr.b.Range.fromExplicitRange(interactiveTimestamps[0], Infinity)
190 .findIntersection(rendererHelper.mainThread.bounds);
191 interactiveHistogram.addSample(
192 tr.e.chrome.maxExpectedQueueingTimeInSlidingWindow(
193 interactiveWindow.min, interactiveWindow.max,
194 WINDOW_SIZE_MS, tasks));
195 }
196 values.addHistogram(totalHistogram);
197 values.addHistogram(interactiveHistogram);
198 }
199
200 tr.metrics.MetricRegistry.register(expectedQueueingTimeMetric);
113 201
114 return { 202 return {
115 estimatedInputLatency, 203 expectedQueueingTimeMetric,
204 contributionToExpectedQueueingTime,
116 }; 205 };
117 }); 206 });
118 </script> 207 </script>
OLDNEW
« no previous file with comments | « no previous file | tracing/tracing/metrics/system_health/estimated_input_latency_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698