tmf: Move the analysis requirements to their own package
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / analysis / os / linux / core / kernel / KernelAnalysisModule.java
CommitLineData
4bc53929 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2015 École Polytechnique de Montréal
4bc53929
GB
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
52cb603c 11 * Mathieu Rail - Provide the requirements of the analysis
4bc53929
GB
12 *******************************************************************************/
13
0f7a12d3 14package org.eclipse.tracecompass.analysis.os.linux.core.kernel;
4bc53929 15
5db5a3a4
AM
16import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
e363eae1 18import java.util.Collections;
5db5a3a4
AM
19import java.util.Set;
20
4bc53929 21import org.eclipse.jdt.annotation.NonNull;
aa38ac17 22import org.eclipse.tracecompass.analysis.os.linux.core.trace.DefaultEventLayout;
e363eae1
AM
23import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
24import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
c8f45ad2
MK
25import org.eclipse.tracecompass.common.core.NonNullUtils;
26import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
ca0f94c4 27import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement;
2bdf0193
AM
28import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
29import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
7411cd67 30import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
4bc53929
GB
31
32/**
33 * State System Module for lttng kernel traces
34 *
35 * @author Geneviève Bastien
0f7a12d3 36 * @since 2.0
4bc53929 37 */
6d16f5a9 38public class KernelAnalysisModule extends TmfStateSystemAnalysisModule {
4bc53929
GB
39
40 /**
41 * The file name of the History Tree
42 */
e363eae1 43 public static final String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
4bc53929
GB
44
45 /** The ID of this analysis module */
e363eae1 46 public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
4bc53929 47
eb00d54d
MK
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 */
e363eae1
AM
52// private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of();
53//
54// private static final ImmutableSet<String> OPTIONAL_EVENTS = ImmutableSet.of(
7411cd67
AM
55 // FIXME These cannot be declared statically anymore, they depend on
56 // the OriginTracer of the kernel trace.
4a74f111
MG
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
e363eae1 73 // );
52cb603c
GM
74
75 /** The requirements as an immutable set */
e363eae1 76 private static final Set<TmfAnalysisRequirement> REQUIREMENTS;
52cb603c
GM
77
78 static {
e363eae1
AM
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));
aa353506 87 REQUIREMENTS = Collections.EMPTY_SET;
4bc53929
GB
88 }
89
4bc53929 90 @Override
7411cd67 91 protected @NonNull ITmfStateProvider createStateProvider() {
d0c7e4ba 92 ITmfTrace trace = checkNotNull(getTrace());
7411cd67
AM
93 IKernelAnalysisEventLayout layout;
94
e363eae1
AM
95 if (trace instanceof IKernelTrace) {
96 layout = ((IKernelTrace) trace).getKernelEventLayout();
7411cd67
AM
97 } else {
98 /* Fall-back to the base LttngEventLayout */
aa38ac17 99 layout = DefaultEventLayout.getInstance();
7411cd67
AM
100 }
101
e363eae1 102 return new KernelStateProvider(trace, layout);
4bc53929
GB
103 }
104
4bc53929
GB
105 @Override
106 @NonNull
107 protected String getSsFileName() {
108 return HISTORY_TREE_FILE_NAME;
109 }
110
111 @Override
112 protected String getFullHelpText() {
5db5a3a4 113 return NonNullUtils.nullToEmptyString(Messages.LttngKernelAnalysisModule_Help);
4bc53929
GB
114 }
115
52cb603c
GM
116 @Override
117 public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
118 return REQUIREMENTS;
119 }
4bc53929 120}
This page took 0.110474 seconds and 5 git commands to generate.