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.
7 tvcm.require('tracing.test_utils');
8 tvcm.require('tracing.importer.linux_perf_importer');
10 tvcm.unittest.testSuite('tracing.importer.linux_perf.i915_parser_test', function() { // @suppress longLineCheck
11 test('i915Import', function() {
13 // NB: spliced from different traces; mismatched timestamps don't matter
14 ' chrome-1223 [000] 2784.773556: i915_gem_object_pwrite: ' +
15 'obj=ffff88013f13fc00, offset=0, len=2984',
16 ' chrome-1539 [000] 18420.677750: ' +
17 'i915_gem_object_change_domain: ' +
18 'obj=ffff8800a88d1400, read=44=>40, write=00=>40',
19 ' chrome-1539 [000] 18420.677759: i915_gem_object_fault: ' +
20 'obj=ffff8800a88d1400, GTT index=0 , writable',
21 ' X-964 [000] 2784.774864: i915_flip_request: ' +
22 'plane=0, obj=ffff88013f0b9a00',
23 ' <idle>-0 [000] 2784.788644: i915_flip_complete: ' +
24 'plane=0, obj=ffff88013f0b9a00',
25 ' chrome-1539 [001] 18420.681687: i915_gem_request_retire: ' +
26 'dev=0, ring=1, seqno=1178152',
27 ' chrome-1539 [000] 18422.955688: i915_gem_request_add: ' +
28 'dev=0, ring=1, seqno=1178364',
29 ' cat-21833 [000] 18422.956832: i915_gem_request_complete: ' +
30 'dev=0, ring=1, seqno=1178364',
31 ' X-1012 [001] 18420.682511: i915_gem_request_wait_begin: ' +
32 'dev=0, ring=4, seqno=1178156',
33 ' X-1012 [000] 18422.765707: i915_gem_request_wait_end: ' +
34 'dev=0, ring=4, seqno=1178359',
35 ' chrome-1539 [000] 18422.955655: i915_gem_ring_flush: ' +
36 'dev=0, ring=1, invalidate=001e, flush=0040',
37 ' chrome-1539 [000] 18422.955660: i915_gem_ring_dispatch: ' +
38 'dev=0, ring=1, seqno=1178364',
39 ' chrome-1539 [000] 18420.677772: i915_reg_rw: ' +
40 'write reg=0x100030, len=8, val=(0xfca9001, 0xfce8007)'
42 var m = new tracing.TraceModel(lines.join('\n'), false);
43 assertFalse(m.hasImportWarnings);
45 var i915GemThread = undefined;
46 var i915FlipThread = undefined;
47 var i915GemRingThread = undefined;
48 var i915RegThread = undefined;
49 m.getAllThreads().forEach(function(t) {
58 i915GemRingThread = t;
64 throw new unittest.TestError('Unexpected thread named ' + t.name);
67 assertNotUndefined(i915GemThread);
68 assertNotUndefined(i915FlipThread);
69 assertNotUndefined(i915GemRingThread);
70 assertNotUndefined(i915RegThread);
72 assertEquals(3, i915GemThread.sliceGroup.length);
74 assertEquals(1, i915FlipThread.sliceGroup.length);
76 assertAlmostEquals(2784.774864 * 1000.0,
77 i915FlipThread.sliceGroup.slices[0].start);
78 assertAlmostEquals((2784.788644 - 2784.774864) * 1000.0,
79 i915FlipThread.sliceGroup.slices[0].duration);
81 assertEquals(7, i915GemRingThread.sliceGroup.length);
82 assertEquals(1, i915RegThread.sliceGroup.length);