From 27f3a03d3cce2e3e9631ddfd56b66e6574b10684 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 12 Jun 2012 17:05:01 -0400 Subject: [PATCH] lttng: Javadoc udpate for the lttng2.kernel.ui package Signed-off-by: Alexandre Montplaisir --- .../lttng2/kernel/ui/tests/ActivatorTest.java | 5 +- .../lttng2/kernel/ui/tests/AllTests.java | 5 +- .../internal/lttng2/kernel/ui/Activator.java | 45 +++++++--- .../internal/lttng2/kernel/ui/Messages.java | 7 +- .../ui/viewers/events/LTTng2EventsTable.java | 11 +++ .../kernel/ui/viewers/events/Messages.java | 1 + .../kernel/ui/views/PerspectiveFactory.java | 16 ++-- .../kernel/ui/views/common/EventIterator.java | 35 ++++++-- .../views/controlflow/ControlFlowEntry.java | 90 +++++++++++++++++-- .../views/controlflow/ControlFlowEvent.java | 29 +++++- .../ControlFlowPresentationProvider.java | 11 ++- .../ui/views/controlflow/ControlFlowView.java | 53 ++++++++--- .../ui/views/resources/ResourcesEntry.java | 85 ++++++++++++++++-- .../ui/views/resources/ResourcesEvent.java | 46 +++++++++- .../ResourcesPresentationProvider.java | 20 +++-- .../ui/views/resources/ResourcesView.java | 66 ++++++++++---- 16 files changed, 427 insertions(+), 98 deletions(-) diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/ActivatorTest.java b/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/ActivatorTest.java index 90b2c42a09..6f9a0866d8 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/ActivatorTest.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/ActivatorTest.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -26,6 +26,7 @@ import org.junit.Test; * Test suite for the Activator class *

