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

Side by Side Diff: tracing/tracing/metrics/blink/gc_metric_test.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 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/extras/importer/trace_event_importer.html"> 9 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
10 <link rel="import" href="/tracing/metrics/v8/gc_metric.html"> 10 <link rel="import" href="/tracing/metrics/blink/gc_metric.html">
11 <link rel="import" href="/tracing/model/slice_group.html"> 11 <link rel="import" href="/tracing/model/slice_group.html">
12 <link rel="import" href="/tracing/value/value_set.html"> 12 <link rel="import" href="/tracing/value/value_set.html">
13 13
14 <script> 14 <script>
15 'use strict'; 15 'use strict';
16 16
17 tr.b.unittest.testSuite(function() { 17 tr.b.unittest.testSuite(function() {
18 18
19 function createModel(start, end, slices) { 19 function createModel(start, end, slices) {
20 var opts = { 20 var opts = {
21 customizeModelCallback: function(model) { 21 customizeModelCallback: function(model) {
22 var group = new tr.model.SliceGroup(tr.c.TestUtils.newFakeThread()); 22 var process = model.getOrCreateProcess(1);
23 var ue = new tr.model.um.AnimationExpectation( 23 var thread = process.getOrCreateThread(2);
24 model, 'test', start, end); 24 var group = thread.sliceGroup;
25 slices.forEach(function(slice) { 25 slices.forEach(function(slice) {
26 group.pushSlice(tr.c.TestUtils.newSliceEx(slice)); 26 group.pushSlice(tr.c.TestUtils.newSliceEx(slice));
27 }); 27 });
28 group.createSubSlices(); 28 group.createSubSlices();
29 group.slices.forEach(function(slice) {
30 ue.associatedEvents.push(slice);
31 });
32 model.userModel.expectations.push(ue);
33 } 29 }
34 }; 30 };
35 var model = tr.c.TestUtils.newModelWithEvents([], opts); 31 var model = tr.c.TestUtils.newModelWithEvents([], opts);
36 return model; 32 return model;
37 } 33 }
38 34
39 function constructName(name, suffix) { 35 function constructName(name, suffix) {
40 return 'Animation-' + name + '_' + suffix; 36 return name + '_' + suffix;
41 } 37 }
42 38
43 function run(slices) { 39 function run(slices) {
44 var values = new tr.v.ValueSet(); 40 var values = new tr.v.ValueSet();
45 var startTime = slices.reduce((acc, slice) => (Math.min(acc, slice.start))); 41 var startTime = slices.reduce((acc, slice) => (Math.min(acc, slice.start)));
46 var endTime = slices.reduce((acc, slice) => (Math.max(acc, slice.end))); 42 var endTime = slices.reduce((acc, slice) => (Math.max(acc, slice.end)));
47 var model = createModel(startTime - 1, endTime + 1, slices); 43 var model = createModel(startTime - 1, endTime + 1, slices);
48 tr.metrics.v8.gcMetric(values, model); 44 tr.metrics.blink.blinkGcMetric(values, model);
49 var result = {}; 45 var result = {};
50 values.valueDicts.forEach(function(value) { 46 values.valueDicts.forEach(function(value) {
51 result[value.name] = value.numeric.value; 47 result[value.name] = value.numeric.value;
52 }); 48 });
53 return result; 49 return result;
54 } 50 }
55 51
56 test('topEvents', function() { 52 test('topEvents', function() {
57 var events = { 53 var events = {
58 'V8.GCCompactor': 'v8-gc-full-mark-compactor', 54 'BlinkGCMarking': 'blink-gc-marking',
59 'V8.GCFinalizeMC': 'v8-gc-latency-mark-compactor', 55 'ThreadState::completeSweep': 'blink-gc-complete-sweep',
60 'V8.GCFinalizeMCReduceMemory': 'v8-gc-memory-mark-compactor', 56 'ThreadState::performIdleLazySweep': 'blink-gc-idle-lazy-sweep'
61 'V8.GCIncrementalMarking': 'v8-gc-incremental-step',
62 'V8.GCIncrementalMarkingFinalize': 'v8-gc-incremental-finalize',
63 'V8.GCIncrementalMarkingStart': 'v8-gc-incremental-start',
64 'V8.GCPhantomHandleProcessingCallback' : 'v8-gc-phantom-handle-callback',
65 'V8.GCScavenger': 'v8-gc-scavenger'
66 }; 57 };
67 tr.b.iterItems(events, function(timelineName, telemetryName) { 58 tr.b.iterItems(events, function(timelineName, telemetryName) {
68 var slices = [ 59 var slices = [
69 { 60 {
70 title: timelineName, args: {}, start: 100, end: 200, 61 title: timelineName, args: {}, start: 100, end: 200,
71 cpuStart: 100, cpuEnd: 200 62 cpuStart: 100, cpuEnd: 200
72 } 63 }
73 ]; 64 ];
74 var actual = run(slices); 65 var actual = run(slices);
75 var expected = { 66 var expected = {
(...skipping 19 matching lines...) Expand all
95 86
96 test('idleTimes', function() { 87 test('idleTimes', function() {
97 var values = new tr.v.ValueSet(); 88 var values = new tr.v.ValueSet();
98 var slices = [ 89 var slices = [
99 { 90 {
100 title: 'SingleThreadIdleTaskRunner::RunTask', 91 title: 'SingleThreadIdleTaskRunner::RunTask',
101 args: {'allotted_time_ms' : 100}, start: 100, end: 200, 92 args: {'allotted_time_ms' : 100}, start: 100, end: 200,
102 cpuStart: 100, cpuEnd: 200 93 cpuStart: 100, cpuEnd: 200
103 }, 94 },
104 { 95 {
105 title: 'V8.GCFinalizeMC', args: {}, start: 110, end: 190, 96 title: 'BlinkGCMarking', args: {}, start: 110, end: 190,
106 cpuStart: 110, cpuEnd: 190 97 cpuStart: 110, cpuEnd: 190
107 } 98 }
108 ]; 99 ];
109 var actual = run(slices); 100 var actual = run(slices);
110 var expected = { 101 var expected = {
111 sum: 80, 102 sum: 80,
112 count: 1, 103 count: 1,
113 avg: 80, 104 avg: 80,
114 max: 80, 105 max: 80,
115 idle_deadline_overrun_sum: 0, 106 idle_deadline_overrun_sum: 0,
116 idle_deadline_overrun_avg: 0, 107 idle_deadline_overrun_avg: 0,
117 idle_deadline_overrun_max: 0, 108 idle_deadline_overrun_max: 0,
118 outside_idle_sum: 0, 109 outside_idle_sum: 0,
119 outside_idle_avg: 0, 110 outside_idle_avg: 0,
120 outside_idle_max: 0, 111 outside_idle_max: 0,
121 percentage_idle: 100 112 percentage_idle: 100
122 }; 113 };
123 tr.b.iterItems(expected, function(key, value) { 114 tr.b.iterItems(expected, function(key, value) {
124 var name = constructName('v8-gc-latency-mark-compactor', key); 115 var name = constructName('blink-gc-marking', key);
125 assert.equal(name + ':' + actual[name], name + ':' + value); 116 assert.equal(name + ':' + actual[name], name + ':' + value);
126 }); 117 });
127 }); 118 });
128 119
129 test('idleTimeOverrun', function() { 120 test('idleTimeOverrun', function() {
130 var values = new tr.v.ValueSet(); 121 var values = new tr.v.ValueSet();
131 var slices = [ 122 var slices = [
132 { 123 {
133 title: 'SingleThreadIdleTaskRunner::RunTask', 124 title: 'SingleThreadIdleTaskRunner::RunTask',
134 args: {'allotted_time_ms' : 10}, start: 100, end: 200, 125 args: {'allotted_time_ms' : 10}, start: 100, end: 200,
135 cpuStart: 100, cpuEnd: 200 126 cpuStart: 100, cpuEnd: 200
136 }, 127 },
137 { 128 {
138 title: 'V8.GCFinalizeMC', args: {}, start: 110, end: 190, 129 title: 'BlinkGCMarking', args: {}, start: 110, end: 190,
139 cpuStart: 110, cpuEnd: 190 130 cpuStart: 110, cpuEnd: 190
140 } 131 }
141 ]; 132 ];
142 var actual = run(slices); 133 var actual = run(slices);
143 var expected = { 134 var expected = {
144 sum: 80, 135 sum: 80,
145 count: 1, 136 count: 1,
146 avg: 80, 137 avg: 80,
147 max: 80, 138 max: 80,
148 idle_deadline_overrun_sum: 70, 139 idle_deadline_overrun_sum: 70,
149 idle_deadline_overrun_avg: 70, 140 idle_deadline_overrun_avg: 70,
150 idle_deadline_overrun_max: 70, 141 idle_deadline_overrun_max: 70,
151 outside_idle_sum: 70, 142 outside_idle_sum: 70,
152 outside_idle_avg: 70, 143 outside_idle_avg: 70,
153 outside_idle_max: 70, 144 outside_idle_max: 70,
154 percentage_idle: 100 / 8 145 percentage_idle: 100 / 8
155 }; 146 };
156 tr.b.iterItems(expected, function(key, value) { 147 tr.b.iterItems(expected, function(key, value) {
157 var name = constructName('v8-gc-latency-mark-compactor', key); 148 var name = constructName('blink-gc-marking', key);
158 assert.equal(name + ':' + actual[name], name + ':' + value); 149 assert.equal(name + ':' + actual[name], name + ':' + value);
159 }); 150 });
160 }); 151 });
161 152
162 test('subEvents', function() {
163 var values = new tr.v.ValueSet();
164 var slices = [
165 {
166 title: 'V8.GCFinalizeMC', args: {}, start: 100, end: 200,
167 cpuStart: 100, cpuEnd: 200
168 },
169 {
170 title: 'V8.GC_MC_MARK', args: {}, start: 110, end: 190,
171 cpuStart: 110, cpuEnd: 190
172 },
173 ];
174 var actual = run(slices);
175 var expected = {
176 avg: 80,
177 max: 80,
178 };
179 var telemetryName = 'v8-gc-latency-mark-compactor-mark';
180 tr.b.iterItems(expected, function(key, value) {
181 var name = constructName(telemetryName, key);
182 assert.equal(name + ':' + actual[name], name + ':' + value);
183 });
184 assert.closeTo(actual[constructName(telemetryName, 'pct_090')], 80, 1);
185 });
186
187 test('total', function() { 153 test('total', function() {
188 var values = new tr.v.ValueSet(); 154 var values = new tr.v.ValueSet();
189 var slices = [ 155 var slices = [
190 { 156 {
191 title: 'V8.GCFinalizeMC', args: {}, start: 100, end: 200, 157 title: 'BlinkGCMarking', args: {}, start: 100, end: 200,
192 cpuStart: 100, cpuEnd: 200 158 cpuStart: 100, cpuEnd: 200
193 }, 159 },
194 { 160 {
195 title: 'V8.GCIncrementalMarking', args: {}, start: 210, end: 290, 161 title: 'ThreadState::performIdleLazySweep', args: {}, start: 210,
196 cpuStart: 210, cpuEnd: 290 162 end: 290, cpuStart: 210, cpuEnd: 290
197 } 163 }
198 ]; 164 ];
199 var actual = run(slices); 165 var actual = run(slices);
200 var expected = { 166 var expected = {
201 sum: 180, 167 sum: 180,
202 count: 2, 168 count: 2,
203 avg: 90, 169 avg: 90,
204 max: 100, 170 max: 100,
205 idle_deadline_overrun_sum: 0, 171 idle_deadline_overrun_sum: 0,
206 idle_deadline_overrun_avg: 0, 172 idle_deadline_overrun_avg: 0,
207 idle_deadline_overrun_max: 0, 173 idle_deadline_overrun_max: 0,
208 outside_idle_sum: 180, 174 outside_idle_sum: 180,
209 outside_idle_avg: 90, 175 outside_idle_avg: 90,
210 outside_idle_max: 100, 176 outside_idle_max: 100,
211 percentage_idle: 0 177 percentage_idle: 0
212 }; 178 };
213 tr.b.iterItems(expected, function(key, value) { 179 tr.b.iterItems(expected, function(key, value) {
214 var name = constructName('v8-gc-total', key); 180 var name = constructName('blink-gc-total', key);
215 assert.equal(name + ':' + actual[name], name + ':' + value); 181 assert.equal(name + ':' + actual[name], name + ':' + value);
216 }); 182 });
217 }); 183 });
218 184
219 test('mutatorUtilization', function() {
220 var values = new tr.v.ValueSet();
221 var slices = [
222 {
223 title: 'V8.Execute', args: {}, start: 100, end: 200,
224 cpuStart: 100, cpuEnd: 200
225 },
226 {
227 title: 'V8.GCFinalizeMC', args: {}, start: 150, end: 160,
228 cpuStart: 150, cpuEnd: 160
229 },
230 {
231 title: 'V8.Execute', args: {}, start: 1000, end: 1200,
232 cpuStart: 1000, cpuEnd: 1200
233 },
234 {
235 title: 'V8.GCIncrementalMarking', args: {}, start: 1010, end: 1020,
236 cpuStart: 1010, cpuEnd: 1020
237 }
238 ];
239 var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
240 0, 300, tr.metrics.v8.WINDOW_SIZE_MS,
241 [{start: 50, end: 60}, {start: 110, end: 120}]);
242 var actual = run(slices);
243 assert.strictEqual(
244 actual['Animation-v8-execute-mutator-utilization_pct_095'],
245 mutatorUtilization.percentile(1 - 0.95) * 100);
246 assert.strictEqual(
247 actual['Animation-v8-execute-mutator-utilization_pct_099'],
248 mutatorUtilization.percentile(1 - 0.99) * 100);
249 });
250
251 }); 185 });
252 </script> 186 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/metrics/blink/gc_metric.html ('k') | tracing/tracing/metrics/discover_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698