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