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