blob: 5d7dfd6752627649f48177ec1d07ea0aca2d6e8f [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
test('kernelFunctionParser', function() {
var lines = [
'Binder_2-127 ( 127) [001] .... 3431.906759: graph_ent: func=sys_write',
'Binder_2-127 ( 127) [001] .... 3431.906769: graph_ret: func=sys_write',
'Binder_2-127 ( 127) [001] .... 3431.906785: graph_ent: func=sys_write',
'Binder_2-127 ( 127) [001] ...1 3431.906798: tracing_mark_write: B|' +
'127|dequeueBuffer',
'Binder_2-127 ( 127) [001] .... 3431.906802: graph_ret: func=sys_write',
'Binder_2-127 ( 127) [001] .... 3431.906842: graph_ent: func=sys_write',
'Binder_2-127 ( 127) [001] ...1 3431.906849: tracing_mark_write: E',
'Binder_2-127 ( 127) [001] .... 3431.906853: graph_ret: func=sys_write',
'Binder_2-127 ( 127) [001] .... 3431.906896: graph_ent: func=sys_write',
'Binder_2-127 ( 127) [001] .... 3431.906906: graph_ret: func=sys_write'
];
var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
shiftWorldToZero: false
});
assert.isFalse(m.hasImportWarnings);
var process = m.processes[127];
assert.isDefined(process);
var thread = process.threads[127];
assert.isDefined(thread);
var slices = thread.sliceGroup.slices;
assert.equal(thread.sliceGroup.length, 7);
// Slice 0 is an un-split sys_write
assert.equal(slices[0].title, 'sys_write');
// Slices 1 & 3 are a split sys_write
assert.equal(slices[1].title, 'sys_write');
assert.equal(slices[2].title, 'dequeueBuffer');
assert.equal(slices[3].title, 'sys_write (cont.)');
// Slices 4 & 5 are a split sys_write with the dequeueBuffer in between
assert.equal(slices[4].title, 'sys_write');
assert.equal(slices[5].title, 'sys_write (cont.)');
// Slice 6 is another un-split sys_write
assert.equal(slices[6].title, 'sys_write');
});
});
</script>