Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
913e4cd0 MK |
15 | import org.eclipse.jdt.annotation.NonNull; |
16 | import org.eclipse.tracecompass.analysis.os.linux.core.latency.SystemCallLatencyAnalysis; | |
913e4cd0 MK |
17 | import org.eclipse.tracecompass.segmentstore.core.ISegment; |
18 | import org.eclipse.tracecompass.segmentstore.core.ISegmentStore; | |
19 | import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace; | |
20 | import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; | |
913e4cd0 MK |
21 | import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal; |
22 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | |
23 | import org.eclipse.tracecompass.tmf.core.trace.TmfTrace; | |
24 | import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; | |
913e4cd0 MK |
25 | import org.junit.After; |
26 | import org.junit.Before; | |
27 | import org.junit.Test; | |
28 | ||
29 | /** | |
30 | * Tests for the system call analysis | |
31 | * | |
32 | * @author Matthew Khouzam | |
33 | */ | |
34 | public class SyscallAnalysisTest { | |
35 | ||
913e4cd0 MK |
36 | private SystemCallLatencyAnalysis fSyscallModule; |
37 | ||
38 | /** | |
39 | * Test setup | |
40 | */ | |
41 | @Before | |
42 | public void setUp() { | |
3a676d86 | 43 | ITmfTrace trace = KernelCtfTraceStub.getTrace(CtfTestTrace.ARM_64_BIT_HEADER); |
913e4cd0 MK |
44 | /* Make sure the Kernel analysis has run */ |
45 | ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null)); | |
46 | for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, SystemCallLatencyAnalysis.class)) { | |
47 | fSyscallModule = (SystemCallLatencyAnalysis) mod; | |
48 | } | |
49 | assertNotNull(fSyscallModule); | |
50 | fSyscallModule.schedule(); | |
51 | fSyscallModule.waitForCompletion(); | |
52 | } | |
53 | ||
54 | /** | |
55 | * Dispose everything | |
56 | */ | |
57 | @After | |
58 | public void cleanup() { | |
59 | final SystemCallLatencyAnalysis syscallModule = fSyscallModule; | |
60 | if( syscallModule != null) { | |
61 | syscallModule.dispose(); | |
62 | } | |
63 | } | |
64 | ||
65 | /** | |
66 | * This will load the analysis and test it. as it depends on Kernel, this | |
67 | * test runs the kernel trace first then the analysis | |
68 | */ | |
69 | @Test | |
70 | public void testSmallTraceSequential() { | |
71 | final SystemCallLatencyAnalysis syscallModule = fSyscallModule; | |
72 | assertNotNull(syscallModule); | |
73 | ISegmentStore<@NonNull ISegment> segmentStore = syscallModule.getSegmentStore(); | |
74 | assertNotNull(segmentStore); | |
75 | assertEquals(1801, segmentStore.size()); | |
76 | } | |
77 | } |