*/ +@SuppressWarnings("javadoc") public class ActivatorTest extends TestCase { // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/AllTests.java b/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/AllTests.java index a892186bff..b9a4109080 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/AllTests.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/tests/AllTests.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -19,6 +19,7 @@ import junit.framework.TestSuite; * AllTests *

*/ +@SuppressWarnings("javadoc") public class AllTests { public static Test suite() { diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Activator.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Activator.java index 910f4f5414..0a2e626df9 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Activator.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Activator.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -95,14 +95,35 @@ public class Activator extends AbstractUIPlugin { // 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) { @@ -111,19 +132,19 @@ public class Activator extends AbstractUIPlugin { } 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 */ @@ -133,16 +154,16 @@ public class Activator extends AbstractUIPlugin { /** * 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 */ @@ -152,16 +173,16 @@ public class Activator extends AbstractUIPlugin { /** * 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 */ diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java index b4905ea59c..4782fcd9a1 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java @@ -2,6 +2,7 @@ package org.eclipse.linuxtools.internal.lttng2.kernel.ui; 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.messages"; //$NON-NLS-1$ @@ -10,13 +11,13 @@ public class Messages extends NLS { public static String ControlFlowView_ptidColumn; public static String ControlFlowView_processColumn; public static String ControlFlowView_traceColumn; - + public static String ControlFlowView_stateTypeName; public static String ControlFlowView_nextProcessActionNameText; public static String ControlFlowView_nextProcessActionToolTipText; public static String ControlFlowView_previousProcessActionNameText; public static String ControlFlowView_previousProcessActionToolTipText; - + public static String ControlFlowView_attributeSyscallName; public static String ResourcesView_stateTypeName; @@ -27,7 +28,7 @@ public class Messages extends NLS { public static String ResourcesView_attributeCpuName; public static String ResourcesView_attributeIrqName; public static String ResourcesView_attributeSoftIrqName; - + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/LTTng2EventsTable.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/LTTng2EventsTable.java index 47791c7bc1..7a413ad5fb 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/LTTng2EventsTable.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/LTTng2EventsTable.java @@ -20,6 +20,9 @@ import org.eclipse.linuxtools.tmf.ui.widgets.virtualtable.ColumnData; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; +/** + * Events table specific for LTTng 2.0 kernel traces + */ public class LTTng2EventsTable extends TmfEventsTable { // ------------------------------------------------------------------------ @@ -49,6 +52,14 @@ public class LTTng2EventsTable extends TmfEventsTable { // Constructor // ------------------------------------------------------------------------ + /** + * Constructor + * + * @param parent + * The parent composite + * @param cacheSize + * The size of the rows cache + */ public LTTng2EventsTable(Composite parent, int cacheSize) { super(parent, cacheSize, COLUMN_DATA); fTable.getColumns()[0].setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP); diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/Messages.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/Messages.java index 2fa90a001e..9c3c6120ed 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/Messages.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/viewers/events/Messages.java @@ -2,6 +2,7 @@ package org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events; 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; diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/PerspectiveFactory.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/PerspectiveFactory.java index 67873e7998..186bf6db58 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/PerspectiveFactory.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/PerspectiveFactory.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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 *******************************************************************************/ @@ -27,7 +27,7 @@ import org.eclipse.ui.IPerspectiveFactory; */ 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 @@ -45,7 +45,7 @@ public class PerspectiveFactory implements IPerspectiveFactory { /* * (non-Javadoc) - * + * * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) */ @Override @@ -76,7 +76,7 @@ public class PerspectiveFactory implements IPerspectiveFactory { // 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 @@ -89,7 +89,7 @@ public class PerspectiveFactory implements IPerspectiveFactory { /** * Add fast views to the perspective - * + * * @param layout */ private void addFastViews(IPageLayout layout) { @@ -97,7 +97,7 @@ public class PerspectiveFactory implements IPerspectiveFactory { /** * Add view shortcuts to the perspective - * + * * @param layout */ private void addViewShortcuts(IPageLayout layout) { @@ -105,7 +105,7 @@ public class PerspectiveFactory implements IPerspectiveFactory { /** * Add perspective shortcuts to the perspective - * + * * @param layout */ private void addPerspectiveShortcuts(IPageLayout layout) { diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/common/EventIterator.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/common/EventIterator.java index 18a8a9e78d..d1acc54c55 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/common/EventIterator.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/common/EventIterator.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -19,10 +19,13 @@ import java.util.NoSuchElementException; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent; +/** + * An iterator for time events + */ public class EventIterator implements Iterator { - private long fStartTime; - private long fEndTime; + private final long fStartTime; + private final long fEndTime; private List fEventList; private List fZoomedEventList; private long fZoomedStartTime; @@ -32,11 +35,33 @@ public class EventIterator implements Iterator { private ITimeEvent fNext = null; private ITimeEvent fZoomedNext = null; + /** + * Basic constructor, with start time and end times equal to the lowest and + * highest values possible, respectively. + * + * @param eventList + * The list on which this iterator will iterate + * @param zoomedEventList + * The "zoomed" list + */ public EventIterator(List eventList, List zoomedEventList) { this(eventList, zoomedEventList, Long.MIN_VALUE, Long.MAX_VALUE); } - public EventIterator(List eventList, List zoomedEventList, long startTime, long endTime) { + /** + * Complete constructor, where we specify start and end times. + * + * @param eventList + * The list on which this iterator will iterate + * @param zoomedEventList + * The "zoomed" list + * @param startTime + * The start time + * @param endTime + * The end time + */ + public EventIterator(List eventList, + List zoomedEventList, long startTime, long endTime) { fEventList = eventList; fZoomedEventList = zoomedEventList; if (zoomedEventList != null && zoomedEventList.size() > 0) { diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java index c7401d019d..0bf076993d 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -21,20 +21,44 @@ import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; +/** + * An entry in the Control Flow view + */ public class ControlFlowEntry implements ITimeGraphEntry { - private int fThreadQuark; - private CtfKernelTrace fTrace; + private final int fThreadQuark; + private final CtfKernelTrace fTrace; private ControlFlowEntry fParent = null; - private ArrayList fChildren = new ArrayList(); - private String fName; - private int fThreadId; - private int fParentThreadId; + private final ArrayList fChildren = new ArrayList(); + private final String fName; + private final int fThreadId; + private final int fParentThreadId; private long fBirthTime = -1; private long fStartTime = -1; private long fEndTime = -1; private List fEventList = new ArrayList(); private List fZoomedEventList = null; + /** + * Constructor + * + * @param threadQuark + * The attribute quark matching the thread + * @param trace + * The trace on which we are working + * @param execName + * The exec_name of this entry + * @param threadId + * The TID of the thread + * @param parentThreadId + * the Parent_TID of this thread + * @param birthTime + * The birth time of this entry (this allows separating different + * process that could have the same TID) + * @param startTime + * The start time of this process's lifetime + * @param endTime + * The end time of this process + */ public ControlFlowEntry(int threadQuark, CtfKernelTrace trace, String execName, int threadId, int parentThreadId, long birthTime, long startTime, long endTime) { fThreadQuark = threadQuark; fTrace = trace; @@ -91,26 +115,57 @@ public class ControlFlowEntry implements ITimeGraphEntry { return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime); } + /** + * Get the quark of the attribute matching this thread's TID + * + * @return The quark + */ public int getThreadQuark() { return fThreadQuark; } + /** + * Get the CTF trace object + * + * @return The trace + */ public CtfKernelTrace getTrace() { return fTrace; } + /** + * Get this entry's thread ID + * + * @return The TID + */ public int getThreadId() { return fThreadId; } + /** + * Get this thread's parent TID + * + * @return The "PTID" + */ public int getParentThreadId() { return fParentThreadId; } + /** + * Get the birth time of this entry/process + * + * @return The birth time + */ public long getBirthTime() { return fBirthTime; } + /** + * Add an event to this process's timeline + * + * @param event + * The time event + */ public void addEvent(ITimeEvent event) { long start = event.getTime(); long end = start + event.getDuration(); @@ -125,14 +180,33 @@ public class ControlFlowEntry implements ITimeGraphEntry { } } + /** + * Set the general event list of this entry + * + * @param eventList + * The list of time events + */ public void setEventList(List eventList) { fEventList = eventList; } + /** + * Set the zoomed event list of this entry + * + * @param eventList + * The list of time events + */ public void setZoomedEventList(List eventList) { fZoomedEventList = eventList; } + /** + * Add a child entry to this one (to show relationships between processes as + * a tree) + * + * @param child + * The child entry + */ public void addChild(ControlFlowEntry child) { child.fParent = this; fChildren.add(child); diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEvent.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEvent.java index f342b46f56..52d6f6784d 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEvent.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEvent.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -15,15 +15,36 @@ package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent; +/** + * Time Event specific to the control flow view + */ public class ControlFlowEvent extends TimeEvent { - private int fStatus; + private final int fStatus; - public ControlFlowEvent(ITimeGraphEntry entry, long time, long duration, int status) { + /** + * Constructor + * + * @param entry + * The entry to which this time event is assigned + * @param time + * The timestamp of this event + * @param duration + * The duration of this event + * @param status + * The status assigned to the event + */ + public ControlFlowEvent(ITimeGraphEntry entry, long time, long duration, + int status) { super(entry, time, duration); fStatus = status; } + /** + * Get this event's status + * + * @return The integer matching this status + */ public int getStatus() { return fStatus; } diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java index 9ebc6f200e..e0f790de41 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -28,6 +28,9 @@ import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphPresentationProv import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; import org.eclipse.swt.graphics.RGB; +/** + * Presentation provider for the control flow view + */ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvider { private enum State { @@ -44,7 +47,7 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid } } - @Override + @Override public String getStateTypeName() { return Messages.ControlFlowView_stateTypeName; } @@ -114,7 +117,7 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid } catch (TimeRangeException e) { e.printStackTrace(); } - } + } } return retMap; diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java index e68580b1b3..8a27bda95c 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -67,6 +67,10 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.IActionBars; +/** + * The Control Flow view main object + * + */ public class ControlFlowView extends TmfView { // ------------------------------------------------------------------------ @@ -120,7 +124,7 @@ public class ControlFlowView extends TmfView { private long fEndTime; // The display width - private int fDisplayWidth; + private final int fDisplayWidth; // The zoom thread private ZoomThread fZoomThread; @@ -130,9 +134,9 @@ public class ControlFlowView extends TmfView { // The previous resource action private Action fPreviousResourceAction; - + // A comparator class - private ControlFlowEntryComparator fControlFlowEntryComparator = new ControlFlowEntryComparator(); + private final ControlFlowEntryComparator fControlFlowEntryComparator = new ControlFlowEntryComparator(); // ------------------------------------------------------------------------ // Classes @@ -244,12 +248,12 @@ public class ControlFlowView extends TmfView { } } - + private class ZoomThread extends Thread { - private long fZoomStartTime; - private long fZoomEndTime; - private long fResolution; - private IProgressMonitor fMonitor; + private final long fZoomStartTime; + private final long fZoomEndTime; + private final long fResolution; + private final IProgressMonitor fMonitor; public ZoomThread(long startTime, long endTime) { super("ControlFlowView zoom"); //$NON-NLS-1$ @@ -303,6 +307,9 @@ public class ControlFlowView extends TmfView { // Constructors // ------------------------------------------------------------------------ + /** + * Constructor + */ public ControlFlowView() { super(ID); fDisplayWidth = Display.getDefault().getBounds().width; @@ -386,6 +393,12 @@ public class ControlFlowView extends TmfView { // Signal handlers // ------------------------------------------------------------------------ + /** + * Handler for the experiment selected signal + * + * @param signal + * The signal that's received + */ @TmfSignalHandler public void experimentSelected(final TmfExperimentSelectedSignal signal) { if (signal.getExperiment().equals(fSelectedExperiment)) { @@ -401,6 +414,12 @@ public class ControlFlowView extends TmfView { thread.start(); } + /** + * Handler for the synch signal + * + * @param signal + * The signal that's received + */ @TmfSignalHandler public void synchToTime(final TmfTimeSynchSignal signal) { if (signal.getSource() == this || fSelectedExperiment == null) { @@ -442,7 +461,7 @@ public class ControlFlowView extends TmfView { } } final int selectedThread = thread; - + Display.getDefault().asyncExec(new Runnable() { @Override public void run() { @@ -467,6 +486,12 @@ public class ControlFlowView extends TmfView { }); } + /** + * Handler for the range sync signal + * + * @param signal + * The signal that's received + */ @TmfSignalHandler public void synchToRange(final TmfRangeSynchSignal signal) { if (signal.getSource() == this || fSelectedExperiment == null) { @@ -488,6 +513,12 @@ public class ControlFlowView extends TmfView { }); } + /** + * Handler for the state system build completed signal + * + * @param signal + * The signal that's received + */ @TmfSignalHandler public void stateSystemBuildCompleted (final TmfStateSystemBuildCompleted signal) { final TmfExperiment selectedExperiment = fSelectedExperiment; diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java index 4e07d99cfb..d2acc99600 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -21,21 +21,49 @@ import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; +/** + * An entry, or row, in the resource view + * + * @author Patrick Tasse + */ public class ResourcesEntry implements ITimeGraphEntry { - public static enum Type { NULL, CPU, IRQ, SOFT_IRQ }; - private int fQuark; - private CtfKernelTrace fTrace; + /** Type of resource */ + public static enum Type { + /** Null resources (filler rows, etc.) */ + NULL, + /** Entries for CPUs */ + CPU, + /** Entries for IRQs */ + IRQ, + /** Entries for Soft IRQ */ + SOFT_IRQ } + + private final int fQuark; + private final CtfKernelTrace fTrace; private ITimeGraphEntry fParent = null; - private ITimeGraphEntry[] children = null; - private String fName; - private Type fType; - private int fId; + private final ITimeGraphEntry[] children = null; + private final String fName; + private final Type fType; + private final int fId; private long fStartTime; private long fEndTime; private List fEventList = new ArrayList(); private List fZoomedEventList = null; + /** + * Standard constructor + * + * @param quark + * The quark of the state system attribute whose state is shown + * on this row + * @param trace + * The trace that this view is talking about + * @param type + * Type of entry, see the Type enum + * @param id + * The integer id associated with this entry or row + */ public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) { fQuark = quark; fTrace = trace; @@ -89,26 +117,59 @@ public class ResourcesEntry implements ITimeGraphEntry { return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime); } + /** + * Assign a parent entry to this one, to organize them in a tree in the + * view. + * + * @param parent + * The parent entry + */ public void setParent(ITimeGraphEntry parent) { fParent = parent; } + /** + * Retrieve the attribute quark that's represented by this entry. + * + * @return The integer quark + */ public int getQuark() { return fQuark; } + /** + * Retrieve the trace that is associated to this Resource view. + * + * @return The LTTng 2 kernel trace + */ public CtfKernelTrace getTrace() { return fTrace; } + /** + * Get the entry Type of this entry. Uses the inner Type enum. + * + * @return The entry type + */ public Type getType() { return fType; } + /** + * Get the integer ID associated with this entry. + * + * @return The ID + */ public int getId() { return fId; } + /** + * Assign the target event list to this view. + * + * @param eventList + * The list of time events + */ public void setEventList(List eventList) { fEventList = eventList; if (eventList != null && eventList.size() > 0) { @@ -118,6 +179,12 @@ public class ResourcesEntry implements ITimeGraphEntry { } } + /** + * Assign the zoomed event list to this view. + * + * @param eventList + * The list of "zoomed" time events + */ public void setZoomedEventList(List eventList) { fZoomedEventList = eventList; } diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEvent.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEvent.java index a7e65678ad..a2714f71a3 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEvent.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEvent.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -15,26 +15,64 @@ package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources; import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesEntry.Type; import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent; +/** + * Time Event implementation specific to the Resource View + * + * @author Patrick Tasse + */ public class ResourcesEvent extends TimeEvent { - private Type fType; + private final Type fType; private int fValue; - public ResourcesEvent(ResourcesEntry entry, long time, long duration, int value) { + /** + * Standard constructor + * + * @param entry + * The entry that this event affects + * @param time + * The start time of the event + * @param duration + * The duration of the event + * @param value + * The value type associated to this event + */ + public ResourcesEvent(ResourcesEntry entry, long time, long duration, + int value) { super(entry, time, duration); fType = entry.getType(); fValue = value; } + /** + * Base constructor, with no value assigned + * + * @param entry + * The entry that this event affects + * @param time + * The start time of the event + * @param duration + * The duration of the event + */ public ResourcesEvent(ResourcesEntry entry, long time, long duration) { super(entry, time, duration); fType = Type.NULL; } + /** + * Retrieve the value associated with this event + * + * @return The integer value + */ public int getValue() { return fValue; } + /** + * Retrieve the type of this entry. Uses the ResourcesEntry.Type interface. + * + * @return The entry type + */ public Type getType() { return fType; } diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java index d972a9d3f3..d53de1f102 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesPresentationProvider.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -30,6 +30,12 @@ import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.TimeGraphPresentationProv import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; import org.eclipse.swt.graphics.RGB; +/** + * Presentation provider for the Resource view, based on the generic TMF + * presentation provider. + * + * @author Patrick Tasse + */ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider { private enum State { @@ -50,7 +56,7 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider } } - @Override + @Override public String getStateTypeName() { return Messages.ResourcesView_stateTypeName; } @@ -131,7 +137,7 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider @Override public Map getEventHoverToolTipInfo(ITimeEvent event) { - + Map retMap = new HashMap(); if (event instanceof ResourcesEvent) { @@ -139,14 +145,14 @@ public class ResourcesPresentationProvider extends TimeGraphPresentationProvider // Check for IRQ or Soft_IRQ type if (resourcesEvent.getType().equals(Type.IRQ) || resourcesEvent.getType().equals(Type.SOFT_IRQ)) { - + // Get CPU of IRQ or SoftIRQ and provide it for the tooltip display int cpu = resourcesEvent.getValue(); if (cpu >= 0) { retMap.put(Messages.ResourcesView_attributeCpuName, String.valueOf(cpu)); } - } - + } + // Check for type CPU if (resourcesEvent.getType().equals(Type.CPU)) { int status = resourcesEvent.getValue(); diff --git a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java index 6c596ad7ad..8645913d4e 100644 --- a/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java +++ b/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Patrick Tasse - Initial API and implementation *******************************************************************************/ @@ -58,20 +58,21 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IActionBars; +/** + * Main implementation for the LTTng 2.0 kernel Resource view + * + * @author Patrick Tasse + */ public class ResourcesView extends TmfView { // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - /** - * View ID. - */ + /** View ID. */ public static final String ID = "org.eclipse.linuxtools.lttng2.kernel.ui.views.resources"; //$NON-NLS-1$ - /** - * Initial time range - */ + /** Initial time range */ private static final long INITIAL_WINDOW_OFFSET = (1L * 100 * 1000 * 1000); // .1sec // ------------------------------------------------------------------------ @@ -97,7 +98,7 @@ public class ResourcesView extends TmfView { private long fEndTime; // The display width - private int fDisplayWidth; + private final int fDisplayWidth; // The next resource action private Action fNextResourceAction; @@ -114,15 +115,15 @@ public class ResourcesView extends TmfView { private class TraceEntry implements ITimeGraphEntry { // The Trace - private CtfKernelTrace fTrace; + private final CtfKernelTrace fTrace; // The start time - private long fTraceStartTime; + private final long fTraceStartTime; // The end time - private long fTraceEndTime; + private final long fTraceEndTime; // The children of the entry - private ArrayList fChildren; + private final ArrayList fChildren; // The name of entry - private String fName; + private final String fName; public TraceEntry(CtfKernelTrace trace, String name, long startTime, long endTime) { fTrace = trace; @@ -197,7 +198,7 @@ public class ResourcesView extends TmfView { fChildren.add(index, entry); } } - + private static class TraceEntryComparator implements Comparator { @Override public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) { @@ -210,9 +211,9 @@ public class ResourcesView extends TmfView { } private class ZoomThread extends Thread { - private long fZoomStartTime; - private long fZoomEndTime; - private IProgressMonitor fMonitor; + private final long fZoomStartTime; + private final long fZoomEndTime; + private final IProgressMonitor fMonitor; public ZoomThread(long startTime, long endTime) { super("ResourcesView zoom"); //$NON-NLS-1$ @@ -241,7 +242,7 @@ public class ResourcesView extends TmfView { entry.setZoomedEventList(null); } else { List zoomedEventList = getEventList(entry, fZoomStartTime, fZoomEndTime, resolution, true, fMonitor); - if (zoomedEventList != null) { + if (zoomedEventList != null) { entry.setZoomedEventList(zoomedEventList); } } @@ -259,6 +260,9 @@ public class ResourcesView extends TmfView { // Constructors // ------------------------------------------------------------------------ + /** + * Default constructor + */ public ResourcesView() { super(ID); fDisplayWidth = Display.getDefault().getBounds().width; @@ -326,6 +330,12 @@ public class ResourcesView extends TmfView { // Signal handlers // ------------------------------------------------------------------------ + /** + * Handler for the ExperimentSelected signal + * + * @param signal + * The incoming signal + */ @TmfSignalHandler public void experimentSelected(final TmfExperimentSelectedSignal signal) { if (signal.getExperiment().equals(fSelectedExperiment)) { @@ -341,6 +351,12 @@ public class ResourcesView extends TmfView { thread.start(); } + /** + * Handler for the TimeSynch signal + * + * @param signal + * The incoming signal + */ @TmfSignalHandler public void synchToTime(final TmfTimeSynchSignal signal) { if (signal.getSource() == this || fSelectedExperiment == null) { @@ -359,6 +375,12 @@ public class ResourcesView extends TmfView { }); } + /** + * Handler for the RangeSynch signal + * + * @param signal + * The incoming signal + */ @TmfSignalHandler public void synchToRange(final TmfRangeSynchSignal signal) { if (signal.getSource() == this || fSelectedExperiment == null) { @@ -380,6 +402,12 @@ public class ResourcesView extends TmfView { }); } + /** + * Handler for the StatesystemBuildCompleted signal + * + * @param signal + * The incoming signal + */ @TmfSignalHandler public void stateSystemBuildCompleted (final TmfStateSystemBuildCompleted signal) { final TmfExperiment selectedExperiment = fSelectedExperiment; -- 2.34.1