/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
* Test suite for the Activator class
* <p>
*/
+@SuppressWarnings("javadoc")
public class ActivatorTest extends TestCase {
// ------------------------------------------------------------------------
/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
* <b><u>AllTests</u></b>
* <p>
*/
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Get the image object from a given path
+ *
+ * @param path
+ * The path to the image file
+ * @return The Image object
+ */
public Image getImageFromPath(String path) {
return getImageDescripterFromPath(path).createImage();
}
+ /**
+ * Get the ImageDescriptor from a given path
+ *
+ * @param path
+ * The path to the image file
+ * @return The ImageDescriptor object
+ */
public ImageDescriptor getImageDescripterFromPath(String path) {
return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
}
+ /**
+ * Get the Image from a registry
+ *
+ * @param path
+ * The path to the image registry
+ * @return The Image object
+ */
public Image getImageFromImageRegistry(String path) {
Image icon = getImageRegistry().get(path);
if (icon == null) {
}
return icon;
}
-
+
/**
* Logs a message with severity INFO in the runtime log of the plug-in.
- *
+ *
* @param message A message to log
*/
public void logInfo(String message) {
getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
}
-
+
/**
* Logs a message and exception with severity INFO in the runtime log of the plug-in.
- *
+ *
* @param message A message to log
* @param exception A exception to log
*/
/**
* Logs a message and exception with severity WARNING in the runtime log of the plug-in.
- *
+ *
* @param message A message to log
*/
public void logWarning(String message) {
getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
}
-
+
/**
* Logs a message and exception with severity WARNING in the runtime log of the plug-in.
- *
+ *
* @param message A message to log
* @param exception A exception to log
*/
/**
* Logs a message and exception with severity ERROR in the runtime log of the plug-in.
- *
+ *
* @param message A message to log
*/
public void logError(String message) {
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
}
-
+
/**
* Logs a message and exception with severity ERROR in the runtime log of the plug-in.
- *
+ *
* @param message A message to log
* @param exception A exception to log
*/
\r
import org.eclipse.osgi.util.NLS;\r
\r
+@SuppressWarnings("javadoc")\r
public class Messages extends NLS {\r
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng2.kernel.ui.messages"; //$NON-NLS-1$\r
\r
public static String ControlFlowView_ptidColumn;\r
public static String ControlFlowView_processColumn;\r
public static String ControlFlowView_traceColumn;\r
- \r
+\r
public static String ControlFlowView_stateTypeName;\r
public static String ControlFlowView_nextProcessActionNameText;\r
public static String ControlFlowView_nextProcessActionToolTipText;\r
public static String ControlFlowView_previousProcessActionNameText;\r
public static String ControlFlowView_previousProcessActionToolTipText;\r
- \r
+\r
public static String ControlFlowView_attributeSyscallName;\r
\r
public static String ResourcesView_stateTypeName;\r
public static String ResourcesView_attributeCpuName;\r
public static String ResourcesView_attributeIrqName;\r
public static String ResourcesView_attributeSoftIrqName;\r
- \r
+\r
static {\r
// initialize resource bundle\r
NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.Composite;\r
\r
+/**\r
+ * Events table specific for LTTng 2.0 kernel traces\r
+ */\r
public class LTTng2EventsTable extends TmfEventsTable {\r
\r
// ------------------------------------------------------------------------\r
// Constructor\r
// ------------------------------------------------------------------------\r
\r
+ /**\r
+ * Constructor\r
+ *\r
+ * @param parent\r
+ * The parent composite\r
+ * @param cacheSize\r
+ * The size of the rows cache\r
+ */\r
public LTTng2EventsTable(Composite parent, int cacheSize) {\r
super(parent, cacheSize, COLUMN_DATA);\r
fTable.getColumns()[0].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP);\r
import org.eclipse.osgi.util.NLS;
+@SuppressWarnings("javadoc")
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events.messages"; //$NON-NLS-1$
public static String EventsTable_channelColumn;
/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
*/
public class PerspectiveFactory implements IPerspectiveFactory {
- // Perspective ID
+ /** Perspective ID */
public static final String ID = "org.eclipse.linuxtools.lttng2.ui.perspective"; //$NON-NLS-1$
// LTTng views
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
*/
@Override
// Create the middle right folder
IFolderLayout middleRightFolder = layout.createFolder(
- "middleRightFolder", IPageLayout.BOTTOM, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
+ "middleRightFolder", IPageLayout.BOTTOM, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
middleRightFolder.addView(EVENTS_VIEW_ID);
// Create the bottom right folder
/**
* Add fast views to the perspective
- *
+ *
* @param layout
*/
private void addFastViews(IPageLayout layout) {
/**
* Add view shortcuts to the perspective
- *
+ *
* @param layout
*/
private void addViewShortcuts(IPageLayout layout) {
/**
* Add perspective shortcuts to the perspective
- *
+ *
* @param layout
*/
private void addPerspectiveShortcuts(IPageLayout layout) {
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent;\r
\r
+/**\r
+ * An iterator for time events\r
+ */\r
public class EventIterator implements Iterator<ITimeEvent> {\r
\r
- private long fStartTime;\r
- private long fEndTime;\r
+ private final long fStartTime;\r
+ private final long fEndTime;\r
private List<ITimeEvent> fEventList;\r
private List<ITimeEvent> fZoomedEventList;\r
private long fZoomedStartTime;\r
private ITimeEvent fNext = null;\r
private ITimeEvent fZoomedNext = null;\r
\r
+ /**\r
+ * Basic constructor, with start time and end times equal to the lowest and\r
+ * highest values possible, respectively.\r
+ *\r
+ * @param eventList\r
+ * The list on which this iterator will iterate\r
+ * @param zoomedEventList\r
+ * The "zoomed" list\r
+ */\r
public EventIterator(List<ITimeEvent> eventList, List<ITimeEvent> zoomedEventList) {\r
this(eventList, zoomedEventList, Long.MIN_VALUE, Long.MAX_VALUE);\r
}\r
\r
- public EventIterator(List<ITimeEvent> eventList, List<ITimeEvent> zoomedEventList, long startTime, long endTime) {\r
+ /**\r
+ * Complete constructor, where we specify start and end times.\r
+ *\r
+ * @param eventList\r
+ * The list on which this iterator will iterate\r
+ * @param zoomedEventList\r
+ * The "zoomed" list\r
+ * @param startTime\r
+ * The start time\r
+ * @param endTime\r
+ * The end time\r
+ */\r
+ public EventIterator(List<ITimeEvent> eventList,\r
+ List<ITimeEvent> zoomedEventList, long startTime, long endTime) {\r
fEventList = eventList;\r
fZoomedEventList = zoomedEventList;\r
if (zoomedEventList != null && zoomedEventList.size() > 0) {\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;\r
\r
+/**\r
+ * An entry in the Control Flow view\r
+ */\r
public class ControlFlowEntry implements ITimeGraphEntry {\r
- private int fThreadQuark;\r
- private CtfKernelTrace fTrace;\r
+ private final int fThreadQuark;\r
+ private final CtfKernelTrace fTrace;\r
private ControlFlowEntry fParent = null;\r
- private ArrayList<ControlFlowEntry> fChildren = new ArrayList<ControlFlowEntry>();\r
- private String fName;\r
- private int fThreadId;\r
- private int fParentThreadId;\r
+ private final ArrayList<ControlFlowEntry> fChildren = new ArrayList<ControlFlowEntry>();\r
+ private final String fName;\r
+ private final int fThreadId;\r
+ private final int fParentThreadId;\r
private long fBirthTime = -1;\r
private long fStartTime = -1;\r
private long fEndTime = -1;\r
private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();\r
private List<ITimeEvent> fZoomedEventList = null;\r
\r
+ /**\r
+ * Constructor\r
+ *\r
+ * @param threadQuark\r
+ * The attribute quark matching the thread\r
+ * @param trace\r
+ * The trace on which we are working\r
+ * @param execName\r
+ * The exec_name of this entry\r
+ * @param threadId\r
+ * The TID of the thread\r
+ * @param parentThreadId\r
+ * the Parent_TID of this thread\r
+ * @param birthTime\r
+ * The birth time of this entry (this allows separating different\r
+ * process that could have the same TID)\r
+ * @param startTime\r
+ * The start time of this process's lifetime\r
+ * @param endTime\r
+ * The end time of this process\r
+ */\r
public ControlFlowEntry(int threadQuark, CtfKernelTrace trace, String execName, int threadId, int parentThreadId, long birthTime, long startTime, long endTime) {\r
fThreadQuark = threadQuark;\r
fTrace = trace;\r
return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);\r
}\r
\r
+ /**\r
+ * Get the quark of the attribute matching this thread's TID\r
+ *\r
+ * @return The quark\r
+ */\r
public int getThreadQuark() {\r
return fThreadQuark;\r
}\r
\r
+ /**\r
+ * Get the CTF trace object\r
+ *\r
+ * @return The trace\r
+ */\r
public CtfKernelTrace getTrace() {\r
return fTrace;\r
}\r
\r
+ /**\r
+ * Get this entry's thread ID\r
+ *\r
+ * @return The TID\r
+ */\r
public int getThreadId() {\r
return fThreadId;\r
}\r
\r
+ /**\r
+ * Get this thread's parent TID\r
+ *\r
+ * @return The "PTID"\r
+ */\r
public int getParentThreadId() {\r
return fParentThreadId;\r
}\r
\r
+ /**\r
+ * Get the birth time of this entry/process\r
+ *\r
+ * @return The birth time\r
+ */\r
public long getBirthTime() {\r
return fBirthTime;\r
}\r
\r
+ /**\r
+ * Add an event to this process's timeline\r
+ *\r
+ * @param event\r
+ * The time event\r
+ */\r
public void addEvent(ITimeEvent event) {\r
long start = event.getTime();\r
long end = start + event.getDuration();\r
}\r
}\r
\r
+ /**\r
+ * Set the general event list of this entry\r
+ *\r
+ * @param eventList\r
+ * The list of time events\r
+ */\r
public void setEventList(List<ITimeEvent> eventList) {\r
fEventList = eventList;\r
}\r
\r
+ /**\r
+ * Set the zoomed event list of this entry\r
+ *\r
+ * @param eventList\r
+ * The list of time events\r
+ */\r
public void setZoomedEventList(List<ITimeEvent> eventList) {\r
fZoomedEventList = eventList;\r
}\r
\r
+ /**\r
+ * Add a child entry to this one (to show relationships between processes as\r
+ * a tree)\r
+ *\r
+ * @param child\r
+ * The child entry\r
+ */\r
public void addChild(ControlFlowEntry child) {\r
child.fParent = this;\r
fChildren.add(child);\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent;\r
\r
+/**\r
+ * Time Event specific to the control flow view\r
+ */\r
public class ControlFlowEvent extends TimeEvent {\r
\r
- private int fStatus;\r
+ private final int fStatus;\r
\r
- public ControlFlowEvent(ITimeGraphEntry entry, long time, long duration, int status) {\r
+ /**\r
+ * Constructor\r
+ *\r
+ * @param entry\r
+ * The entry to which this time event is assigned\r
+ * @param time\r
+ * The timestamp of this event\r
+ * @param duration\r
+ * The duration of this event\r
+ * @param status\r
+ * The status assigned to the event\r
+ */\r
+ public ControlFlowEvent(ITimeGraphEntry entry, long time, long duration,\r
+ int status) {\r
super(entry, time, duration);\r
fStatus = status;\r
}\r
\r
+ /**\r
+ * Get this event's status\r
+ *\r
+ * @return The integer matching this status\r
+ */\r
public int getStatus() {\r
return fStatus;\r
}\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
import org.eclipse.swt.graphics.RGB;\r
\r
+/**\r
+ * Presentation provider for the control flow view\r
+ */\r
public class ControlFlowPresentationProvider extends TimeGraphPresentationProvider {\r
\r
private enum State {\r
}\r
}\r
\r
- @Override \r
+ @Override\r
public String getStateTypeName() {\r
return Messages.ControlFlowView_stateTypeName;\r
}\r
} catch (TimeRangeException e) {\r
e.printStackTrace();\r
}\r
- } \r
+ }\r
}\r
\r
return retMap;\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.swt.widgets.TreeColumn;\r
import org.eclipse.ui.IActionBars;\r
\r
+/**\r
+ * The Control Flow view main object\r
+ *\r
+ */\r
public class ControlFlowView extends TmfView {\r
\r
// ------------------------------------------------------------------------\r
private long fEndTime;\r
\r
// The display width\r
- private int fDisplayWidth;\r
+ private final int fDisplayWidth;\r
\r
// The zoom thread\r
private ZoomThread fZoomThread;\r
\r
// The previous resource action\r
private Action fPreviousResourceAction;\r
- \r
+\r
// A comparator class\r
- private ControlFlowEntryComparator fControlFlowEntryComparator = new ControlFlowEntryComparator();\r
+ private final ControlFlowEntryComparator fControlFlowEntryComparator = new ControlFlowEntryComparator();\r
\r
// ------------------------------------------------------------------------\r
// Classes\r
}\r
}\r
\r
- \r
+\r
private class ZoomThread extends Thread {\r
- private long fZoomStartTime;\r
- private long fZoomEndTime;\r
- private long fResolution;\r
- private IProgressMonitor fMonitor;\r
+ private final long fZoomStartTime;\r
+ private final long fZoomEndTime;\r
+ private final long fResolution;\r
+ private final IProgressMonitor fMonitor;\r
\r
public ZoomThread(long startTime, long endTime) {\r
super("ControlFlowView zoom"); //$NON-NLS-1$\r
// Constructors\r
// ------------------------------------------------------------------------\r
\r
+ /**\r
+ * Constructor\r
+ */\r
public ControlFlowView() {\r
super(ID);\r
fDisplayWidth = Display.getDefault().getBounds().width;\r
// Signal handlers\r
// ------------------------------------------------------------------------\r
\r
+ /**\r
+ * Handler for the experiment selected signal\r
+ *\r
+ * @param signal\r
+ * The signal that's received\r
+ */\r
@TmfSignalHandler\r
public void experimentSelected(final TmfExperimentSelectedSignal<? extends ITmfEvent> signal) {\r
if (signal.getExperiment().equals(fSelectedExperiment)) {\r
thread.start();\r
}\r
\r
+ /**\r
+ * Handler for the synch signal\r
+ *\r
+ * @param signal\r
+ * The signal that's received\r
+ */\r
@TmfSignalHandler\r
public void synchToTime(final TmfTimeSynchSignal signal) {\r
if (signal.getSource() == this || fSelectedExperiment == null) {\r
}\r
}\r
final int selectedThread = thread;\r
- \r
+\r
Display.getDefault().asyncExec(new Runnable() {\r
@Override\r
public void run() {\r
});\r
}\r
\r
+ /**\r
+ * Handler for the range sync signal\r
+ *\r
+ * @param signal\r
+ * The signal that's received\r
+ */\r
@TmfSignalHandler\r
public void synchToRange(final TmfRangeSynchSignal signal) {\r
if (signal.getSource() == this || fSelectedExperiment == null) {\r
});\r
}\r
\r
+ /**\r
+ * Handler for the state system build completed signal\r
+ *\r
+ * @param signal\r
+ * The signal that's received\r
+ */\r
@TmfSignalHandler\r
public void stateSystemBuildCompleted (final TmfStateSystemBuildCompleted signal) {\r
final TmfExperiment<?> selectedExperiment = fSelectedExperiment;\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;\r
\r
+/**\r
+ * An entry, or row, in the resource view\r
+ *\r
+ * @author Patrick Tasse\r
+ */\r
public class ResourcesEntry implements ITimeGraphEntry {\r
- public static enum Type { NULL, CPU, IRQ, SOFT_IRQ };\r
\r
- private int fQuark;\r
- private CtfKernelTrace fTrace;\r
+ /** Type of resource */\r
+ public static enum Type {\r
+ /** Null resources (filler rows, etc.) */\r
+ NULL,\r
+ /** Entries for CPUs */\r
+ CPU,\r
+ /** Entries for IRQs */\r
+ IRQ,\r
+ /** Entries for Soft IRQ */\r
+ SOFT_IRQ }\r
+\r
+ private final int fQuark;\r
+ private final CtfKernelTrace fTrace;\r
private ITimeGraphEntry fParent = null;\r
- private ITimeGraphEntry[] children = null;\r
- private String fName;\r
- private Type fType;\r
- private int fId;\r
+ private final ITimeGraphEntry[] children = null;\r
+ private final String fName;\r
+ private final Type fType;\r
+ private final int fId;\r
private long fStartTime;\r
private long fEndTime;\r
private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();\r
private List<ITimeEvent> fZoomedEventList = null;\r
\r
+ /**\r
+ * Standard constructor\r
+ *\r
+ * @param quark\r
+ * The quark of the state system attribute whose state is shown\r
+ * on this row\r
+ * @param trace\r
+ * The trace that this view is talking about\r
+ * @param type\r
+ * Type of entry, see the Type enum\r
+ * @param id\r
+ * The integer id associated with this entry or row\r
+ */\r
public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) {\r
fQuark = quark;\r
fTrace = trace;\r
return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);\r
}\r
\r
+ /**\r
+ * Assign a parent entry to this one, to organize them in a tree in the\r
+ * view.\r
+ *\r
+ * @param parent\r
+ * The parent entry\r
+ */\r
public void setParent(ITimeGraphEntry parent) {\r
fParent = parent;\r
}\r
\r
+ /**\r
+ * Retrieve the attribute quark that's represented by this entry.\r
+ *\r
+ * @return The integer quark\r
+ */\r
public int getQuark() {\r
return fQuark;\r
}\r
\r
+ /**\r
+ * Retrieve the trace that is associated to this Resource view.\r
+ *\r
+ * @return The LTTng 2 kernel trace\r
+ */\r
public CtfKernelTrace getTrace() {\r
return fTrace;\r
}\r
\r
+ /**\r
+ * Get the entry Type of this entry. Uses the inner Type enum.\r
+ *\r
+ * @return The entry type\r
+ */\r
public Type getType() {\r
return fType;\r
}\r
\r
+ /**\r
+ * Get the integer ID associated with this entry.\r
+ *\r
+ * @return The ID\r
+ */\r
public int getId() {\r
return fId;\r
}\r
\r
+ /**\r
+ * Assign the target event list to this view.\r
+ *\r
+ * @param eventList\r
+ * The list of time events\r
+ */\r
public void setEventList(List<ITimeEvent> eventList) {\r
fEventList = eventList;\r
if (eventList != null && eventList.size() > 0) {\r
}\r
}\r
\r
+ /**\r
+ * Assign the zoomed event list to this view.\r
+ *\r
+ * @param eventList\r
+ * The list of "zoomed" time events\r
+ */\r
public void setZoomedEventList(List<ITimeEvent> eventList) {\r
fZoomedEventList = eventList;\r
}\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type;\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent;\r
\r
+/**\r
+ * Time Event implementation specific to the Resource View\r
+ *\r
+ * @author Patrick Tasse\r
+ */\r
public class ResourcesEvent extends TimeEvent {\r
\r
- private Type fType;\r
+ private final Type fType;\r
private int fValue;\r
\r
- public ResourcesEvent(ResourcesEntry entry, long time, long duration, int value) {\r
+ /**\r
+ * Standard constructor\r
+ *\r
+ * @param entry\r
+ * The entry that this event affects\r
+ * @param time\r
+ * The start time of the event\r
+ * @param duration\r
+ * The duration of the event\r
+ * @param value\r
+ * The value type associated to this event\r
+ */\r
+ public ResourcesEvent(ResourcesEntry entry, long time, long duration,\r
+ int value) {\r
super(entry, time, duration);\r
fType = entry.getType();\r
fValue = value;\r
}\r
\r
+ /**\r
+ * Base constructor, with no value assigned\r
+ *\r
+ * @param entry\r
+ * The entry that this event affects\r
+ * @param time\r
+ * The start time of the event\r
+ * @param duration\r
+ * The duration of the event\r
+ */\r
public ResourcesEvent(ResourcesEntry entry, long time, long duration) {\r
super(entry, time, duration);\r
fType = Type.NULL;\r
}\r
\r
+ /**\r
+ * Retrieve the value associated with this event\r
+ *\r
+ * @return The integer value\r
+ */\r
public int getValue() {\r
return fValue;\r
}\r
\r
+ /**\r
+ * Retrieve the type of this entry. Uses the ResourcesEntry.Type interface.\r
+ *\r
+ * @return The entry type\r
+ */\r
public Type getType() {\r
return fType;\r
}\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
import org.eclipse.swt.graphics.RGB;\r
\r
+/**\r
+ * Presentation provider for the Resource view, based on the generic TMF\r
+ * presentation provider.\r
+ *\r
+ * @author Patrick Tasse\r
+ */\r
public class ResourcesPresentationProvider extends TimeGraphPresentationProvider {\r
\r
private enum State {\r
}\r
}\r
\r
- @Override \r
+ @Override\r
public String getStateTypeName() {\r
return Messages.ResourcesView_stateTypeName;\r
}\r
\r
@Override\r
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) {\r
- \r
+\r
Map<String, String> retMap = new HashMap<String, String>();\r
if (event instanceof ResourcesEvent) {\r
\r
\r
// Check for IRQ or Soft_IRQ type\r
if (resourcesEvent.getType().equals(Type.IRQ) || resourcesEvent.getType().equals(Type.SOFT_IRQ)) {\r
- \r
+\r
// Get CPU of IRQ or SoftIRQ and provide it for the tooltip display\r
int cpu = resourcesEvent.getValue();\r
if (cpu >= 0) {\r
retMap.put(Messages.ResourcesView_attributeCpuName, String.valueOf(cpu));\r
}\r
- } \r
- \r
+ }\r
+\r
// Check for type CPU\r
if (resourcesEvent.getType().equals(Type.CPU)) {\r
int status = resourcesEvent.getValue();\r
/*******************************************************************************\r
* Copyright (c) 2012 Ericsson\r
- * \r
+ *\r
* All rights reserved. This program and the accompanying materials are\r
* made available under the terms of the Eclipse Public License v1.0 which\r
* accompanies this distribution, and is available at\r
* http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
* Contributors:\r
* Patrick Tasse - Initial API and implementation\r
*******************************************************************************/\r
import org.eclipse.swt.widgets.Display;\r
import org.eclipse.ui.IActionBars;\r
\r
+/**\r
+ * Main implementation for the LTTng 2.0 kernel Resource view\r
+ *\r
+ * @author Patrick Tasse\r
+ */\r
public class ResourcesView extends TmfView {\r
\r
// ------------------------------------------------------------------------\r
// Constants\r
// ------------------------------------------------------------------------\r
\r
- /**\r
- * View ID.\r
- */\r
+ /** View ID. */\r
public static final String ID = "org.eclipse.linuxtools.lttng2.kernel.ui.views.resources"; //$NON-NLS-1$\r
\r
- /**\r
- * Initial time range\r
- */\r
+ /** Initial time range */\r
private static final long INITIAL_WINDOW_OFFSET = (1L * 100 * 1000 * 1000); // .1sec\r
\r
// ------------------------------------------------------------------------\r
private long fEndTime;\r
\r
// The display width\r
- private int fDisplayWidth;\r
+ private final int fDisplayWidth;\r
\r
// The next resource action\r
private Action fNextResourceAction;\r
\r
private class TraceEntry implements ITimeGraphEntry {\r
// The Trace\r
- private CtfKernelTrace fTrace;\r
+ private final CtfKernelTrace fTrace;\r
// The start time\r
- private long fTraceStartTime;\r
+ private final long fTraceStartTime;\r
// The end time\r
- private long fTraceEndTime; \r
+ private final long fTraceEndTime;\r
// The children of the entry\r
- private ArrayList<ResourcesEntry> fChildren;\r
+ private final ArrayList<ResourcesEntry> fChildren;\r
// The name of entry\r
- private String fName;\r
+ private final String fName;\r
\r
public TraceEntry(CtfKernelTrace trace, String name, long startTime, long endTime) {\r
fTrace = trace;\r
fChildren.add(index, entry);\r
}\r
}\r
- \r
+\r
private static class TraceEntryComparator implements Comparator<ITimeGraphEntry> {\r
@Override\r
public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {\r
}\r
\r
private class ZoomThread extends Thread {\r
- private long fZoomStartTime;\r
- private long fZoomEndTime;\r
- private IProgressMonitor fMonitor;\r
+ private final long fZoomStartTime;\r
+ private final long fZoomEndTime;\r
+ private final IProgressMonitor fMonitor;\r
\r
public ZoomThread(long startTime, long endTime) {\r
super("ResourcesView zoom"); //$NON-NLS-1$\r
entry.setZoomedEventList(null);\r
} else {\r
List<ITimeEvent> zoomedEventList = getEventList(entry, fZoomStartTime, fZoomEndTime, resolution, true, fMonitor);\r
- if (zoomedEventList != null) { \r
+ if (zoomedEventList != null) {\r
entry.setZoomedEventList(zoomedEventList);\r
}\r
}\r
// Constructors\r
// ------------------------------------------------------------------------\r
\r
+ /**\r
+ * Default constructor\r
+ */\r
public ResourcesView() {\r
super(ID);\r
fDisplayWidth = Display.getDefault().getBounds().width;\r
// Signal handlers\r
// ------------------------------------------------------------------------\r
\r
+ /**\r
+ * Handler for the ExperimentSelected signal\r
+ *\r
+ * @param signal\r
+ * The incoming signal\r
+ */\r
@TmfSignalHandler\r
public void experimentSelected(final TmfExperimentSelectedSignal<? extends TmfEvent> signal) {\r
if (signal.getExperiment().equals(fSelectedExperiment)) {\r
thread.start();\r
}\r
\r
+ /**\r
+ * Handler for the TimeSynch signal\r
+ *\r
+ * @param signal\r
+ * The incoming signal\r
+ */\r
@TmfSignalHandler\r
public void synchToTime(final TmfTimeSynchSignal signal) {\r
if (signal.getSource() == this || fSelectedExperiment == null) {\r
});\r
}\r
\r
+ /**\r
+ * Handler for the RangeSynch signal\r
+ *\r
+ * @param signal\r
+ * The incoming signal\r
+ */\r
@TmfSignalHandler\r
public void synchToRange(final TmfRangeSynchSignal signal) {\r
if (signal.getSource() == this || fSelectedExperiment == null) {\r
});\r
}\r
\r
+ /**\r
+ * Handler for the StatesystemBuildCompleted signal\r
+ *\r
+ * @param signal\r
+ * The incoming signal\r
+ */\r
@TmfSignalHandler\r
public void stateSystemBuildCompleted (final TmfStateSystemBuildCompleted signal) {\r
final TmfExperiment<?> selectedExperiment = fSelectedExperiment;\r