os.linux: Make KernelCtfTraceStub public
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core.tests / src / org / eclipse / tracecompass / analysis / os / linux / core / tests / latency / SyscallAnalysisTest.java
CommitLineData
913e4cd0
MK
1/*******************************************************************************
2 * Copyright (c) 2016 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10package org.eclipse.tracecompass.analysis.os.linux.core.tests.latency;
11
12import static org.junit.Assert.assertEquals;
13import static org.junit.Assert.assertNotNull;
14
913e4cd0 15import org.eclipse.jdt.annotation.NonNull;
4bf167e7 16import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.KernelCtfTraceStub;
97a06f36 17import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
913e4cd0
MK
18import org.eclipse.tracecompass.segmentstore.core.ISegment;
19import org.eclipse.tracecompass.segmentstore.core.ISegmentStore;
20import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
21import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
913e4cd0
MK
22import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
23import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
24import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
25import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
913e4cd0
MK
26import org.junit.After;
27import org.junit.Before;
28import org.junit.Test;
29
30/**
31 * Tests for the system call analysis
32 *
33 * @author Matthew Khouzam
34 */
35public class SyscallAnalysisTest {
36
913e4cd0
MK
37 private SystemCallLatencyAnalysis fSyscallModule;
38
39 /**
40 * Test setup
41 */
42 @Before
43 public void setUp() {
3a676d86 44 ITmfTrace trace = KernelCtfTraceStub.getTrace(CtfTestTrace.ARM_64_BIT_HEADER);
913e4cd0
MK
45 /* Make sure the Kernel analysis has run */
46 ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null));
47 for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, SystemCallLatencyAnalysis.class)) {
48 fSyscallModule = (SystemCallLatencyAnalysis) mod;
49 }
50 assertNotNull(fSyscallModule);
51 fSyscallModule.schedule();
52 fSyscallModule.waitForCompletion();
53 }
54
55 /**
56 * Dispose everything
57 */
58 @After
59 public void cleanup() {
60 final SystemCallLatencyAnalysis syscallModule = fSyscallModule;
61 if( syscallModule != null) {
62 syscallModule.dispose();
63 }
64 }
65
66 /**
67 * This will load the analysis and test it. as it depends on Kernel, this
68 * test runs the kernel trace first then the analysis
69 */
70 @Test
71 public void testSmallTraceSequential() {
72 final SystemCallLatencyAnalysis syscallModule = fSyscallModule;
73 assertNotNull(syscallModule);
74 ISegmentStore<@NonNull ISegment> segmentStore = syscallModule.getSegmentStore();
75 assertNotNull(segmentStore);
76 assertEquals(1801, segmentStore.size());
77 }
78}
This page took 0.030401 seconds and 5 git commands to generate.