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