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. 4 5'use strict'; 6 7base.require('tracing.test_utils'); 8base.require('tracing.importer.linux_perf_importer'); 9 10base.unittest.testSuite('tracing.importer.linux_perf.kfunc_parser', function() { 11 test('kernelFunctionParser', function() { 12 var lines = [ 13 'Binder_2-127 ( 127) [001] .... 3431.906759: graph_ent: func=sys_write', 14 'Binder_2-127 ( 127) [001] .... 3431.906769: graph_ret: func=sys_write', 15 'Binder_2-127 ( 127) [001] .... 3431.906785: graph_ent: func=sys_write', 16 'Binder_2-127 ( 127) [001] ...1 3431.906798: tracing_mark_write: B|' + 17 '127|dequeueBuffer', 18 'Binder_2-127 ( 127) [001] .... 3431.906802: graph_ret: func=sys_write', 19 'Binder_2-127 ( 127) [001] .... 3431.906842: graph_ent: func=sys_write', 20 'Binder_2-127 ( 127) [001] ...1 3431.906849: tracing_mark_write: E', 21 'Binder_2-127 ( 127) [001] .... 3431.906853: graph_ret: func=sys_write', 22 'Binder_2-127 ( 127) [001] .... 3431.906896: graph_ent: func=sys_write', 23 'Binder_2-127 ( 127) [001] .... 3431.906906: graph_ret: func=sys_write' 24 ]; 25 var m = new tracing.TraceModel(lines.join('\n'), false); 26 assertEquals(0, m.importErrors.length); 27 28 var process = m.processes[127]; 29 assertNotNull(process); 30 31 var thread = process.threads[127]; 32 assertNotNull(thread); 33 34 var slices = thread.sliceGroup.slices; 35 assertEquals(7, thread.sliceGroup.length); 36 37 // Slice 0 is an un-split sys_write 38 assertEquals('sys_write', slices[0].title); 39 40 // Slices 1 & 2 are a split sys_write 41 assertEquals('sys_write', slices[1].title); 42 assertEquals('sys_write (cont.)', slices[2].title); 43 44 // Slices 3 & 5 are a split sys_write with the dequeueBuffer in between 45 assertEquals('sys_write', slices[3].title); 46 assertEquals('dequeueBuffer', slices[4].title); 47 assertEquals('sys_write (cont.)', slices[5].title); 48 49 // Slice 6 is another un-split sys_write 50 assertEquals('sys_write', slices[6].title); 51 }); 52}); 53