Home | History | Annotate | Download | only in linux_perf
      1 <!DOCTYPE html>
      2 <html>
      3 <!--
      4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
      5 Use of this source code is governed by a BSD-style license that can be
      6 found in the LICENSE file.
      7 -->
      8 <head>
      9 <title>importer.linux_perf.I915Parser tests</title>
     10 <script src="../../base.js"></script>
     11 </head>
     12 <body>
     13 <script>
     14 'use strict';
     15 
     16 base.require('unittest');
     17 base.require('test_utils');
     18 base.require('importer.linux_perf_importer');
     19 
     20 function testi915Import() {
     21   var lines = [
     22     // NB: spliced from different traces; mismatched timestamps don't matter
     23     '          chrome-1223  [000]  2784.773556: i915_gem_object_pwrite: ' +
     24                'obj=ffff88013f13fc00, offset=0, len=2984',
     25     '          chrome-1539  [000] 18420.677750: ' +
     26                'i915_gem_object_change_domain: ' +
     27                'obj=ffff8800a88d1400, read=44=>40, write=00=>40',
     28     '          chrome-1539  [000] 18420.677759: i915_gem_object_fault: ' +
     29                'obj=ffff8800a88d1400, GTT index=0 , writable',
     30     '               X-964   [000]  2784.774864: i915_flip_request: ' +
     31                'plane=0, obj=ffff88013f0b9a00',
     32     '          <idle>-0     [000]  2784.788644: i915_flip_complete: ' +
     33                'plane=0, obj=ffff88013f0b9a00',
     34     '          chrome-1539  [001] 18420.681687: i915_gem_request_retire: ' +
     35                'dev=0, ring=1, seqno=1178152',
     36     '          chrome-1539  [000] 18422.955688: i915_gem_request_add: ' +
     37                'dev=0, ring=1, seqno=1178364',
     38     '             cat-21833 [000] 18422.956832: i915_gem_request_complete: ' +
     39                'dev=0, ring=1, seqno=1178364',
     40     '               X-1012  [001] 18420.682511: i915_gem_request_wait_begin: ' +
     41                'dev=0, ring=4, seqno=1178156',
     42     '               X-1012  [000] 18422.765707: i915_gem_request_wait_end: ' +
     43                'dev=0, ring=4, seqno=1178359',
     44     '          chrome-1539  [000] 18422.955655: i915_gem_ring_flush: ' +
     45                'dev=0, ring=1, invalidate=001e, flush=0040',
     46     '          chrome-1539  [000] 18422.955660: i915_gem_ring_dispatch: ' +
     47                'dev=0, ring=1, seqno=1178364',
     48     '          chrome-1539  [000] 18420.677772: i915_reg_rw: ' +
     49                'write reg=0x100030, len=8, val=(0xfca9001, 0xfce8007)'
     50   ];
     51   var m = new tracing.Model(lines.join('\n'), false);
     52   assertEquals(0, m.importErrors.length);
     53 
     54   var i915GemThread = undefined;
     55   var i915FlipThread = undefined;
     56   var i915GemRingThread = undefined;
     57   var i915RegThread = undefined;
     58   m.getAllThreads().forEach(function(t) {
     59     switch (t.name) {
     60     case 'i915_gem':
     61       i915GemThread = t;
     62       break;
     63     case 'i915_flip':
     64       i915FlipThread = t;
     65       break;
     66     case 'i915_gem_ring':
     67       i915GemRingThread = t;
     68       break;
     69     case 'i915_reg':
     70       i915RegThread = t;
     71       break;
     72     default:
     73       throw new unittest.TestError('Unexpected thread named ' + t.name);
     74     }
     75   });
     76   assertNotUndefined(i915GemThread);
     77   assertNotUndefined(i915FlipThread);
     78   assertNotUndefined(i915GemRingThread);
     79   assertNotUndefined(i915RegThread);
     80 
     81   assertEquals(3, i915GemThread.slices.length);
     82 
     83   assertEquals(1, i915FlipThread.slices.length);
     84 
     85   assertAlmostEquals(2784.774864 * 1000.0,
     86       i915FlipThread.slices[0].start);
     87   assertAlmostEquals((2784.788644 - 2784.774864) * 1000.0,
     88       i915FlipThread.slices[0].duration);
     89 
     90   assertEquals(7, i915GemRingThread.slices.length);
     91 
     92   assertEquals(1, i915RegThread.slices.length);
     93 }
     94 
     95 </script>
     96 </body>
     97 </html>
     98