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
.DefaultEventLayout
;
19 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelAnalysisEventLayout
;
20 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelTrace
;
21 import org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.inputoutput
.InputOutputStateProvider
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.IAnalysisModule
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
24 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
26 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceUtils
;
29 * State System Module for Input Output traces
31 * @author Houssem Daoud
34 public class InputOutputAnalysisModule
extends TmfStateSystemAnalysisModule
{
36 /** The ID of this analysis module */
37 public static final String ID
= "org.eclipse.tracecompass.analysis.os.linux.inputoutput"; //$NON-NLS-1$
40 protected ITmfStateProvider
createStateProvider() {
41 ITmfTrace trace
= checkNotNull(getTrace());
42 IKernelAnalysisEventLayout layout
;
44 if (trace
instanceof IKernelTrace
) {
45 layout
= ((IKernelTrace
) trace
).getKernelEventLayout();
47 /* Fall-back to the base LttngEventLayout */
48 layout
= DefaultEventLayout
.getInstance();
51 return new InputOutputStateProvider(trace
, layout
);
55 protected StateSystemBackendType
getBackendType() {
56 return StateSystemBackendType
.FULL
;
60 protected Iterable
<IAnalysisModule
> getDependentAnalyses() {
61 Set
<IAnalysisModule
> modules
= new HashSet
<>();
63 ITmfTrace trace
= getTrace();
65 throw new IllegalStateException();
68 * This analysis depends on the LTTng kernel analysis, so it's added to
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
);