Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / tracing / importer / linux_perf / exynos_parser_test.js
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 tvcm.require('tracing.test_utils');
8 tvcm.require('tracing.importer.linux_perf_importer');
9
10 tvcm.unittest.testSuite('tracing.importer.linux_perf.exynos_parser_test',
11                         function() {
12
13       test('exynosBusfreqImport', function() {
14         var lines = [
15           '     kworker/1:0-4177  [001] ....  2803.129806: ' +
16               'exynos_busfreq_target_int: frequency=200000',
17           '     kworker/1:0-4177  [001] ....  2803.229207: ' +
18               'exynos_busfreq_target_int: frequency=267000',
19           '     kworker/1:0-4177  [001] ....  2803.329031: ' +
20               'exynos_busfreq_target_int: frequency=160000',
21           '     kworker/1:0-4177  [001] ....  2805.729039: ' +
22               'exynos_busfreq_target_mif: frequency=200000'
23         ];
24         var m = new tracing.TraceModel(lines.join('\n'), false);
25         assertFalse(m.hasImportWarnings);
26
27         var c0 = m.kernel.cpus[0];
28         assertEquals(0, c0.slices.length);
29         assertEquals(3, c0.counters['INT Frequency'].series[0].samples.length);
30         assertEquals(1, c0.counters['MIF Frequency'].series[0].samples.length);
31       });
32
33       test('exynosPageFlipSlowRequestImport', function() {
34         var lines = [
35           '          <idle>-0     [000] d.h. 1000.000000: ' +
36               'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
37           ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' +
38               'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply',
39           '     kworker/0:1-25931 [000] .... 1000.000002: ' +
40               'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip',
41           '     kworker/0:1-25931 [000] .... 1000.000003: ' +
42               'exynos_page_flip_state: pipe=0, fb=26, state=flipped',
43           '          <idle>-0     [000] d.h. 1000.000004: ' +
44               'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
45           ' Chrome_IOThread-21603 [000] d.h. 1000.000005: ' +
46               'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
47           '     kworker/0:1-25931 [000] .... 1000.000006: ' +
48               'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip',
49           '     kworker/0:1-25931 [000] .... 1000.000007: ' +
50               'exynos_page_flip_state: pipe=0, fb=25, state=flipped'
51         ];
52         var m = new tracing.TraceModel(lines.join('\n'), false);
53         assertFalse(m.hasImportWarnings);
54
55         var threads = m.getAllThreads();
56         // there are 2 threads:
57         //   (1) "exynos_flip_state (pipe:0, fb:25)"
58         //   (2) "exynos_flip_state (pipe:0, fb:26)"
59         assertEquals(2, threads.length);
60
61         // in the test data, event of fb=26 occurs first, so it's thread[0]
62         var gfxFbId26Thread = threads[0]; // thread where fb == 26
63         var gfxFbId25Thread = threads[1]; // thread where fb == 25
64         assertEquals('exynos_flip_state (pipe:0, fb:25)', gfxFbId25Thread.name);
65         assertEquals('exynos_flip_state (pipe:0, fb:26)', gfxFbId26Thread.name);
66         // Every state (except for 'flipped') will start a new slice.
67         // The last event will not be closed, so it's not a slice
68         assertEquals(3, gfxFbId25Thread.sliceGroup.length);
69         assertEquals(3, gfxFbId26Thread.sliceGroup.length);
70       });
71
72       test('exynosPageFlipFastRequestImport', function() {
73         var lines = [
74           '          <idle>-0     [000] d.h. 1000.000000: ' +
75               'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
76           ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' +
77               'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
78           '               X-21385 [000] .... 1000.000002: ' +
79               'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply',
80           '     kworker/0:1-25931 [000] .... 1000.000003: ' +
81               'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip',
82           '               X-21385 [001] .... 1000.000004: ' +
83               'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
84           '     kworker/0:1-25931 [000] .... 1000.000005: ' +
85               'exynos_page_flip_state: pipe=0, fb=26, state=flipped',
86           '          <idle>-0     [000] d.h. 1000.000006: ' +
87               'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
88           '               X-21385 [000] .... 1000.000007: ' +
89               'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip',
90           '     kworker/0:1-25931 [000] .... 1000.000008: ' +
91               'exynos_page_flip_state: pipe=0, fb=25, state=flipped',
92           '     kworker/0:1-25931 [000] .... 1000.000009: ' +
93               'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
94           ' Chrome_IOThread-21603 [000] d.h. 1000.000010: ' +
95               'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
96           '          <idle>-0     [000] d.h. 1000.000011: ' +
97               'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply'
98         ];
99         var m = new tracing.TraceModel(lines.join('\n'), false);
100         assertFalse(m.hasImportWarnings);
101
102         var threads = m.getAllThreads();
103         // there are 2 threads:
104         //   (1) "exynos_flip_state (pipe:0, fb:25)"
105         //   (2) "exynos_flip_state (pipe:0, fb:26)"
106         assertEquals(2, threads.length);
107
108         // in the test data, event of fb=26 occurs first, so it's thread[0]
109         var gfxFbId26Thread = threads[0]; // thread where fb == 26
110         var gfxFbId25Thread = threads[1]; // thread where fb == 25
111         assertEquals('exynos_flip_state (pipe:0, fb:25)', gfxFbId25Thread.name);
112         assertEquals('exynos_flip_state (pipe:0, fb:26)', gfxFbId26Thread.name);
113         // Every state (except for 'flipped') will start a new slice.
114         // The last event will not be closed, so it's not a slice
115         assertEquals(4, gfxFbId25Thread.sliceGroup.length);
116         assertEquals(4, gfxFbId26Thread.sliceGroup.length);
117       });
118     });