os.linux: Do not define the default kernel layout in the interface
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / analysis / os / linux / core / inputoutput / InputOutputAnalysisModule.java
CommitLineData
6d02c5c1
HD
1/*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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.inputoutput;
11
12import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
13
14import java.util.HashSet;
15import java.util.Set;
16
17import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
aa38ac17 18import org.eclipse.tracecompass.analysis.os.linux.core.trace.DefaultEventLayout;
6d02c5c1
HD
19import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
20import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
21import org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.InputOutputStateProvider;
22import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
23import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
24import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
25import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
26import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
27
28/**
29 * State System Module for Input Output traces
30 *
31 * @author Houssem Daoud
32 * @since 2.0
33 */
34public class InputOutputAnalysisModule extends TmfStateSystemAnalysisModule {
35
36 /** The ID of this analysis module */
37 public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.inputoutput"; //$NON-NLS-1$
38
39 @Override
40 protected ITmfStateProvider createStateProvider() {
41 ITmfTrace trace = checkNotNull(getTrace());
42 IKernelAnalysisEventLayout layout;
43
44 if (trace instanceof IKernelTrace) {
45 layout = ((IKernelTrace) trace).getKernelEventLayout();
46 } else {
47 /* Fall-back to the base LttngEventLayout */
aa38ac17 48 layout = DefaultEventLayout.getInstance();
6d02c5c1
HD
49 }
50
51 return new InputOutputStateProvider(trace, layout);
52 }
53
54 @Override
55 protected StateSystemBackendType getBackendType() {
56 return StateSystemBackendType.FULL;
57 }
58
59 @Override
60 protected Iterable<IAnalysisModule> getDependentAnalyses() {
61 Set<IAnalysisModule> modules = new HashSet<>();
62
63 ITmfTrace trace = getTrace();
64 if (trace == null) {
65 throw new IllegalStateException();
66 }
67 /*
68 * This analysis depends on the LTTng kernel analysis, so it's added to
69 * dependent modules.
70 */
71 Iterable<KernelAnalysisModule> kernelModules = TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class);
72 for (KernelAnalysisModule kernelModule : kernelModules) {
73 /* Only add the first one we find, if there is one */
74 modules.add(kernelModule);
75 break;
76 }
77 return modules;
78 }
79
80}
This page took 0.026735 seconds and 5 git commands to generate.