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
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
10 package org.eclipse.tracecompass.analysis.os.linux.core.tests.latency;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertNotNull;
14
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.trace.KernelCtfTraceStub;
17 import org.eclipse.tracecompass.internal.analysis.os.linux.core.latency.SystemCallLatencyAnalysis;
18 import org.eclipse.tracecompass.segmentstore.core.ISegment;
19 import org.eclipse.tracecompass.segmentstore.core.ISegmentStore;
20 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
21 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
22 import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
23 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
24 import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
25 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29
30 /**
31 * Tests for the system call analysis
32 *
33 * @author Matthew Khouzam
34 */
35 public class SyscallAnalysisTest {
36
37 private SystemCallLatencyAnalysis fSyscallModule;
38
39 /**
40 * Test setup
41 */
42 @Before
43 public void setUp() {
44 ITmfTrace trace = KernelCtfTraceStub.getTrace(CtfTestTrace.ARM_64_BIT_HEADER);
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.032032 seconds and 5 git commands to generate.