Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / trace_viewer / tracing / importer / linux_perf / i915_parser_test.html
1 <!DOCTYPE html>
2 <!--
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
5 found in the LICENSE file.
6 -->
7
8 <link rel="import" href="/tracing/test_utils.html">
9 <link rel="import" href="/tracing/importer/linux_perf_importer.html">
10
11 <script>
12 'use strict';
13
14 tv.unittest.testSuite(function() { // @suppress longLineCheck
15   test('i915Import', function() {
16     var lines = [
17       // NB: spliced from different traces; mismatched timestamps don't matter
18       '          chrome-1223  [000]  2784.773556: i915_gem_object_pwrite: ' +
19                  'obj=ffff88013f13fc00, offset=0, len=2984',
20       '          chrome-1539  [000] 18420.677750: ' +
21                  'i915_gem_object_change_domain: ' +
22                  'obj=ffff8800a88d1400, read=44=>40, write=00=>40',
23       '          chrome-1539  [000] 18420.677759: i915_gem_object_fault: ' +
24                  'obj=ffff8800a88d1400, GTT index=0 , writable',
25       '               X-964   [000]  2784.774864: i915_flip_request: ' +
26                  'plane=0, obj=ffff88013f0b9a00',
27       '          <idle>-0     [000]  2784.788644: i915_flip_complete: ' +
28                  'plane=0, obj=ffff88013f0b9a00',
29       '          chrome-1539  [001] 18420.681687: i915_gem_request_retire: ' +
30                  'dev=0, ring=1, seqno=1178152',
31       '          chrome-1539  [000] 18422.955688: i915_gem_request_add: ' +
32                  'dev=0, ring=1, seqno=1178364',
33       '             cat-21833 [000] 18422.956832: i915_gem_request_complete: ' +
34                  'dev=0, ring=1, seqno=1178364',
35       '             X-1012  [001] 18420.682511: i915_gem_request_wait_begin: ' +
36                  'dev=0, ring=4, seqno=1178156',
37       '               X-1012  [000] 18422.765707: i915_gem_request_wait_end: ' +
38                  'dev=0, ring=4, seqno=1178359',
39       '          chrome-1539  [000] 18422.955655: i915_gem_ring_flush: ' +
40                  'dev=0, ring=1, invalidate=001e, flush=0040',
41       '          chrome-1539  [000] 18422.955660: i915_gem_ring_dispatch: ' +
42                  'dev=0, ring=1, seqno=1178364',
43       '          chrome-1539  [000] 18420.677772: i915_reg_rw: ' +
44                  'write reg=0x100030, len=8, val=(0xfca9001, 0xfce8007)'
45     ];
46     var m = new tracing.TraceModel(lines.join('\n'), false);
47     assertFalse(m.hasImportWarnings);
48
49     var i915GemThread = undefined;
50     var i915FlipThread = undefined;
51     var i915GemRingThread = undefined;
52     var i915RegThread = undefined;
53     m.getAllThreads().forEach(function(t) {
54       switch (t.name) {
55         case 'i915_gem':
56           i915GemThread = t;
57           break;
58         case 'i915_flip':
59           i915FlipThread = t;
60           break;
61         case 'i915_gem_ring':
62           i915GemRingThread = t;
63           break;
64         case 'i915_reg':
65           i915RegThread = t;
66           break;
67         default:
68           throw new unittest.TestError('Unexpected thread named ' + t.name);
69       }
70     });
71     assertNotUndefined(i915GemThread);
72     assertNotUndefined(i915FlipThread);
73     assertNotUndefined(i915GemRingThread);
74     assertNotUndefined(i915RegThread);
75
76     assertEquals(3, i915GemThread.sliceGroup.length);
77
78     assertEquals(1, i915FlipThread.sliceGroup.length);
79
80     assertAlmostEquals(2784.774864 * 1000.0,
81         i915FlipThread.sliceGroup.slices[0].start);
82     assertAlmostEquals((2784.788644 - 2784.774864) * 1000.0,
83         i915FlipThread.sliceGroup.slices[0].duration);
84
85     assertEquals(7, i915GemRingThread.sliceGroup.length);
86     assertEquals(1, i915RegThread.sliceGroup.length);
87   });
88 });
89 </script>
90