kfunc_parser_test.html revision 46b43bff003ceda46cf9a5d40a47f7674996d2e0
1<!DOCTYPE html>
2<!--
3Copyright (c) 2013 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/tracing/core/test_utils.html">
9<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
10
11<script>
12'use strict';
13
14tr.b.unittest.testSuite(function() { // @suppress longLineCheck
15  test('kernelFunctionParser', function() {
16    var lines = [
17      'Binder_2-127  ( 127) [001] ....  3431.906759: graph_ent: func=sys_write',
18      'Binder_2-127  ( 127) [001] ....  3431.906769: graph_ret: func=sys_write',
19      'Binder_2-127  ( 127) [001] ....  3431.906785: graph_ent: func=sys_write',
20      'Binder_2-127  ( 127) [001] ...1  3431.906798: tracing_mark_write: B|' +
21          '127|dequeueBuffer',
22      'Binder_2-127  ( 127) [001] ....  3431.906802: graph_ret: func=sys_write',
23      'Binder_2-127  ( 127) [001] ....  3431.906842: graph_ent: func=sys_write',
24      'Binder_2-127  ( 127) [001] ...1  3431.906849: tracing_mark_write: E',
25      'Binder_2-127  ( 127) [001] ....  3431.906853: graph_ret: func=sys_write',
26      'Binder_2-127  ( 127) [001] ....  3431.906896: graph_ent: func=sys_write',
27      'Binder_2-127  ( 127) [001] ....  3431.906906: graph_ret: func=sys_write'
28    ];
29    var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
30      shiftWorldToZero: false
31    });
32    assert.isFalse(m.hasImportWarnings);
33
34    var process = m.processes[127];
35    assert.isDefined(process);
36
37    var thread = process.threads[127];
38    assert.isDefined(thread);
39
40    var slices = thread.sliceGroup.slices;
41    assert.equal(thread.sliceGroup.length, 7);
42
43    // Slice 0 is an un-split sys_write
44    assert.equal(slices[0].title, 'sys_write');
45
46    // Slices 1 & 3 are a split sys_write
47    assert.equal(slices[1].title, 'sys_write');
48    assert.equal(slices[2].title, 'dequeueBuffer');
49    assert.equal(slices[3].title, 'sys_write (cont.)');
50
51    // Slices 4 & 5 are a split sys_write with the dequeueBuffer in between
52    assert.equal(slices[4].title, 'sys_write');
53    assert.equal(slices[5].title, 'sys_write (cont.)');
54
55    // Slice 6 is another un-split sys_write
56    assert.equal(slices[6].title, 'sys_write');
57  });
58});
59</script>
60
61