Home | History | Annotate | Download | only in src
      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>LinuxPerfMaliParser 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('linux_perf_importer');
     19 
     20 function testMaliDDKImport() {
     21   var lines = [
     22     // Row 1 open
     23     '           chrome-1780  [001] ...1   28.562633: tracing_mark_write: ' +
     24                 'mali_driver: cros_trace_print_enter: ' +
     25                 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c992: ' +
     26                 'glTexSubImage2D',
     27     // Row 2 open
     28     '           chrome-1780  [001] ...1   28.562655: tracing_mark_write: ' +
     29                 'mali_driver: cros_trace_print_enter: ' +
     30                 'gles/src/texture/mali_gles_texture_api.c996: ' +
     31                 'gles_texture_tex_sub_image_2d',
     32     // Row 3 open
     33     '            chrome-1780  [001] ...1   28.562671: tracing_mark_write: ' +
     34                 'mali_driver: cros_trace_print_enter: ' +
     35                 'gles/src/texture/mali_gles_texture_slave.c295: ' +
     36                 'gles_texturep_slave_map_master',
     37     // Row 3 close
     38     '           chrome-1780  [001] ...1   28.562684: tracing_mark_write: ' +
     39                 'mali_driver: cros_trace_print_exit: ' +
     40                 'gles/src/texture/mali_gles_texture_slave.c295: ',
     41     // Row 3 open
     42     '           chrome-1780  [001] ...1   28.562700: tracing_mark_write: ' +
     43                 'mali_driver: cros_trace_print_enter: ' +
     44                 'gles/src/texture/mali_gles_texture_slave.c1505: ' +
     45                 'gles2_texturep_upload_2d',
     46     // Row 4 open
     47     '           chrome-1780  [001] ...1   28.562726: tracing_mark_write: ' +
     48                 'mali_driver: cros_trace_print_enter: ' +
     49                 'gles/src/texture/mali_gles_texture_slave.c1612: ' +
     50                 'gles2_texturep_upload_2d: pixel array: wait for dependencies',
     51     // Row 5 open
     52     '           chrome-1780  [001] ...1   28.562742: tracing_mark_write: ' +
     53                 'mali_driver: cros_trace_print_enter: ' +
     54                 'cobj/src/mali_cobj_surface_operations.c1693: ' +
     55                 'cobj_convert_pixels_to_surface',
     56     // Row 6 open
     57     '           chrome-1780  [001] ...1   28.562776: tracing_mark_write: ' +
     58                 'mali_driver: cros_trace_print_enter: ' +
     59                 'cobj/src/mali_cobj_surface_operations.c1461: ' +
     60                 'cobj_convert_pixels',
     61     // Row 7 open
     62     '           chrome-1780  [001] ...1   28.562791: tracing_mark_write: ' +
     63                 'mali_driver: cros_trace_print_enter: ' +
     64                 'cobj/src/mali_cobj_surface_operations.c1505: ' +
     65                 'cobj_convert_pixels: fast-path linear copy',
     66     // Row 8 open
     67     '           chrome-1780  [001] ...1   28.562808: tracing_mark_write: ' +
     68                 'mali_driver: cros_trace_print_enter: ' +
     69                 'cobj/src/mali_cobj_surface_operations.c1511: ' +
     70                 'cobj_convert_pixels: reorder-only',
     71     // Row 8 close
     72     '           chrome-1780  [001] ...1   28.563383: tracing_mark_write: ' +
     73                 'mali_driver: cros_trace_print_exit: ' +
     74                 'cobj/src/mali_cobj_surface_operations.c1511',
     75     // Row 7 close
     76     '           chrome-1780  [001] ...1   28.563397: tracing_mark_write: ' +
     77                 'mali_driver: cros_trace_print_exit: ' +
     78                 'cobj/src/mali_cobj_surface_operations.c1505',
     79     // Row 6 close
     80     '           chrome-1780  [001] ...1   28.563409: tracing_mark_write: ' +
     81                 'mali_driver: cros_trace_print_exit: ' +
     82                 'cobj/src/mali_cobj_surface_operations.c1461',
     83     // Row 5 close
     84     '           chrome-1780  [001] ...1   28.563438: tracing_mark_write: ' +
     85                 'mali_driver: cros_trace_print_exit: ' +
     86                 'cobj/src/mali_cobj_surface_operations.c1693',
     87     // Row 4 close
     88     '           chrome-1780  [001] ...1   28.563451: tracing_mark_write: ' +
     89                 'mali_driver: cros_trace_print_exit: ' +
     90                 'gles/src/texture/mali_gles_texture_slave.c1612',
     91     // Row 3 close
     92     '           chrome-1780  [001] ...1   28.563462: tracing_mark_write: ' +
     93                 'mali_driver: cros_trace_print_exit: ' +
     94                 'gles/src/texture/mali_gles_texture_slave.c1505',
     95     // Row 2 close
     96     '           chrome-1780  [001] ...1   28.563475: tracing_mark_write: ' +
     97                 'mali_driver: cros_trace_print_exit: ' +
     98                 'gles/src/texture/mali_gles_texture_api.c996',
     99     // Row 1 close
    100     '           chrome-1780  [001] ...1   28.563486: tracing_mark_write: ' +
    101                 'mali_driver: cros_trace_print_exit: ' +
    102                 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c992'
    103   ];
    104   var m = new tracing.TimelineModel(lines.join('\n'), false);
    105   assertEquals(0, m.importErrors.length);
    106 
    107   var threads = m.getAllThreads();
    108   assertEquals(1, threads.length);
    109 
    110   var maliThread = threads[0];
    111   assertEquals('mali_ddk', maliThread.name);
    112   assertEquals(9, maliThread.slices.length);
    113 }
    114 
    115 function testDVFSFrequencyImport() {
    116   var lines = [
    117     '     kworker/u:0-5     [001] ....  1174.839552: mali_dvfs_set_clock: ' +
    118                    'frequency=266',
    119     '     kworker/u:0-5     [000] ....  1183.840486: mali_dvfs_set_clock: ' +
    120                    'frequency=400'
    121   ];
    122   var m = new tracing.TimelineModel(lines.join('\n'), false);
    123   assertEquals(0, m.importErrors.length);
    124 
    125   var c0 = m.cpus[0];
    126   assertEquals(0, c0.slices.length);
    127   assertEquals(2, c0.counters['DVFS Frequency'].samples.length);
    128 }
    129 
    130 function testDVFSVoltageImport() {
    131   var lines = [
    132     '     kworker/u:0-5     [001] ....  1174.839562: mali_dvfs_set_voltage: ' +
    133                    'voltage=937500',
    134     '     kworker/u:0-5     [000] ....  1183.840009: mali_dvfs_set_voltage: ' +
    135                    'voltage=1100000'
    136   ];
    137   var m = new tracing.TimelineModel(lines.join('\n'), false);
    138   assertEquals(0, m.importErrors.length);
    139 
    140   var c0 = m.cpus[0];
    141   assertEquals(0, c0.slices.length);
    142   assertEquals(2, c0.counters['DVFS Voltage'].samples.length);
    143 }
    144 
    145 function testDVFSUtilizationImport() {
    146   var lines = [
    147     '     kworker/u:0-5     [001] ....  1174.839552: mali_dvfs_event: ' +
    148                    'utilization=7',
    149     '     kworker/u:0-5     [000] ....  1183.840486: mali_dvfs_event: ' +
    150                    'utilization=37'
    151   ];
    152   var m = new tracing.TimelineModel(lines.join('\n'), false);
    153   assertEquals(0, m.importErrors.length);
    154 
    155   var c0 = m.cpus[0];
    156   assertEquals(0, c0.slices.length);
    157   assertEquals(2, c0.counters['DVFS Utilization'].samples.length);
    158 }
    159 
    160 </script>
    161 </body>
    162 </html>
    163