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
.IKernelAnalysisEventLayout
;
23 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
.IKernelTrace
;
24 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
25 import org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.kernel
.KernelStateProvider
;
26 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.TmfAnalysisRequirement
;
27 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.ITmfStateProvider
;
28 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
29 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
32 * State System Module for lttng kernel traces
34 * @author Geneviève Bastien
37 public class KernelAnalysisModule
extends TmfStateSystemAnalysisModule
{
40 * The file name of the History Tree
42 public static final String HISTORY_TREE_FILE_NAME
= "stateHistory.ht"; //$NON-NLS-1$
44 /** The ID of this analysis module */
45 public static final String ID
= "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
48 * TODO: Decide which events should be mandatory for the analysis, once the
49 * appropriate error messages and session setup are in place.
51 // private static final ImmutableSet<String> REQUIRED_EVENTS = ImmutableSet.of();
53 // private static final ImmutableSet<String> OPTIONAL_EVENTS = ImmutableSet.of(
54 // FIXME These cannot be declared statically anymore, they depend on
55 // the OriginTracer of the kernel trace.
56 // LttngStrings.EXIT_SYSCALL,
57 // LttngStrings.IRQ_HANDLER_ENTRY,
58 // LttngStrings.IRQ_HANDLER_EXIT,
59 // LttngStrings.SOFTIRQ_ENTRY,
60 // LttngStrings.SOFTIRQ_EXIT,
61 // LttngStrings.SOFTIRQ_RAISE,
62 // LttngStrings.SCHED_PROCESS_FORK,
63 // LttngStrings.SCHED_PROCESS_EXIT,
64 // LttngStrings.SCHED_PROCESS_FREE,
65 // LttngStrings.SCHED_SWITCH,
66 // LttngStrings.STATEDUMP_PROCESS_STATE,
67 // LttngStrings.SCHED_WAKEUP,
68 // LttngStrings.SCHED_WAKEUP_NEW,
70 // /* FIXME Add the prefix for syscalls */
71 // LttngStrings.SYSCALL_PREFIX
74 /** The requirements as an immutable set */
75 private static final Set
<TmfAnalysisRequirement
> REQUIREMENTS
;
78 // /* initialize the requirement: domain and events */
79 // TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN);
80 // domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, ValuePriorityLevel.MANDATORY);
82 // TmfAnalysisRequirement eventReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, REQUIRED_EVENTS, ValuePriorityLevel.MANDATORY);
83 // eventReq.addValues(OPTIONAL_EVENTS, ValuePriorityLevel.OPTIONAL);
85 // REQUIREMENTS = checkNotNull(ImmutableSet.of(domainReq, eventReq));
86 REQUIREMENTS
= Collections
.EMPTY_SET
;
90 protected @NonNull ITmfStateProvider
createStateProvider() {
91 ITmfTrace trace
= checkNotNull(getTrace());
92 IKernelAnalysisEventLayout layout
;
94 if (trace
instanceof IKernelTrace
) {
95 layout
= ((IKernelTrace
) trace
).getKernelEventLayout();
97 /* Fall-back to the base LttngEventLayout */
98 layout
= IKernelAnalysisEventLayout
.DEFAULT_LAYOUT
;
101 return new KernelStateProvider(trace
, layout
);
106 protected String
getSsFileName() {
107 return HISTORY_TREE_FILE_NAME
;
111 protected String
getFullHelpText() {
112 return NonNullUtils
.nullToEmptyString(Messages
.LttngKernelAnalysisModule_Help
);
116 public Iterable
<TmfAnalysisRequirement
> getAnalysisRequirements() {