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