Chris Craik | b2cbf15 | 2015-07-28 16:26:29 -0700 | [diff] [blame^] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 4 | Use of this source code is governed by a BSD-style license that can be |
| 5 | found in the LICENSE file. |
| 6 | --> |
| 7 | |
| 8 | <link rel="import" href="/core/test_utils.html"> |
| 9 | <link rel="import" href="/extras/importer/linux_perf/ftrace_importer.html"> |
| 10 | |
| 11 | <script> |
| 12 | 'use strict'; |
| 13 | |
| 14 | tr.b.unittest.testSuite(function() { // @suppress longLineCheck |
| 15 | test('kernelFunctionParser', function() { |
| 16 | var lines = [ |
| 17 | 'Binder_2-127 ( 127) [001] .... 3431.906759: graph_ent: func=sys_write', |
| 18 | 'Binder_2-127 ( 127) [001] .... 3431.906769: graph_ret: func=sys_write', |
| 19 | 'Binder_2-127 ( 127) [001] .... 3431.906785: graph_ent: func=sys_write', |
| 20 | 'Binder_2-127 ( 127) [001] ...1 3431.906798: tracing_mark_write: B|' + |
| 21 | '127|dequeueBuffer', |
| 22 | 'Binder_2-127 ( 127) [001] .... 3431.906802: graph_ret: func=sys_write', |
| 23 | 'Binder_2-127 ( 127) [001] .... 3431.906842: graph_ent: func=sys_write', |
| 24 | 'Binder_2-127 ( 127) [001] ...1 3431.906849: tracing_mark_write: E', |
| 25 | 'Binder_2-127 ( 127) [001] .... 3431.906853: graph_ret: func=sys_write', |
| 26 | 'Binder_2-127 ( 127) [001] .... 3431.906896: graph_ent: func=sys_write', |
| 27 | 'Binder_2-127 ( 127) [001] .... 3431.906906: graph_ret: func=sys_write' |
| 28 | ]; |
| 29 | var m = new tr.Model(lines.join('\n'), false); |
| 30 | assert.isFalse(m.hasImportWarnings); |
| 31 | |
| 32 | var process = m.processes[127]; |
| 33 | assert.isDefined(process); |
| 34 | |
| 35 | var thread = process.threads[127]; |
| 36 | assert.isDefined(thread); |
| 37 | |
| 38 | var slices = thread.sliceGroup.slices; |
| 39 | assert.equal(thread.sliceGroup.length, 7); |
| 40 | |
| 41 | // Slice 0 is an un-split sys_write |
| 42 | assert.equal(slices[0].title, 'sys_write'); |
| 43 | |
| 44 | // Slices 1 & 3 are a split sys_write |
| 45 | assert.equal(slices[1].title, 'sys_write'); |
| 46 | assert.equal(slices[2].title, 'dequeueBuffer'); |
| 47 | assert.equal(slices[3].title, 'sys_write (cont.)'); |
| 48 | |
| 49 | // Slices 4 & 5 are a split sys_write with the dequeueBuffer in between |
| 50 | assert.equal(slices[4].title, 'sys_write'); |
| 51 | assert.equal(slices[5].title, 'sys_write (cont.)'); |
| 52 | |
| 53 | // Slice 6 is another un-split sys_write |
| 54 | assert.equal(slices[6].title, 'sys_write'); |
| 55 | }); |
| 56 | }); |
| 57 | </script> |
| 58 | |