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

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

Issue 2696053002: Make estimatedInputLatency metric more friendly for traces without TTI. (Closed)
Patch Set: Fix typo 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
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/core/test_utils.html"> 8 <link rel="import" href="/tracing/core/test_utils.html">
9 <link rel="import" href="/tracing/metrics/system_health/estimated_input_latency_ metric.html"> 9 <link rel="import" href="/tracing/metrics/system_health/estimated_input_latency_ metric.html">
10 <link rel="import" href="/tracing/value/histogram_set.html"> 10 <link rel="import" href="/tracing/value/histogram_set.html">
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 })); 57 }));
58 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 58 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
59 cat: 'toplevel', 59 cat: 'toplevel',
60 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 60 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
61 start: 9000, 61 start: 9000,
62 duration: 10, 62 duration: 10,
63 })); 63 }));
64 }); 64 });
65 let values = new tr.v.HistogramSet(); 65 let values = new tr.v.HistogramSet();
66 tr.metrics.sh.estimatedInputLatency(values, model); 66 tr.metrics.sh.estimatedInputLatency(values, model);
67 let eqt = values.getHistogramNamed( 67 let interactiveEQT = values.getHistogramNamed(
68 'interactive:500ms_window:renderer_eqt'); 68 'interactive:500ms_window:renderer_eqt');
69 assert.equal(0.1, eqt.average); 69 assert.equal(0.1, interactiveEQT.average);
70 let totalEQT = values.getHistogramNamed(
71 'total:500ms_window:renderer_eqt');
72 assert.equal(10, totalEQT.average);
70 }); 73 });
71 74
72 test('estimatedInputLatency_noInteractiveThrows', function() { 75 test('estimatedInputLatency_noInteractive', function() {
73 let model = tr.c.TestUtils.newModel((model) => { 76 let model = tr.c.TestUtils.newModel((model) => {
74 let rendererProcess = model.getOrCreateProcess(1984); 77 let rendererProcess = model.getOrCreateProcess(1984);
75 let mainThread = rendererProcess.getOrCreateThread(2); 78 let mainThread = rendererProcess.getOrCreateThread(2);
76 mainThread.name = 'CrRendererMain'; 79 mainThread.name = 'CrRendererMain';
77 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 80 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
78 cat: 'toplevel', 81 cat: 'toplevel',
79 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 82 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
80 start: 0, 83 start: 0,
81 duration: 100, 84 duration: 100,
82 })); 85 }));
83 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 86 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
84 cat: 'toplevel', 87 cat: 'toplevel',
85 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 88 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
86 start: 3000, 89 start: 3000,
87 duration: 10, 90 duration: 10,
88 })); 91 }));
89 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 92 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
90 cat: 'toplevel', 93 cat: 'toplevel',
91 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 94 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
92 start: 9000, 95 start: 9000,
93 duration: 10, 96 duration: 10,
94 })); 97 }));
95 }); 98 });
96 let values = new tr.v.HistogramSet(); 99 let values = new tr.v.HistogramSet();
97 assert.throws(() => { 100 tr.metrics.sh.estimatedInputLatency(values, model);
98 tr.metrics.sh.estimatedInputLatency(values, model); 101 let interactiveEQT = values.getHistogramNamed(
99 }, 'getOnlyElement was passed an empty iterable.'); 102 'interactive:500ms_window:renderer_eqt');
103 assert.equal(0, interactiveEQT.numValues);
100 }); 104 });
101 105
102 test('estimatedInputLatency_multipleInteractiveThrows', function() { 106 test('estimatedInputLatency_multipleInteractive', function() {
103 let model = tr.c.TestUtils.newModel((model) => { 107 let model = tr.c.TestUtils.newModel((model) => {
104 let rendererProcess = model.getOrCreateProcess(1984); 108 let rendererProcess = model.getOrCreateProcess(1984);
105 let mainThread = rendererProcess.getOrCreateThread(2); 109 let mainThread = rendererProcess.getOrCreateThread(2);
106 mainThread.name = 'CrRendererMain'; 110 mainThread.name = 'CrRendererMain';
107 addInteractiveTimestamp(rendererProcess, mainThread, 200); 111 addInteractiveTimestamp(rendererProcess, mainThread, 200);
108 addInteractiveTimestamp(rendererProcess, mainThread, 400); 112 addInteractiveTimestamp(rendererProcess, mainThread, 400);
109 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 113 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
110 cat: 'toplevel', 114 cat: 'toplevel',
111 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 115 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
112 start: 0, 116 start: 0,
113 duration: 100, 117 duration: 100,
114 })); 118 }));
115 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 119 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
116 cat: 'toplevel', 120 cat: 'toplevel',
117 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 121 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
118 start: 3000, 122 start: 3000,
119 duration: 10, 123 duration: 10,
120 })); 124 }));
121 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 125 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
122 cat: 'toplevel', 126 cat: 'toplevel',
123 title: 'TaskQueueManager::ProcessTaskFromWorkQueue', 127 title: 'TaskQueueManager::ProcessTaskFromWorkQueue',
124 start: 9000, 128 start: 9000,
125 duration: 10, 129 duration: 10,
126 })); 130 }));
127 }); 131 });
128 let values = new tr.v.HistogramSet(); 132 let values = new tr.v.HistogramSet();
129 assert.throws(() => { 133 tr.metrics.sh.estimatedInputLatency(values, model);
130 tr.metrics.sh.estimatedInputLatency(values, model); 134 let interactiveEQT = values.getHistogramNamed(
131 }, 'getOnlyElement was passed an iterable with multiple elements.'); 135 'interactive:500ms_window:renderer_eqt');
136 // TODO(ulan): Support multiple interactive time windows when
137 // https://crbug.com/692112 is fixed.
138 assert.equal(0, interactiveEQT.numValues);
132 }); 139 });
133 140
134 test('estimatedInputLatency_multipleRenderersAggregates', function() { 141 test('estimatedInputLatency_multipleRenderersAggregates', function() {
135 let model = tr.c.TestUtils.newModel(function(model) { 142 let model = tr.c.TestUtils.newModel(function(model) {
136 let rendererProcess = model.getOrCreateProcess(1984); 143 let rendererProcess = model.getOrCreateProcess(1984);
137 let mainThread = rendererProcess.getOrCreateThread(2); 144 let mainThread = rendererProcess.getOrCreateThread(2);
138 mainThread.name = 'CrRendererMain'; 145 mainThread.name = 'CrRendererMain';
139 addInteractiveTimestamp(rendererProcess, mainThread, 200); 146 addInteractiveTimestamp(rendererProcess, mainThread, 200);
140 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({ 147 mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
141 cat: 'toplevel', 148 cat: 'toplevel',
(...skipping 25 matching lines...) Expand all
167 })); 174 }));
168 }); 175 });
169 let values = new tr.v.HistogramSet(); 176 let values = new tr.v.HistogramSet();
170 tr.metrics.sh.estimatedInputLatency(values, model); 177 tr.metrics.sh.estimatedInputLatency(values, model);
171 let eqt = values.getHistogramNamed( 178 let eqt = values.getHistogramNamed(
172 'interactive:500ms_window:renderer_eqt'); 179 'interactive:500ms_window:renderer_eqt');
173 assert.equal(0.05, eqt.average); 180 assert.equal(0.05, eqt.average);
174 }); 181 });
175 }); 182 });
176 </script> 183 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698