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 / kernel / KernelAnalysisModule.java
1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 É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 * Contributors:
10 * Geneviève Bastien - Initial API and implementation
11 * Mathieu Rail - Provide the requirements of the analysis
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
15
16 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
18 import java.util.Collections;
19 import java.util.Set;
20
21 import org.eclipse.jdt.annotation.NonNull;
22 import org.eclipse.tracecompass.analysis.os.linux.core.trace.DefaultEventLayout;
23 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
24 import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
25 import org.eclipse.tracecompass.common.core.NonNullUtils;
26 import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
27 import org.eclipse.tracecompass.tmf.core.analysis.TmfAnalysisRequirement;
28 import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
29 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
30 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
31
32 /**
33 * State System Module for lttng kernel traces
34 *
35 * @author Geneviève Bastien
36 * @since 2.0
37 */
38 public class KernelAnalysisModule extends TmfStateSystemAnalysisModule {
39
40 /**
41 * The file name of the History Tree
42 */
43 public static final String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
44
45 /** The ID of this analysis module */
46 public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
47
48 /*
49 * TODO: Decide which events should be mandatory for the analysis, once the
50 * appropriate error messages and session setup are in place.
51 */
52 // private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of();
53 //
54 // private static final ImmutableSet<String> OPTIONAL_EVENTS = ImmutableSet.of(
55 // FIXME These cannot be declared statically anymore, they depend on
56 // the OriginTracer of the kernel trace.
57 // LttngStrings.EXIT_SYSCALL,
58 // LttngStrings.IRQ_HANDLER_ENTRY,
59 // LttngStrings.IRQ_HANDLER_EXIT,
60 // LttngStrings.SOFTIRQ_ENTRY,
61 // LttngStrings.SOFTIRQ_EXIT,
62 // LttngStrings.SOFTIRQ_RAISE,
63 // LttngStrings.SCHED_PROCESS_FORK,
64 // LttngStrings.SCHED_PROCESS_EXIT,
65 // LttngStrings.SCHED_PROCESS_FREE,
66 // LttngStrings.SCHED_SWITCH,
67 // LttngStrings.STATEDUMP_PROCESS_STATE,
68 // LttngStrings.SCHED_WAKEUP,
69 // LttngStrings.SCHED_WAKEUP_NEW,
70 //
71 // /* FIXME Add the prefix for syscalls */
72 // LttngStrings.SYSCALL_PREFIX
73 // );
74
75 /** The requirements as an immutable set */
76 private static final Set<TmfAnalysisRequirement> REQUIREMENTS;
77
78 static {
79 // /* initialize the requirement: domain and events */
80 // TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN);
81 // domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, ValuePriorityLevel.MANDATORY);
82 //
83 // TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
84 // eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
85 //
86 // REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventReq));
87 REQUIREMENTS = Collections.EMPTY_SET;
88 }
89
90 @Override
91 protected @NonNull ITmfStateProvider createStateProvider() {
92 ITmfTrace trace = checkNotNull(getTrace());
93 IKernelAnalysisEventLayout layout;
94
95 if (trace instanceof IKernelTrace) {
96 layout = ((IKernelTrace) trace).getKernelEventLayout();
97 } else {
98 /* Fall-back to the base LttngEventLayout */
99 layout = DefaultEventLayout.getInstance();
100 }
101
102 return new KernelStateProvider(trace, layout);
103 }
104
105 @Override
106 @NonNull
107 protected String getSsFileName() {
108 return HISTORY_TREE_FILE_NAME;
109 }
110
111 @Override
112 protected String getFullHelpText() {
113 return NonNullUtils.nullToEmptyString(Messages.LttngKernelAnalysisModule_Help);
114 }
115
116 @Override
117 public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
118 return REQUIREMENTS;
119 }
120 }
This page took 0.038243 seconds and 6 git commands to generate.