Commit | Line | Data |
---|---|---|
4bc53929 GB |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 École Polytechnique de Montréal | |
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 | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.lttng2.kernel.ui.analysis; | |
14 | ||
15 | import org.eclipse.jdt.annotation.NonNull; | |
16 | import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider; | |
17 | import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages; | |
18 | import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow.ControlFlowView; | |
19 | import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesView; | |
20 | import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace; | |
21 | import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException; | |
22 | import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider; | |
23 | import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule; | |
24 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
25 | import org.eclipse.linuxtools.tmf.ui.analysis.TmfAnalysisViewOutput; | |
26 | ||
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 | ||
44 | /** | |
45 | * Constructor adding the views to the analysis | |
46 | */ | |
47 | public LttngKernelAnalysisModule() { | |
48 | super(); | |
49 | this.registerOutput(new TmfAnalysisViewOutput(ControlFlowView.ID)); | |
50 | this.registerOutput(new TmfAnalysisViewOutput(ResourcesView.ID)); | |
51 | } | |
52 | ||
53 | @Override | |
54 | public void setTrace(ITmfTrace trace) throws TmfAnalysisException { | |
55 | if (!(trace instanceof LttngKernelTrace)) { | |
56 | throw new IllegalArgumentException("LttngKernelStateSystemModule: trace should be of type LttngKernelTrace"); //$NON-NLS-1$ | |
57 | } | |
58 | super.setTrace(trace); | |
59 | } | |
60 | ||
61 | @Override | |
62 | protected LttngKernelTrace getTrace() { | |
63 | /* Cast should be safe because we check the type at the setTrace() */ | |
64 | return (LttngKernelTrace) super.getTrace(); | |
65 | } | |
66 | ||
67 | @Override | |
68 | @NonNull | |
69 | protected ITmfStateProvider createStateProvider() { | |
70 | return new LttngKernelStateProvider(getTrace()); | |
71 | } | |
72 | ||
73 | @Override | |
74 | @NonNull | |
75 | protected StateSystemBackendType getBackendType() { | |
76 | return StateSystemBackendType.FULL; | |
77 | } | |
78 | ||
79 | @Override | |
80 | @NonNull | |
81 | protected String getSsFileName() { | |
82 | return HISTORY_TREE_FILE_NAME; | |
83 | } | |
84 | ||
85 | @Override | |
86 | protected String getFullHelpText() { | |
87 | return Messages.LttngKernelAnalysis_Help; | |
88 | } | |
89 | ||
90 | } |