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