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.irq_parser', function() { // @suppress longLineCheck
11  test('irqImport', function() {
12    var lines = [
13      ' kworker/u4:1-31907 (31907) [001] d.h3 14063.748288: ' +
14        'irq_handler_entry: irq=27 name=arch_timer',
15      ' kworker/u4:1-31907 (31907) [001] dNh3 14063.748384: ' +
16        'irq_handler_exit: irq=27 ret=handled',
17      ' kworker/u4:2-31908 (31908) [000] ..s3 14063.477231: ' +
18        'softirq_entry: vec=9 [action=RCU]',
19      ' kworker/u4:2-31908 (31908) [000] ..s3 14063.477246: ' +
20        'softirq_exit: vec=9 [action=RCU]',
21    ];
22    var m = new tracing.TraceModel(lines.join('\n'), false);
23    assertEquals(0, m.importErrors.length);
24
25    var threads = m.getAllThreads();
26    assertEquals(2, threads.length);
27
28    var threads = m.findAllThreadsNamed('irqs cpu 1');
29    assertEquals(1, threads.length);
30    assertEquals(1, threads[0].sliceGroup.length);
31
32    var threads = m.findAllThreadsNamed('softirq cpu 0');
33    assertEquals(1, threads.length);
34    assertEquals(1, threads[0].sliceGroup.length);
35  });
36});
37