1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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
.inputoutput
;
12 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
14 import java
.util
.HashSet
;
17 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.kernel
.KernelAnalysisModule
;
18 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelAnalysisEventLayout
;
19 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelTrace
;
20 import org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.inputoutput
.InputOutputStateProvider
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.IAnalysisModule
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
24 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceUtils
;
28 * State System Module for Input Output traces
30 * @author Houssem Daoud
33 public class InputOutputAnalysisModule
extends TmfStateSystemAnalysisModule
{
35 /** The ID of this analysis module */
36 public static final String ID
= "org.eclipse.tracecompass.analysis.os.linux.inputoutput"; //$NON-NLS-1$
39 protected ITmfStateProvider
createStateProvider() {
40 ITmfTrace trace
= checkNotNull(getTrace());
41 IKernelAnalysisEventLayout layout
;
43 if (trace
instanceof IKernelTrace
) {
44 layout
= ((IKernelTrace
) trace
).getKernelEventLayout();
46 /* Fall-back to the base LttngEventLayout */
47 layout
= IKernelAnalysisEventLayout
.DEFAULT_LAYOUT
;
50 return new InputOutputStateProvider(trace
, layout
);
54 protected StateSystemBackendType
getBackendType() {
55 return StateSystemBackendType
.FULL
;
59 protected Iterable
<IAnalysisModule
> getDependentAnalyses() {
60 Set
<IAnalysisModule
> modules
= new HashSet
<>();
62 ITmfTrace trace
= getTrace();
64 throw new IllegalStateException();
67 * This analysis depends on the LTTng kernel analysis, so it's added to
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
);