1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 É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
.analysis
.os
.linux
.core
.kernel
;
16 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
18 import java
.util
.Collections
;
21 import org
.eclipse
.jdt
.annotation
.NonNull
;
22 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.DefaultEventLayout
;
23 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelAnalysisEventLayout
;
24 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelTrace
;
25 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
26 import org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.kernel
.KernelStateProvider
;
27 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.TmfAnalysisRequirement
;
28 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
29 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
30 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
33 * State System Module for lttng kernel traces
35 * @author Geneviève Bastien
38 public class KernelAnalysisModule
extends TmfStateSystemAnalysisModule
{
41 * The file name of the History Tree
43 public static final String HISTORY_TREE_FILE_NAME
= "stateHistory.ht"; //$NON-NLS-1$
45 /** The ID of this analysis module */
46 public static final String ID
= "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
49 * TODO: Decide which events should be mandatory for the analysis, once the
50 * appropriate error messages and session setup are in place.
52 // private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of();
54 // private static final ImmutableSet<String> OPTIONAL_EVENTS = ImmutableSet.of(
55 // FIXME These cannot be declared statically anymore, they depend on
56 // the OriginTracer of the kernel trace.
57 // LttngStrings.EXIT_SYSCALL,
58 // LttngStrings.IRQ_HANDLER_ENTRY,
59 // LttngStrings.IRQ_HANDLER_EXIT,
60 // LttngStrings.SOFTIRQ_ENTRY,
61 // LttngStrings.SOFTIRQ_EXIT,
62 // LttngStrings.SOFTIRQ_RAISE,
63 // LttngStrings.SCHED_PROCESS_FORK,
64 // LttngStrings.SCHED_PROCESS_EXIT,
65 // LttngStrings.SCHED_PROCESS_FREE,
66 // LttngStrings.SCHED_SWITCH,
67 // LttngStrings.STATEDUMP_PROCESS_STATE,
68 // LttngStrings.SCHED_WAKEUP,
69 // LttngStrings.SCHED_WAKEUP_NEW,
71 // /* FIXME Add the prefix for syscalls */
72 // LttngStrings.SYSCALL_PREFIX
75 /** The requirements as an immutable set */
76 private static final Set
<TmfAnalysisRequirement
> REQUIREMENTS
;
79 // /* initialize the requirement: domain and events */
80 // TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN);
81 // domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, ValuePriorityLevel.MANDATORY);
83 // TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
84 // eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
86 // REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventReq));
87 REQUIREMENTS
= Collections
.EMPTY_SET
;
91 protected @NonNull ITmfStateProvider
createStateProvider() {
92 ITmfTrace trace
= checkNotNull(getTrace());
93 IKernelAnalysisEventLayout layout
;
95 if (trace
instanceof IKernelTrace
) {
96 layout
= ((IKernelTrace
) trace
).getKernelEventLayout();
98 /* Fall-back to the base LttngEventLayout */
99 layout
= DefaultEventLayout
.getInstance();
102 return new KernelStateProvider(trace
, layout
);
107 protected String
getSsFileName() {
108 return HISTORY_TREE_FILE_NAME
;
112 protected String
getFullHelpText() {
113 return NonNullUtils
.nullToEmptyString(Messages
.LttngKernelAnalysisModule_Help
);
117 public Iterable
<TmfAnalysisRequirement
> getAnalysisRequirements() {