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.workqueue_parser', function() { // @suppress longLineCheck
11  test('workQueueImport', function() {
12    var lines = [
13      ' kworker/0:3-6880  [000]  2784.771958: workqueue_execute_start: ' +
14                 'work struct ffff8800a5083a20: function intel_unpin_work_fn',
15      ' kworker/0:3-6880  [000]  2784.771966: workqueue_execute_end: ' +
16                 'work struct ffff8800a5083a20',
17      ' kworker/1:2-7269  [001]  2784.805966: workqueue_execute_start: ' +
18                 'work struct ffff88014fb0f158: function do_dbs_timer',
19      ' kworker/1:2-7269  [001]  2784.805975: workqueue_execute_end: ' +
20                 'work struct ffff88014fb0f158'
21    ];
22    var m = new tracing.TraceModel(lines.join('\n'), false);
23    assertEquals(0, m.importErrors.length);
24
25    assertEquals(1, m.processes['6880'].threads['6880'].sliceGroup.length);
26    assertEquals(1, m.processes['7269'].threads['7269'].sliceGroup.length);
27  });
28});
29