1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.tests
.latency
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertNotNull
;
15 import org
.eclipse
.jdt
.annotation
.NonNull
;
16 import org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.latency
.SystemCallLatencyAnalysis
;
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
;
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
;
25 import org
.junit
.After
;
26 import org
.junit
.Before
;
27 import org
.junit
.Test
;
30 * Tests for the system call analysis
32 * @author Matthew Khouzam
34 public class SyscallAnalysisTest
{
36 private SystemCallLatencyAnalysis fSyscallModule
;
43 ITmfTrace trace
= KernelCtfTraceStub
.getTrace(CtfTestTrace
.ARM_64_BIT_HEADER
);
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
;
49 assertNotNull(fSyscallModule
);
50 fSyscallModule
.schedule();
51 fSyscallModule
.waitForCompletion();
58 public void cleanup() {
59 final SystemCallLatencyAnalysis syscallModule
= fSyscallModule
;
60 if( syscallModule
!= null) {
61 syscallModule
.dispose();
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
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());