1 <!DOCTYPE html> 2 <html> 3 <!-- 4 Copyright (c) 2013 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.KernelFuncParser 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 testKernelFunctionParser() { 21 var lines = [ 22 'Binder_2-127 ( 127) [001] .... 3431.906759: graph_ent: func=sys_write', 23 'Binder_2-127 ( 127) [001] .... 3431.906769: graph_ret: func=sys_write', 24 'Binder_2-127 ( 127) [001] .... 3431.906785: graph_ent: func=sys_write', 25 'Binder_2-127 ( 127) [001] ...1 3431.906798: tracing_mark_write: B|' + 26 '127|dequeueBuffer', 27 'Binder_2-127 ( 127) [001] .... 3431.906802: graph_ret: func=sys_write', 28 'Binder_2-127 ( 127) [001] .... 3431.906842: graph_ent: func=sys_write', 29 'Binder_2-127 ( 127) [001] ...1 3431.906849: tracing_mark_write: E', 30 'Binder_2-127 ( 127) [001] .... 3431.906853: graph_ret: func=sys_write', 31 'Binder_2-127 ( 127) [001] .... 3431.906896: graph_ent: func=sys_write', 32 'Binder_2-127 ( 127) [001] .... 3431.906906: graph_ret: func=sys_write' 33 ]; 34 var m = new tracing.Model(lines.join('\n'), false); 35 assertEquals(0, m.importErrors.length); 36 console.log(m); 37 38 var process = m.processes[127]; 39 assertNotNull(process); 40 41 var thread = process.threads[127]; 42 assertNotNull(thread); 43 44 var slices = thread.slices; 45 assertEquals(7, thread.slices.length); 46 47 // Slice 0 is an un-split sys_write 48 assertEquals("sys_write", slices[0].title); 49 50 // Slices 1 & 2 are a split sys_write 51 assertEquals("sys_write", slices[1].title); 52 assertEquals("sys_write (cont.)", slices[2].title); 53 54 // Slices 3 & 5 are a split sys_write with the dequeueBuffer in between 55 assertEquals("sys_write", slices[3].title); 56 assertEquals("dequeueBuffer", slices[4].title); 57 assertEquals("sys_write (cont.)", slices[5].title); 58 59 // Slice 6 is another un-split sys_write 60 assertEquals("sys_write", slices[6].title); 61 } 62 63 </script> 64 </body> 65 </html> 66