summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html
blob: c27e7c65a93e5da356d06373acfc9713de970f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">

<script>
'use strict';

tr.b.unittest.testSuite(function() {
  function newModel(events) {
    return tr.c.TestUtils.newModelWithEvents([events], {
      shiftWorldToZero: false
    });
  }

  test('exynosBusfreqImport', function() {
    var lines = [
      '     kworker/1:0-4177  [001] ....  2803.129806: ' +
          'exynos_busfreq_target_int: frequency=200000',
      '     kworker/1:0-4177  [001] ....  2803.229207: ' +
          'exynos_busfreq_target_int: frequency=267000',
      '     kworker/1:0-4177  [001] ....  2803.329031: ' +
          'exynos_busfreq_target_int: frequency=160000',
      '     kworker/1:0-4177  [001] ....  2805.729039: ' +
          'exynos_busfreq_target_mif: frequency=200000'
    ];
    var m = newModel(lines.join('\n'));
    assert.isFalse(m.hasImportWarnings);

    var c0 = m.kernel.cpus[0];
    assert.equal(c0.slices.length, 0);
    assert.equal(c0.counters['.INT Frequency'].series[0].samples.length, 3);
    assert.equal(c0.counters['.MIF Frequency'].series[0].samples.length, 1);
  });

  test('exynosPageFlipSlowRequestImport', function() {
    var lines = [
      '          <idle>-0     [000] d.h. 1000.000000: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
      ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply',
      '     kworker/0:1-25931 [000] .... 1000.000002: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip',
      '     kworker/0:1-25931 [000] .... 1000.000003: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=flipped',
      '          <idle>-0     [000] d.h. 1000.000004: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
      ' Chrome_IOThread-21603 [000] d.h. 1000.000005: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
      '     kworker/0:1-25931 [000] .... 1000.000006: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip',
      '     kworker/0:1-25931 [000] .... 1000.000007: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=flipped'
    ];
    var m = newModel(lines.join('\n'));
    assert.isFalse(m.hasImportWarnings);

    var threads = m.getAllThreads();
    // there are 2 threads:
    //   (1) "exynos_flip_state (pipe:0, fb:25)"
    //   (2) "exynos_flip_state (pipe:0, fb:26)"
    assert.equal(threads.length, 2);

    // in the test data, event of fb=26 occurs first, so it's thread[0]
    var gfxFbId26Thread = threads[0]; // thread where fb == 26
    var gfxFbId25Thread = threads[1]; // thread where fb == 25
    assert.equal(gfxFbId25Thread.name, 'exynos_flip_state (pipe:0, fb:25)');
    assert.equal(gfxFbId26Thread.name, 'exynos_flip_state (pipe:0, fb:26)');
    // Every state (except for 'flipped') will start a new slice.
    // The last event will not be closed, so it's not a slice
    assert.equal(gfxFbId25Thread.sliceGroup.length, 3);
    assert.equal(gfxFbId26Thread.sliceGroup.length, 3);
  });

  test('exynosPageFlipFastRequestImport', function() {
    var lines = [
      '          <idle>-0     [000] d.h. 1000.000000: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
      ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
      '               X-21385 [000] .... 1000.000002: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply',
      '     kworker/0:1-25931 [000] .... 1000.000003: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip',
      '               X-21385 [001] .... 1000.000004: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
      '     kworker/0:1-25931 [000] .... 1000.000005: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=flipped',
      '          <idle>-0     [000] d.h. 1000.000006: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
      '               X-21385 [000] .... 1000.000007: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip',
      '     kworker/0:1-25931 [000] .... 1000.000008: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=flipped',
      '     kworker/0:1-25931 [000] .... 1000.000009: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
      ' Chrome_IOThread-21603 [000] d.h. 1000.000010: ' +
          'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
      '          <idle>-0     [000] d.h. 1000.000011: ' +
          'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply'
    ];
    var m = newModel(lines.join('\n'));
    assert.isFalse(m.hasImportWarnings);

    var threads = m.getAllThreads();
    // there are 2 threads:
    //   (1) "exynos_flip_state (pipe:0, fb:25)"
    //   (2) "exynos_flip_state (pipe:0, fb:26)"
    assert.equal(threads.length, 2);

    // in the test data, event of fb=26 occurs first, so it's thread[0]
    var gfxFbId26Thread = threads[0]; // thread where fb == 26
    var gfxFbId25Thread = threads[1]; // thread where fb == 25
    assert.equal(gfxFbId25Thread.name, 'exynos_flip_state (pipe:0, fb:25)');
    assert.equal(gfxFbId26Thread.name, 'exynos_flip_state (pipe:0, fb:26)');
    // Every state (except for 'flipped') will start a new slice.
    // The last event will not be closed, so it's not a slice
    assert.equal(gfxFbId25Thread.sliceGroup.length, 4);
    assert.equal(gfxFbId26Thread.sliceGroup.length, 4);
  });
});
</script>