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

Side by Side Diff: tracing/tracing/extras/importer/trace_event_importer_test.html

Issue 1573643002: Make trace_event_importer recognize timing conversion and parse web user timing events (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: Skip create nestable async slices in D8 test Created 4 years, 11 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 | « tracing/tracing/extras/importer/trace_event_importer.html ('k') | no next file » | 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 (c) 2013 The Chromium Authors. All rights reserved. 3 Copyright (c) 2013 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/units/time_display_mode.html"> 8 <link rel="import" href="/tracing/base/units/time_display_mode.html">
9 <link rel="import" href="/tracing/core/test_utils.html"> 9 <link rel="import" href="/tracing/core/test_utils.html">
10 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html"> 10 <link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
11 <link rel="import" href="/tracing/extras/measure/measure.html">
11 <link rel="import" href="/tracing/importer/import.html"> 12 <link rel="import" href="/tracing/importer/import.html">
12 13
13 <script> 14 <script>
14 'use strict'; 15 'use strict';
15 16
16 tr.b.unittest.testSuite(function() { 17 tr.b.unittest.testSuite(function() {
17 var findSliceNamed = tr.c.TestUtils.findSliceNamed; 18 var findSliceNamed = tr.c.TestUtils.findSliceNamed;
18 var ColorScheme = tr.b.ColorScheme; 19 var ColorScheme = tr.b.ColorScheme;
20 var MeasureAsyncSlice = tr.e.measure.MeasureAsyncSlice;
19 21
20 function makeModel(events, opt_shift, opt_prune) { 22 function makeModel(events, opt_shift, opt_prune) {
21 return tr.c.TestUtils.newModelWithEvents([events], { 23 return tr.c.TestUtils.newModelWithEvents([events], {
22 shiftWorldToZero: opt_shift, 24 shiftWorldToZero: opt_shift,
23 pruneEmptyContainers: opt_prune 25 pruneEmptyContainers: opt_prune
24 }); 26 });
25 } 27 }
26 28
27 function makeUnshiftedModel(events) { 29 function makeUnshiftedModel(events) {
28 return makeModel(events, false); 30 return makeModel(events, false);
(...skipping 4924 matching lines...) Expand 10 before | Expand all | Expand 10 after
4953 4955
4954 var s0 = t.sliceGroup.slices[0]; 4956 var s0 = t.sliceGroup.slices[0];
4955 assert.equal(s0.title, 'mark1'); 4957 assert.equal(s0.title, 'mark1');
4956 assert.equal(s0.start, 0); 4958 assert.equal(s0.start, 0);
4957 4959
4958 var s1 = t.sliceGroup.slices[1]; 4960 var s1 = t.sliceGroup.slices[1];
4959 assert.equal(s1.title, 'mark2'); 4961 assert.equal(s1.title, 'mark2');
4960 assert.equal(s1.start, .01); 4962 assert.equal(s1.start, .01);
4961 }); 4963 });
4962 4964
4965 test('createNestableAsyncSlicesForUserTimingWithoutArgs', function() {
4966 if (tr.isHeadless)
4967 return;
4968 /**
4969 * Structure of this async slices
4970 *
4971 * Group A:
4972 *
4973 * |__________|
4974 * a1
4975 *
4976 * Group B:
4977 *
4978 * |______________________________|
4979 * b1
4980 * |__________||_|
4981 * b2 b4
4982 * |_|
4983 * b3
4984 **/
4985 var events = [
4986 {
4987 name: 'A:a1',
4988 args: {params: ''},
4989 pid: 1,
4990 ts: 100,
4991 cat: 'blink.user_timing',
4992 tid: 2,
4993 id: 3,
4994 ph: 'b'
4995 },
4996 {
4997 name: 'A:a1',
4998 args: {params: ''},
4999 pid: 1,
5000 ts: 110,
5001 cat: 'blink.user_timing',
5002 tid: 2,
5003 id: 3,
5004 ph: 'e'
5005 },
5006 {
5007 name: 'B:b1',
5008 args: {params: ''},
5009 pid: 1,
5010 ts: 120,
5011 cat: 'blink.user_timing',
5012 tid: 2,
5013 id: 4,
5014 ph: 'b'
5015 },
5016 {
5017 name: 'B:b2',
5018 args: {params: ''},
5019 pid: 1,
5020 ts: 130,
5021 cat: 'blink.user_timing',
5022 tid: 2,
5023 id: 5,
5024 ph: 'b'
5025 },
5026 {
5027 name: 'B:b3',
5028 args: {params: ''},
5029 pid: 1,
5030 ts: 131,
5031 cat: 'blink.user_timing',
5032 tid: 2,
5033 id: 5,
5034 ph: 'b'
5035 },
5036 {
5037 name: 'B:b3',
5038 args: {params: ''},
5039 pid: 1,
5040 ts: 132,
5041 cat: 'blink.user_timing',
5042 tid: 2,
5043 id: 5,
5044 ph: 'e'
5045 },
5046 {
5047 name: 'B:b2',
5048 args: {params: ''},
5049 pid: 1,
5050 ts: 140,
5051 cat: 'blink.user_timing',
5052 tid: 2,
5053 id: 5,
5054 ph: 'e'
5055 },
5056 {
5057 name: 'B:b4',
5058 args: {params: ''},
5059 pid: 1,
5060 ts: 141,
5061 cat: 'blink.user_timing',
5062 tid: 2,
5063 id: 5,
5064 ph: 'b'
5065 },
5066 {
5067 name: 'B:b4',
5068 args: {params: ''},
5069 pid: 1,
5070 ts: 142,
5071 cat: 'blink.user_timing',
5072 tid: 2,
5073 id: 5,
5074 ph: 'e'
5075 },
5076 {
5077 name: 'B:b1',
5078 args: {params: ''},
5079 pid: 1,
5080 ts: 150,
5081 cat: 'blink.user_timing',
5082 tid: 2,
5083 id: 4,
5084 ph: 'e'
5085 }
5086 ];
5087
5088 var m = makeModel(events);
5089 assert(m.numProcesses, 1);
5090 var p = m.processes[1];
5091 assert.isDefined(p);
5092 assert.equal(p.numThreads, 1);
5093 var t = p.threads[2];
5094 var asyncSliceGroup = t.asyncSliceGroup;
5095 assert.equal(asyncSliceGroup.length, 2);
5096 for (var i = 0; i < asyncSliceGroup.length; ++i) {
5097 assert.isTrue(asyncSliceGroup.slices[i] instanceof MeasureAsyncSlice);
5098 }
5099
5100 var groupA = asyncSliceGroup.slices[0];
5101 assert.equal(groupA.viewSubGroupTitle, 'A');
5102 assert.equal(groupA.title, 'a1');
5103 assert.equal(groupA.subSlices.length, 0);
5104 var groupB = asyncSliceGroup.slices[1];
5105 assert.equal(groupB.viewSubGroupTitle, 'B');
5106 assert.equal(groupB.title, 'b1');
5107 assert.equal(groupB.subSlices.length, 2);
5108 var groupBSubSlice1 = groupB.subSlices[0];
5109 assert.equal(groupBSubSlice1.viewSubGroupTitle, 'B');
5110 assert.equal(groupBSubSlice1.title, 'b2');
5111 assert.equal(groupBSubSlice1.subSlices.length, 1);
5112 assert.equal(groupBSubSlice1.subSlices[0].viewSubGroupTitle, 'B');
5113 assert.equal(groupBSubSlice1.subSlices[0].title, 'b3');
5114 assert.equal(groupBSubSlice1.subSlices[0].subSlices.length, 0);
5115 var groupBSubSlice2 = groupB.subSlices[1];
5116 assert.equal(groupBSubSlice2.viewSubGroupTitle, 'B');
5117 assert.equal(groupBSubSlice2.title, 'b4');
5118 assert.equal(groupBSubSlice2.subSlices.length, 0);
5119 });
5120
5121 test('createNestableAsyncSlicesForUserTimingWithArgs', function() {
5122 if (tr.isHeadless)
5123 return;
5124 /**
5125 * Structure of this async slices
5126 *
5127 * Group A:
5128 *
5129 * |__________| |__________|
5130 * a1 a2
5131 *
5132 * a1.args = {a: 1}
5133 * a2.args = {a: 2, b: 2}
5134 **/
5135 var events = [
5136 {
5137 name: 'A:a1/eyJhIjoxfQ==',
5138 args: {params: ''},
5139 pid: 1,
5140 ts: 100,
5141 cat: 'blink.user_timing',
5142 tid: 2,
5143 id: 3,
5144 ph: 'b'
5145 },
5146 {
5147 name: 'A:a1/eyJhIjoxfQ==',
5148 args: {params: ''},
5149 pid: 1,
5150 ts: 110,
5151 cat: 'blink.user_timing',
5152 tid: 2,
5153 id: 3,
5154 ph: 'e'
5155 },
5156 {
5157 name: 'A:a2/eyJhIjoyLCJiIjoyfQ==',
5158 args: {params: ''},
5159 pid: 1,
5160 ts: 120,
5161 cat: 'blink.user_timing',
5162 tid: 2,
5163 id: 4,
5164 ph: 'b'
5165 },
5166 {
5167 name: 'A:a2/eyJhIjoyLCJiIjoyfQ==',
5168 args: {params: ''},
5169 pid: 1,
5170 ts: 130,
5171 cat: 'blink.user_timing',
5172 tid: 2,
5173 id: 4,
5174 ph: 'e'
5175 }
5176 ];
5177
5178 var m = makeModel(events);
5179 assert(m.numProcesses, 1);
5180 var p = m.processes[1];
5181 assert.isDefined(p);
5182 assert.equal(p.numThreads, 1);
5183 var t = p.threads[2];
5184 var asyncSliceGroup = t.asyncSliceGroup;
5185 assert.equal(asyncSliceGroup.length, 2);
5186 for (var i = 0; i < asyncSliceGroup.length; ++i) {
5187 assert.isTrue(asyncSliceGroup.slices[i] instanceof MeasureAsyncSlice);
5188 }
5189
5190 var a1 = asyncSliceGroup.slices[0];
5191 assert.equal(a1.viewSubGroupTitle, 'A');
5192 assert.equal(a1.title, 'a1');
5193 assert.equal(a1.subSlices.length, 0);
5194 assert.deepEqual(a1.args, {a: 1});
5195 var a2 = asyncSliceGroup.slices[1];
5196 assert.equal(a2.viewSubGroupTitle, 'A');
5197 assert.equal(a2.title, 'a2');
5198 assert.equal(a2.subSlices.length, 0);
5199 assert.deepEqual(a2.args, {a: 2, b: 2});
5200 });
5201
5202 test('UserTimingAsyncSlicesWithNormalAsyncSlices', function() {
5203 if (tr.isHeadless)
5204 return;
5205 /**
5206 * Structure of user timing async slices
5207 *
5208 * Group A:
5209 *
5210 * |__________|
5211 * a1
5212 * |__|
5213 * a2
5214 *
5215 * B
5216 * |__|
5217 * B
5218 * C
5219 * |_|
5220 * C
5221 **/
5222 var events = [
5223 {
5224 name: 'A:a1', args: {params: ''}, pid: 1, ts: 1,
5225 cat: 'blink.user_timing', tid: 2, id: 3, ph: 'b'
5226 },
5227 {
5228 name: 'A:a1', args: {params: ''}, pid: 1, ts: 11,
5229 cat: 'blink.user_timing', tid: 2, id: 3, ph: 'e'
5230 },
5231 {
5232 name: 'A:a2', args: {params: ''}, pid: 1, ts: 2,
5233 cat: 'blink.user_timing', tid: 2, id: 4, ph: 'b'
5234 },
5235 {
5236 name: 'A:a2', args: {params: ''}, pid: 1, ts: 4,
5237 cat: 'blink.user_timing', tid: 2, id: 4, ph: 'e'
5238 },
5239 {
5240 name: 'B', args: {}, pid: 1, ts: 9, cat: 'foo',
5241 tid: 2, ph: 'b', id: 5
5242 },
5243 {
5244 name: 'B', args: {}, pid: 1, ts: 11, cat: 'foo',
5245 tid: 2, ph: 'e', id: 5
5246 },
5247 {
5248 name: 'C', args: {}, pid: 1, ts: 12, cat: 'foo',
5249 tid: 2, ph: 'b', id: 6
5250 },
5251 {
5252 name: 'C', args: {}, pid: 1, ts: 13, cat: 'foo',
5253 tid: 2, ph: 'e', id: 6
5254 }
5255 ];
5256
5257 var m = makeModel(events);
5258 assert(m.numProcesses, 1);
5259 var p = m.processes[1];
5260 assert.isDefined(p);
5261 assert.equal(p.numThreads, 1);
5262 var t = p.threads[2];
5263 var asyncSliceGroup = t.asyncSliceGroup;
5264 assert.equal(asyncSliceGroup.length, 3);
5265 assert.isTrue(asyncSliceGroup.slices[0] instanceof MeasureAsyncSlice);
5266 assert.isFalse(asyncSliceGroup.slices[1] instanceof MeasureAsyncSlice);
5267 assert.isFalse(asyncSliceGroup.slices[2] instanceof MeasureAsyncSlice);
5268
5269 var a1 = asyncSliceGroup.slices[0];
5270 assert.equal(a1.viewSubGroupTitle, 'A');
5271 assert.equal(a1.title, 'a1');
5272 assert.equal(a1.subSlices.length, 1);
5273 var a2 = a1.subSlices[0];
5274 assert.equal(a2.viewSubGroupTitle, 'A');
5275 assert.equal(a2.title, 'a2');
5276 assert.equal(a2.subSlices.length, 0);
5277 var B = asyncSliceGroup.slices[1];
5278 assert.equal(B.viewSubGroupTitle, 'B');
5279 assert.equal(B.title, 'B');
5280 assert.equal(B.subSlices.length, 0);
5281 var C = asyncSliceGroup.slices[2];
5282 assert.equal(C.viewSubGroupTitle, 'C');
5283 assert.equal(C.title, 'C');
5284 assert.equal(C.subSlices.length, 0);
5285 });
5286
4963 // TODO(nduca): one slice, two threads 5287 // TODO(nduca): one slice, two threads
4964 // TODO(nduca): one slice, two pids 5288 // TODO(nduca): one slice, two pids
4965 5289
4966 }); 5290 });
4967 </script> 5291 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/extras/importer/trace_event_importer.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698