| Index: tracing/tracing/extras/importer/trace_event_importer_test.html
|
| diff --git a/tracing/tracing/extras/importer/trace_event_importer_test.html b/tracing/tracing/extras/importer/trace_event_importer_test.html
|
| index 27a596ad86b6bb446c648d2711d716f012eb9ac2..9e08c3dd0d2247100e4004a3c959fdd7be16bfd0 100644
|
| --- a/tracing/tracing/extras/importer/trace_event_importer_test.html
|
| +++ b/tracing/tracing/extras/importer/trace_event_importer_test.html
|
| @@ -8,6 +8,7 @@ found in the LICENSE file.
|
| <link rel="import" href="/tracing/base/units/time_display_mode.html">
|
| <link rel="import" href="/tracing/core/test_utils.html">
|
| <link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
|
| +<link rel="import" href="/tracing/extras/measure/measure.html">
|
| <link rel="import" href="/tracing/importer/import.html">
|
|
|
| <script>
|
| @@ -16,6 +17,7 @@ found in the LICENSE file.
|
| tr.b.unittest.testSuite(function() {
|
| var findSliceNamed = tr.c.TestUtils.findSliceNamed;
|
| var ColorScheme = tr.b.ColorScheme;
|
| + var MeasureAsyncSlice = tr.e.measure.MeasureAsyncSlice;
|
|
|
| function makeModel(events, opt_shift, opt_prune) {
|
| return tr.c.TestUtils.newModelWithEvents([events], {
|
| @@ -4960,6 +4962,328 @@ tr.b.unittest.testSuite(function() {
|
| assert.equal(s1.start, .01);
|
| });
|
|
|
| + test('createNestableAsyncSlicesForUserTimingWithoutArgs', function() {
|
| + if (tr.isHeadless)
|
| + return;
|
| + /**
|
| + * Structure of this async slices
|
| + *
|
| + * Group A:
|
| + *
|
| + * |__________|
|
| + * a1
|
| + *
|
| + * Group B:
|
| + *
|
| + * |______________________________|
|
| + * b1
|
| + * |__________||_|
|
| + * b2 b4
|
| + * |_|
|
| + * b3
|
| + **/
|
| + var events = [
|
| + {
|
| + name: 'A:a1',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 100,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 3,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'A:a1',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 110,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 3,
|
| + ph: 'e'
|
| + },
|
| + {
|
| + name: 'B:b1',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 120,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 4,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'B:b2',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 130,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 5,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'B:b3',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 131,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 5,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'B:b3',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 132,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 5,
|
| + ph: 'e'
|
| + },
|
| + {
|
| + name: 'B:b2',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 140,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 5,
|
| + ph: 'e'
|
| + },
|
| + {
|
| + name: 'B:b4',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 141,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 5,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'B:b4',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 142,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 5,
|
| + ph: 'e'
|
| + },
|
| + {
|
| + name: 'B:b1',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 150,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 4,
|
| + ph: 'e'
|
| + }
|
| + ];
|
| +
|
| + var m = makeModel(events);
|
| + assert(m.numProcesses, 1);
|
| + var p = m.processes[1];
|
| + assert.isDefined(p);
|
| + assert.equal(p.numThreads, 1);
|
| + var t = p.threads[2];
|
| + var asyncSliceGroup = t.asyncSliceGroup;
|
| + assert.equal(asyncSliceGroup.length, 2);
|
| + for (var i = 0; i < asyncSliceGroup.length; ++i) {
|
| + assert.isTrue(asyncSliceGroup.slices[i] instanceof MeasureAsyncSlice);
|
| + }
|
| +
|
| + var groupA = asyncSliceGroup.slices[0];
|
| + assert.equal(groupA.viewSubGroupTitle, 'A');
|
| + assert.equal(groupA.title, 'a1');
|
| + assert.equal(groupA.subSlices.length, 0);
|
| + var groupB = asyncSliceGroup.slices[1];
|
| + assert.equal(groupB.viewSubGroupTitle, 'B');
|
| + assert.equal(groupB.title, 'b1');
|
| + assert.equal(groupB.subSlices.length, 2);
|
| + var groupBSubSlice1 = groupB.subSlices[0];
|
| + assert.equal(groupBSubSlice1.viewSubGroupTitle, 'B');
|
| + assert.equal(groupBSubSlice1.title, 'b2');
|
| + assert.equal(groupBSubSlice1.subSlices.length, 1);
|
| + assert.equal(groupBSubSlice1.subSlices[0].viewSubGroupTitle, 'B');
|
| + assert.equal(groupBSubSlice1.subSlices[0].title, 'b3');
|
| + assert.equal(groupBSubSlice1.subSlices[0].subSlices.length, 0);
|
| + var groupBSubSlice2 = groupB.subSlices[1];
|
| + assert.equal(groupBSubSlice2.viewSubGroupTitle, 'B');
|
| + assert.equal(groupBSubSlice2.title, 'b4');
|
| + assert.equal(groupBSubSlice2.subSlices.length, 0);
|
| + });
|
| +
|
| + test('createNestableAsyncSlicesForUserTimingWithArgs', function() {
|
| + if (tr.isHeadless)
|
| + return;
|
| + /**
|
| + * Structure of this async slices
|
| + *
|
| + * Group A:
|
| + *
|
| + * |__________| |__________|
|
| + * a1 a2
|
| + *
|
| + * a1.args = {a: 1}
|
| + * a2.args = {a: 2, b: 2}
|
| + **/
|
| + var events = [
|
| + {
|
| + name: 'A:a1/eyJhIjoxfQ==',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 100,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 3,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'A:a1/eyJhIjoxfQ==',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 110,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 3,
|
| + ph: 'e'
|
| + },
|
| + {
|
| + name: 'A:a2/eyJhIjoyLCJiIjoyfQ==',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 120,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 4,
|
| + ph: 'b'
|
| + },
|
| + {
|
| + name: 'A:a2/eyJhIjoyLCJiIjoyfQ==',
|
| + args: {params: ''},
|
| + pid: 1,
|
| + ts: 130,
|
| + cat: 'blink.user_timing',
|
| + tid: 2,
|
| + id: 4,
|
| + ph: 'e'
|
| + }
|
| + ];
|
| +
|
| + var m = makeModel(events);
|
| + assert(m.numProcesses, 1);
|
| + var p = m.processes[1];
|
| + assert.isDefined(p);
|
| + assert.equal(p.numThreads, 1);
|
| + var t = p.threads[2];
|
| + var asyncSliceGroup = t.asyncSliceGroup;
|
| + assert.equal(asyncSliceGroup.length, 2);
|
| + for (var i = 0; i < asyncSliceGroup.length; ++i) {
|
| + assert.isTrue(asyncSliceGroup.slices[i] instanceof MeasureAsyncSlice);
|
| + }
|
| +
|
| + var a1 = asyncSliceGroup.slices[0];
|
| + assert.equal(a1.viewSubGroupTitle, 'A');
|
| + assert.equal(a1.title, 'a1');
|
| + assert.equal(a1.subSlices.length, 0);
|
| + assert.deepEqual(a1.args, {a: 1});
|
| + var a2 = asyncSliceGroup.slices[1];
|
| + assert.equal(a2.viewSubGroupTitle, 'A');
|
| + assert.equal(a2.title, 'a2');
|
| + assert.equal(a2.subSlices.length, 0);
|
| + assert.deepEqual(a2.args, {a: 2, b: 2});
|
| + });
|
| +
|
| + test('UserTimingAsyncSlicesWithNormalAsyncSlices', function() {
|
| + if (tr.isHeadless)
|
| + return;
|
| + /**
|
| + * Structure of user timing async slices
|
| + *
|
| + * Group A:
|
| + *
|
| + * |__________|
|
| + * a1
|
| + * |__|
|
| + * a2
|
| + *
|
| + * B
|
| + * |__|
|
| + * B
|
| + * C
|
| + * |_|
|
| + * C
|
| + **/
|
| + var events = [
|
| + {
|
| + name: 'A:a1', args: {params: ''}, pid: 1, ts: 1,
|
| + cat: 'blink.user_timing', tid: 2, id: 3, ph: 'b'
|
| + },
|
| + {
|
| + name: 'A:a1', args: {params: ''}, pid: 1, ts: 11,
|
| + cat: 'blink.user_timing', tid: 2, id: 3, ph: 'e'
|
| + },
|
| + {
|
| + name: 'A:a2', args: {params: ''}, pid: 1, ts: 2,
|
| + cat: 'blink.user_timing', tid: 2, id: 4, ph: 'b'
|
| + },
|
| + {
|
| + name: 'A:a2', args: {params: ''}, pid: 1, ts: 4,
|
| + cat: 'blink.user_timing', tid: 2, id: 4, ph: 'e'
|
| + },
|
| + {
|
| + name: 'B', args: {}, pid: 1, ts: 9, cat: 'foo',
|
| + tid: 2, ph: 'b', id: 5
|
| + },
|
| + {
|
| + name: 'B', args: {}, pid: 1, ts: 11, cat: 'foo',
|
| + tid: 2, ph: 'e', id: 5
|
| + },
|
| + {
|
| + name: 'C', args: {}, pid: 1, ts: 12, cat: 'foo',
|
| + tid: 2, ph: 'b', id: 6
|
| + },
|
| + {
|
| + name: 'C', args: {}, pid: 1, ts: 13, cat: 'foo',
|
| + tid: 2, ph: 'e', id: 6
|
| + }
|
| + ];
|
| +
|
| + var m = makeModel(events);
|
| + assert(m.numProcesses, 1);
|
| + var p = m.processes[1];
|
| + assert.isDefined(p);
|
| + assert.equal(p.numThreads, 1);
|
| + var t = p.threads[2];
|
| + var asyncSliceGroup = t.asyncSliceGroup;
|
| + assert.equal(asyncSliceGroup.length, 3);
|
| + assert.isTrue(asyncSliceGroup.slices[0] instanceof MeasureAsyncSlice);
|
| + assert.isFalse(asyncSliceGroup.slices[1] instanceof MeasureAsyncSlice);
|
| + assert.isFalse(asyncSliceGroup.slices[2] instanceof MeasureAsyncSlice);
|
| +
|
| + var a1 = asyncSliceGroup.slices[0];
|
| + assert.equal(a1.viewSubGroupTitle, 'A');
|
| + assert.equal(a1.title, 'a1');
|
| + assert.equal(a1.subSlices.length, 1);
|
| + var a2 = a1.subSlices[0];
|
| + assert.equal(a2.viewSubGroupTitle, 'A');
|
| + assert.equal(a2.title, 'a2');
|
| + assert.equal(a2.subSlices.length, 0);
|
| + var B = asyncSliceGroup.slices[1];
|
| + assert.equal(B.viewSubGroupTitle, 'B');
|
| + assert.equal(B.title, 'B');
|
| + assert.equal(B.subSlices.length, 0);
|
| + var C = asyncSliceGroup.slices[2];
|
| + assert.equal(C.viewSubGroupTitle, 'C');
|
| + assert.equal(C.title, 'C');
|
| + assert.equal(C.subSlices.length, 0);
|
| + });
|
| +
|
| // TODO(nduca): one slice, two threads
|
| // TODO(nduca): one slice, two pids
|
|
|
|
|