1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 École Polytechnique de Montréal
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
10 * Geneviève Bastien - Initial API and implementation
11 * Mathieu Rail - Provide the requirements of the analysis
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.lttng2
.kernel
.core
.analysis
.kernel
;
16 import org
.eclipse
.jdt
.annotation
.NonNull
;
17 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.trace
.layout
.IKernelAnalysisEventLayout
;
18 import org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.core
.trace
.layout
.LttngEventLayout
;
19 import org
.eclipse
.tracecompass
.lttng2
.control
.core
.session
.SessionConfigStrings
;
20 import org
.eclipse
.tracecompass
.lttng2
.kernel
.core
.trace
.LttngKernelTrace
;
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
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
27 import com
.google
.common
.collect
.ImmutableSet
;
30 * State System Module for lttng kernel traces
32 * @author Geneviève Bastien
35 public class LttngKernelAnalysis
extends TmfStateSystemAnalysisModule
{
38 * The file name of the History Tree
40 public static final @NonNull String HISTORY_TREE_FILE_NAME
= "stateHistory.ht"; //$NON-NLS-1$
42 /** The ID of this analysis module */
43 public static final @NonNull String ID
= "org.eclipse.linuxtools.lttng2.kernel.analysis"; //$NON-NLS-1$
46 * TODO: Decide which events should be mandatory for the analysis, once the
47 * appropriate error messages and session setup are in place.
49 private static final ImmutableSet
<String
> REQUIRED_EVENTS
= ImmutableSet
.of();
51 private static final ImmutableSet
<String
> OPTIONAL_EVENTS
= ImmutableSet
.of(
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,
68 // /* FIXME Add the prefix for syscalls */
69 // LttngStrings.SYSCALL_PREFIX
72 /** The requirements as an immutable set */
73 private static final ImmutableSet
<TmfAnalysisRequirement
> REQUIREMENTS
;
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
);
80 TmfAnalysisRequirement eventReq
= new TmfAnalysisRequirement(SessionConfigStrings
.CONFIG_ELEMENT_EVENT
, REQUIRED_EVENTS
, ValuePriorityLevel
.MANDATORY
);
81 eventReq
.addValues(OPTIONAL_EVENTS
, ValuePriorityLevel
.OPTIONAL
);
83 REQUIREMENTS
= ImmutableSet
.of(domainReq
, eventReq
);
87 protected @NonNull ITmfStateProvider
createStateProvider() {
88 ITmfTrace trace
= getTrace();
89 IKernelAnalysisEventLayout layout
;
91 if (trace
instanceof LttngKernelTrace
) {
92 layout
= ((LttngKernelTrace
) trace
).getEventLayout();
94 /* Fall-back to the base LttngEventLayout */
95 layout
= LttngEventLayout
.getInstance();
98 return new LttngKernelStateProvider(trace
, layout
);
103 protected String
getSsFileName() {
104 return HISTORY_TREE_FILE_NAME
;
108 protected String
getFullHelpText() {
109 return Messages
.LttngKernelAnalysisModule_Help
;
113 public Iterable
<TmfAnalysisRequirement
> getAnalysisRequirements() {