And update the views accordingly.
Change-Id: I90975b5772db24a784d99d2d0232f6f76a8e5e03
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/19432
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.core;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
- org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-friends:="org.eclipse.linuxtools.lttng2.kernel.core.tests",
- org.eclipse.linuxtools.lttng2.kernel.core.trace,
- org.eclipse.linuxtools.lttng2.kernel.core.event.matching
+ org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
+ org.eclipse.linuxtools.lttng2.kernel.core.event.matching,
+ org.eclipse.linuxtools.lttng2.kernel.core.trace
package org.eclipse.linuxtools.lttng2.kernel.core.trace;
-import java.io.File;
import java.nio.BufferOverflowException;
import org.eclipse.core.resources.IProject;
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.Activator;
-import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
/**
* This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
- * traces. It uses the CtfKernelStateInput to generate the state history.
+ * traces.
*
* @author Alexandre Montplaisir
* @since 2.0
*/
public class LttngKernelTrace extends CtfTmfTrace {
- /**
- * The file name of the History Tree
- */
- public final static String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
-
- /**
- * ID of the state system we will build
- * @since 2.0
- * */
- public static final String STATE_ID = "org.eclipse.linuxtools.lttng2.kernel"; //$NON-NLS-1$
-
/**
* Default constructor
*/
return validStatus;
}
- /**
- * @since 3.0
- */
- @Override
- protected IStatus buildStateSystem() {
- super.buildStateSystem();
-
- /* Build the state system specific to LTTng kernel traces */
- String directory = TmfTraceManager.getSupplementaryFileDir(this);
- final File htFile = new File(directory + HISTORY_TREE_FILE_NAME);
- final ITmfStateProvider htInput = new LttngKernelStateProvider(this);
-
- try {
- ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
- fStateSystems.put(STATE_ID, ss);
- } catch (TmfTraceException e) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
- }
- return Status.OK_STATUS;
- }
-
}
org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events;x-internal:=true,
org.eclipse.linuxtools.internal.lttng2.kernel.ui.views;x-internal:=true,
org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui.swtbot.tests",
- org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui.swtbot.tests"
+ org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui.swtbot.tests",
+ org.eclipse.linuxtools.lttng2.kernel.ui.analysis
about.html,\
plugin.properties
src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
\ No newline at end of file
resources.view.name = Resources
tracetype.type.kernel = LTTng Kernel Trace
+
+analysis.lttngkernel = LTTng Kernel Analysis
</enablement>
</commonWizard>
</extension>
+ <extension
+ point="org.eclipse.linuxtools.tmf.core.analysis">
+ <module
+ analysis_module="org.eclipse.linuxtools.lttng2.kernel.ui.analysis.LttngKernelAnalysisModule"
+ automatic="true"
+ id="org.eclipse.linuxtools.lttng2.kernel.analysis"
+ name="%analysis.lttngkernel">
+ <tracetype
+ class="org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace">
+ </tracetype>
+ </module>
+ </extension>
</plugin>
public static String ResourcesView_attributeProcessName;
public static String ResourcesView_attributeSyscallName;
+ public static String LttngKernelAnalysis_Help;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
ResourcesView_attributeTidName=> TID
ResourcesView_attributeProcessName=> Process
ResourcesView_attributeSyscallName=> System Call
+
+LttngKernelAnalysis_Help=Builds the LTTng2 kernel state system to populate the Control Flow view and the Resources View
import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.ui.analysis.LttngKernelAnalysisModule;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
return retMap;
}
ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();
- ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = entry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ return retMap;
+ }
int tid = entry.getThreadId();
try {
}
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
- } catch (StateValueTypeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ Activator.getDefault().logError("Error in ControlFlowPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
retMap.put(Messages.ControlFlowView_attributeSyscallName, state.toString());
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException e) {
+ Activator.getDefault().logError("Error in ControlFlowPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
return;
}
ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();
- ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = entry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return;
+ }
int status = ((TimeEvent) event).getValue();
if (status != StateValues.PROCESS_STATUS_RUN_SYSCALL) {
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
Utils.drawText(gc, state.toString().substring(4), bounds.x, bounds.y - 2, bounds.width, true, true);
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException e) {
+ Activator.getDefault().logError("Error in ControlFlowPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.ui.analysis.LttngKernelAnalysisModule;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
if (aTrace instanceof LttngKernelTrace) {
ArrayList<ControlFlowEntry> entryList = new ArrayList<>();
LttngKernelTrace ctfKernelTrace = (LttngKernelTrace) aTrace;
- ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = ctfKernelTrace.getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ module.schedule();
+ if (!module.waitForCompletion(new NullProgressMonitor())) {
+ continue;
+ }
+ ITmfStateSystem ssq = module.getStateSystem();
if (ssq == null) {
- return;
+ continue;
}
ssq.waitUntilBuilt();
if (ssq.isCancelled()) {
- return;
+ continue;
}
long start = ssq.getStartTime();
long end = ssq.getCurrentEndTime() + 1;
}
private void buildStatusEvents(ITmfTrace trace, ControlFlowEntry entry, IProgressMonitor monitor) {
- ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
-
+ LttngKernelAnalysisModule module = entry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ return;
+ }
long start = ssq.getStartTime();
long end = ssq.getCurrentEndTime() + 1;
long resolution = Math.max(1, (end - start) / getDisplayWidth());
if (realEnd <= realStart) {
return null;
}
- ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = entry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ return null;
+ }
try {
int statusQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.STATUS);
List<ITmfStateInterval> statusIntervals = ssq.queryHistoryRange(statusQuark, realStart, realEnd - 1, resolution, monitor);
}
if (trace instanceof LttngKernelTrace) {
LttngKernelTrace ctfKernelTrace = (LttngKernelTrace) trace;
- ITmfStateSystem ssq = ctfKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = ctfKernelTrace.getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ continue;
+ }
if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) {
List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); //$NON-NLS-1$
for (int currentThreadQuark : currentThreadQuarks) {
}
for (ITmfTrace trace : traces) {
if (trace instanceof LttngKernelTrace) {
- ITmfStateSystem ssq = trace.getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = trace.getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ continue;
+ }
try {
long start = Math.max(startTime, ssq.getStartTime());
long end = Math.min(endTime, ssq.getCurrentEndTime());
import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.ui.analysis.LttngKernelAnalysisModule;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
ResourcesEntry entry = (ResourcesEntry) event.getEntry();
if (tcEvent.hasValue()) {
+ LttngKernelAnalysisModule module = entry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return retMap;
+ }
// Check for IRQ or Soft_IRQ type
if (entry.getType().equals(Type.IRQ) || entry.getType().equals(Type.SOFT_IRQ)) {
if (status == StateValues.CPU_STATUS_IRQ) {
// In IRQ state get the IRQ that caused the interruption
- ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
int cpu = entry.getId();
try {
break;
}
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
- } catch (StateValueTypeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ Activator.getDefault().logError("Error in ResourcesPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
} else if (status == StateValues.CPU_STATUS_SOFTIRQ) {
// In SOFT_IRQ state get the SOFT_IRQ that caused the interruption
- ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
int cpu = entry.getId();
try {
break;
}
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
- } catch (StateValueTypeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ Activator.getDefault().logError("Error in ResourcesPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
} else if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) {
// In running state get the current tid
- ITmfStateSystem ssq = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
try {
retMap.put(Messages.ResourcesView_attributeHoverTime, Utils.formatTime(hoverTime, TimeFormat.CALENDAR, Resolution.NANOSEC));
int cpuQuark = entry.getQuark();
- int currentThreadQuark = ssq.getQuarkRelative(cpuQuark, Attributes.CURRENT_THREAD);
- ITmfStateInterval interval = ssq.querySingleState(hoverTime, currentThreadQuark);
+ int currentThreadQuark = ss.getQuarkRelative(cpuQuark, Attributes.CURRENT_THREAD);
+ ITmfStateInterval interval = ss.querySingleState(hoverTime, currentThreadQuark);
if (!interval.getStateValue().isNull()) {
ITmfStateValue value = interval.getStateValue();
int currentThreadId = value.unboxInt();
retMap.put(Messages.ResourcesView_attributeTidName, Integer.toString(currentThreadId));
- int execNameQuark = ssq.getQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThreadId), Attributes.EXEC_NAME);
- interval = ssq.querySingleState(hoverTime, execNameQuark);
+ int execNameQuark = ss.getQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThreadId), Attributes.EXEC_NAME);
+ interval = ss.querySingleState(hoverTime, execNameQuark);
if (!interval.getStateValue().isNull()) {
value = interval.getStateValue();
retMap.put(Messages.ResourcesView_attributeProcessName, value.unboxStr());
}
if (status == StateValues.CPU_STATUS_RUN_SYSCALL) {
- int syscallQuark = ssq.getQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThreadId), Attributes.SYSTEM_CALL);
- interval = ssq.querySingleState(hoverTime, syscallQuark);
+ int syscallQuark = ss.getQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThreadId), Attributes.SYSTEM_CALL);
+ interval = ss.querySingleState(hoverTime, syscallQuark);
if (!interval.getStateValue().isNull()) {
value = interval.getStateValue();
retMap.put(Messages.ResourcesView_attributeSyscallName, value.unboxStr());
}
}
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
- } catch (StateValueTypeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ Activator.getDefault().logError("Error in ResourcesPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
return;
}
- ITmfStateSystem ss = entry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = entry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ss = module.getStateSystem();
+ if (ss == null) {
+ return;
+ }
long time = event.getTime();
try {
while (time < event.getTime() + event.getDuration()) {
}
}
}
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
- } catch (TimeRangeException e) {
- e.printStackTrace();
- } catch (StateValueTypeException e) {
- e.printStackTrace();
+ } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ Activator.getDefault().logError("Error in ResourcesPresentationProvider", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
/* Ignored */
}
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;
import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.linuxtools.lttng2.kernel.ui.analysis.LttngKernelAnalysisModule;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
}
if (aTrace instanceof LttngKernelTrace) {
LttngKernelTrace lttngKernelTrace = (LttngKernelTrace) aTrace;
- ITmfStateSystem ssq = lttngKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = lttngKernelTrace.getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ module.schedule();
+ if (!module.waitForCompletion(new NullProgressMonitor())) {
+ continue;
+ }
+ ITmfStateSystem ssq = module.getStateSystem();
if (ssq == null) {
- return;
+ continue;
}
ssq.waitUntilBuilt();
if (ssq.isCancelled()) {
- return;
+ continue;
}
long startTime = ssq.getStartTime();
long endTime = ssq.getCurrentEndTime() + 1;
return;
}
LttngKernelTrace lttngKernelTrace = traceEntry.getTrace();
- ITmfStateSystem ssq = lttngKernelTrace.getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = lttngKernelTrace.getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ continue;
+ }
long startTime = ssq.getStartTime();
long endTime = ssq.getCurrentEndTime() + 1;
long resolution = (endTime - startTime) / getDisplayWidth();
long startTime, long endTime, long resolution,
IProgressMonitor monitor) {
ResourcesEntry resourcesEntry = (ResourcesEntry) entry;
- ITmfStateSystem ssq = resourcesEntry.getTrace().getStateSystems().get(LttngKernelTrace.STATE_ID);
+ LttngKernelAnalysisModule module = resourcesEntry.getTrace().getAnalysisModules(LttngKernelAnalysisModule.class).get(LttngKernelAnalysisModule.ID);
+ ITmfStateSystem ssq = module.getStateSystem();
+ if (ssq == null) {
+ return null;
+ }
final long realStart = Math.max(startTime, ssq.getStartTime());
final long realEnd = Math.min(endTime, ssq.getCurrentEndTime() + 1);
if (realEnd <= realStart) {
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.kernel.ui.analysis;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow.ControlFlowView;
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesView;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
+import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ui.analysis.TmfAnalysisViewOutput;
+
+/**
+ * State System Module for lttng kernel traces
+ *
+ * @author Geneviève Bastien
+ * @since 3.0
+ */
+public class LttngKernelAnalysisModule extends TmfStateSystemAnalysisModule {
+
+ /**
+ * The file name of the History Tree
+ */
+ @NonNull
+ public static final String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
+
+ /** The ID of this analysis module */
+ public static final String ID = "org.eclipse.linuxtools.lttng2.kernel.analysis"; //$NON-NLS-1$
+
+ /**
+ * Constructor adding the views to the analysis
+ */
+ public LttngKernelAnalysisModule() {
+ super();
+ this.registerOutput(new TmfAnalysisViewOutput(ControlFlowView.ID));
+ this.registerOutput(new TmfAnalysisViewOutput(ResourcesView.ID));
+ }
+
+ @Override
+ public void setTrace(ITmfTrace trace) throws TmfAnalysisException {
+ if (!(trace instanceof LttngKernelTrace)) {
+ throw new IllegalArgumentException("LttngKernelStateSystemModule: trace should be of type LttngKernelTrace"); //$NON-NLS-1$
+ }
+ super.setTrace(trace);
+ }
+
+ @Override
+ protected LttngKernelTrace getTrace() {
+ /* Cast should be safe because we check the type at the setTrace() */
+ return (LttngKernelTrace) super.getTrace();
+ }
+
+ @Override
+ @NonNull
+ protected ITmfStateProvider createStateProvider() {
+ return new LttngKernelStateProvider(getTrace());
+ }
+
+ @Override
+ @NonNull
+ protected StateSystemBackendType getBackendType() {
+ return StateSystemBackendType.FULL;
+ }
+
+ @Override
+ @NonNull
+ protected String getSsFileName() {
+ return HISTORY_TREE_FILE_NAME;
+ }
+
+ @Override
+ protected String getFullHelpText() {
+ return Messages.LttngKernelAnalysis_Help;
+ }
+
+}
@Override
public String getHelpText() {
- return new String();
+ /*
+ * FIXME: No need to externalize this. A better solution will be found
+ * soon and this string is just temporary
+ */
+ return new String("The trace must be opened to get the help message"); //$NON-NLS-1$
}
@Override
* @return The help message
*/
public String getHelpMessage() {
+ ITmfProjectModelElement parent = getParent();
+
+ if (parent instanceof TmfTraceElement) {
+ TmfTraceElement traceElement = (TmfTraceElement) parent;
+ ITmfTrace trace = traceElement.getTrace();
+ if (trace != null) {
+ IAnalysisModule module = trace.getAnalysisModule(fAnalysisId);
+ return module.getHelpText();
+ }
+ }
+
IAnalysisModuleHelper helper = TmfAnalysisManager.getAnalysisModule(fAnalysisId);
if (helper == null) {
return new String();