}\r
}\r
\r
+ /**\r
+ * Retrieve the currently saved filters\r
+ *\r
+ * @return The array of filters\r
+ */\r
public static ITmfFilterTreeNode[] getSavedFilters() {\r
return fRoot.clone().getChildren();\r
}\r
\r
+ /**\r
+ * Set the passed filters as the currently saved ones.\r
+ *\r
+ * @param filters\r
+ * The filters to save\r
+ */\r
public static void setSavedFilters(ITmfFilterTreeNode[] filters) {\r
fRoot = new TmfFilterRootNode();\r
for (ITmfFilterTreeNode filter : filters) {\r
*/\r
public class FilterView extends TmfView {\r
\r
- public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.filter"; //$NON-NLS-1$\r
+ /** ID for the Filter view */\r
+ public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.filter"; //$NON-NLS-1$\r
\r
- private static final Image SAVE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/save_button.gif"); //$NON-NLS-1$\r
+ private static final Image SAVE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/save_button.gif"); //$NON-NLS-1$\r
private static final Image ADD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$\r
private static final Image DELETE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$\r
private static final Image IMPORT_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/import_button.gif"); //$NON-NLS-1$\r
// Main data structures\r
// ------------------------------------------------------------------------\r
\r
- private FilterViewer fViewer;\r
+ private FilterViewer fViewer;\r
private final ITmfFilterTreeNode fRoot;\r
\r
private final IWorkspace fWorkspace;\r
\r
private SaveAction fSaveAction;\r
- private AddAction fAddAction;\r
- private DeleteAction fDeleteAction;\r
- private ExportAction fExportAction;\r
- private ImportAction fImportAction;\r
+ private AddAction fAddAction;\r
+ private DeleteAction fDeleteAction;\r
+ private ExportAction fExportAction;\r
+ private ImportAction fImportAction;\r
\r
/**\r
* Getter for the Filter Tree Root\r
// ------------------------------------------------------------------------\r
\r
/**\r
- * Default Constructor\r
+ * Default Constructor\r
*/\r
- public FilterView() {\r
- super("Filter"); //$NON-NLS-1$\r
+ public FilterView() {\r
+ super("Filter"); //$NON-NLS-1$\r
\r
- fWorkspace = ResourcesPlugin.getWorkspace();\r
- try {\r
+ fWorkspace = ResourcesPlugin.getWorkspace();\r
+ try {\r
fWorkspace.getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);\r
} catch (CoreException e) {\r
Activator.getDefault().logError("Error refreshing workspace", e); //$NON-NLS-1$\r
/*******************************************************************************
* Copyright (c) 2011, 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
* Bernd Hufmann - Changed to updated histogram data model
/**
* Re-usable histogram widget.
- *
+ *
* It has the following features:
* <ul>
* <li>Y-axis labels displaying min/max count values
* <li>end of the time range
* <li>number of events in that time range
* </ul>
- *
+ *
* @version 1.0
* @author Francois Chouinard
*/
*/
protected final HistogramDataModel fDataModel;
/**
- * The histogram data model scaled to current resolution and screen width.
+ * The histogram data model scaled to current resolution and screen width.
*/
protected HistogramScaledData fScaledData;
/**
* Standard constructor.
- *
+ *
* @param view A reference to the parent TMF view.
* @param parent A parent composite
*/
return fDataModel.getTimeLimit();
}
- /**
- * Returns a data model reference.
+ /**
+ * Returns a data model reference.
* @return data model.
*/
public HistogramDataModel getDataModel() {
// Operations
// ------------------------------------------------------------------------
/**
- * Updates the time range.
+ * Updates the time range.
* @param startTime A start time
* @param endTime A end time.
*/
/**
* Increase the histogram bucket corresponding to [timestamp]
- *
+ *
+ * @param eventCount
+ * The new event count
* @param timestamp
+ * The latest timestamp
*/
public void countEvent(final long eventCount, final long timestamp) {
fDataModel.countEvent(eventCount, timestamp);
/**
* Sets the current event time and refresh the display
- *
+ *
* @param timestamp
+ * The time of the current event
*/
public void setCurrentEvent(final long timestamp) {
fCurrentEventTime = (timestamp > 0) ? timestamp : 0;
/**
* Computes the timestamp of the bucket at [offset]
- *
+ *
* @param offset offset from the left on the histogram
* @return the start timestamp of the corresponding bucket
*/
/**
* Computes the offset of the timestamp in the histogram
- *
+ *
* @param timestamp the timestamp
* @return the offset of the corresponding bucket (-1 if invalid)
*/
public synchronized int getOffset(final long timestamp) {
- if (timestamp < fDataModel.getFirstBucketTime() || timestamp > fDataModel.getEndTime())
+ if (timestamp < fDataModel.getFirstBucketTime() || timestamp > fDataModel.getEndTime()) {
return -1;
+ }
return (int) ((timestamp - fDataModel.getFirstBucketTime()) / fScaledData.fBucketDuration);
}
/**
* Move the currently selected bar cursor to a non-empty bucket.
- *
+ *
* @param keyCode the SWT key code
*/
protected void moveCursor(final int keyCode) {
- if (fScaledData.fCurrentBucket == HistogramScaledData.OUT_OF_RANGE_BUCKET)
+ if (fScaledData.fCurrentBucket == HistogramScaledData.OUT_OF_RANGE_BUCKET) {
return;
+ }
int index;
switch (keyCode) {
case SWT.HOME:
index = 0;
- while (index < fScaledData.fLastBucket && fScaledData.fData[index] == 0)
+ while (index < fScaledData.fLastBucket && fScaledData.fData[index] == 0) {
index++;
- if (index < fScaledData.fLastBucket)
+ }
+ if (index < fScaledData.fLastBucket) {
fScaledData.fCurrentBucket = index;
+ }
break;
case SWT.ARROW_RIGHT:
index = fScaledData.fCurrentBucket + 1;
- while (index < fScaledData.fWidth && fScaledData.fData[index] == 0)
+ while (index < fScaledData.fWidth && fScaledData.fData[index] == 0) {
index++;
- if (index < fScaledData.fLastBucket)
+ }
+ if (index < fScaledData.fLastBucket) {
fScaledData.fCurrentBucket = index;
+ }
break;
case SWT.END:
index = fScaledData.fLastBucket;
- while (index >= 0 && fScaledData.fData[index] == 0)
+ while (index >= 0 && fScaledData.fData[index] == 0) {
index--;
- if (index >= 0)
+ }
+ if (index >= 0) {
fScaledData.fCurrentBucket = index;
+ }
break;
case SWT.ARROW_LEFT:
index = fScaledData.fCurrentBucket - 1;
- while (index >= 0 && fScaledData.fData[index] == 0)
+ while (index >= 0 && fScaledData.fData[index] == 0) {
index--;
- if (index >= 0)
+ }
+ if (index >= 0) {
fScaledData.fCurrentBucket = index;
+ }
break;
default:
*/
@Override
public void modelUpdated() {
- if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null)
+ if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null) {
fCanvas.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
// Retrieve and normalize the data
final int canvasWidth = fCanvas.getBounds().width;
final int canvasHeight = fCanvas.getBounds().height;
- if (canvasWidth <= 0 || canvasHeight <= 0)
+ if (canvasWidth <= 0 || canvasHeight <= 0) {
return;
+ }
fDataModel.setCurrentEvent(fCurrentEventTime);
fScaledData = fDataModel.scaleTo(canvasWidth, canvasHeight, HISTOGRAM_BAR_WIDTH);
synchronized(fScaledData) {
}
}
});
+ }
}
// ------------------------------------------------------------------------
final int canvasHeight = fCanvas.getBounds().height;
// Make sure we have something to draw upon
- if (canvasWidth <= 0 || canvasHeight <= 0)
+ if (canvasWidth <= 0 || canvasHeight <= 0) {
return;
+ }
// Retrieve image; re-create only if necessary
Image image = (Image) fCanvas.getData(IMAGE_KEY);
private void formatImage(final GC imageGC, final Image image) {
- if (fScaledData == null)
+ if (fScaledData == null) {
return;
+ }
final HistogramScaledData scaledData = new HistogramScaledData(fScaledData);
// Draw the current event bar
final int currentBucket = scaledData.fCurrentBucket;
- if (currentBucket >= 0 && currentBucket < limit)
+ if (currentBucket >= 0 && currentBucket < limit) {
drawDelimiter(imageGC, fCurrentEventColor, height, currentBucket);
+ }
// Add a dashed line as a delimiter (at the right of the last bar)
int lastEventIndex = limit - 1;
- while (lastEventIndex >= 0 && scaledData.fData[lastEventIndex] == 0)
+ while (lastEventIndex >= 0 && scaledData.fData[lastEventIndex] == 0) {
lastEventIndex--;
+ }
lastEventIndex += (lastEventIndex < limit - 1) ? 1 : 0;
drawDelimiter(imageGC, fLastEventColor, height, lastEventIndex);
} catch (final Exception e) {
private String formatToolTipLabel(final int index) {
long startTime = fScaledData.getBucketStartTime(fScaledData.fCurrentBucket);
// negative values are possible if time values came into the model in decreasing order
- if (startTime < 0)
+ if (startTime < 0) {
startTime = 0;
+ }
final long endTime = fScaledData.getBucketEndTime(fScaledData.fCurrentBucket);
final int nbEvents = (index >= 0) ? fScaledData.fData[index] : 0;
/*******************************************************************************
* Copyright (c) 2009, 2011, 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:
* William Bourque - Initial API and implementation
* Yuriy Vashchuk - Heritage correction.
/**
* Class to request events for given time range from a trace to fill a HistogramDataModel and HistogramView.
- *
+ *
* @version 1.0
* @author Francois Chouinard
* <p>
/**
* Constructor
- * @param histogram The histogram data model
- * @param range The time range to request data
- * @param rank The index of the first event to retrieve
- * @param nbEvents The number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
- *
+ *
+ * @param histogram
+ * The histogram data model
+ * @param range
+ * The time range to request data
+ * @param rank
+ * The index of the first event to retrieve
+ * @param nbEvents
+ * The number of events requested
+ * @param blockSize
+ * The number of events per block
+ * @param execType
+ * The requested execution priority
+ *
*/
- public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, int rank, int nbEvents, int blockSize, ITmfDataRequest.ExecutionType execType) {
- super(ITmfEvent.class, range, rank, nbEvents, (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, execType);
+ public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
+ int rank, int nbEvents, int blockSize,
+ ITmfDataRequest.ExecutionType execType) {
+ super(ITmfEvent.class, range, rank, nbEvents,
+ (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE,
+ execType);
fHistogram = histogram;
}
// ------------------------------------------------------------------------
// TmfEventRequest
// ------------------------------------------------------------------------
-
+
/**
* Handle the event from the trace by updating the histogram data model.
- *
+ *
* @param event a event from the trace
* @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.core.event.ITmfEvent)
*/
/**
* Complete the request. It also notifies the histogram model about the completion.
- *
+ *
* @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleCompleted()
*/
@Override
/*******************************************************************************
* Copyright (c) 2011, 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
* Bernd Hufmann - Added setter and getter and bar width support
/**
* Convenience class/struct for scaled histogram data.
- *
+ *
* @version 1.0
* @author Francois Chouinard
*/
*/
public int fHeight;
/**
- * Width of one histogram bar (number of pixels).
+ * Width of one histogram bar (number of pixels).
*/
public int fBarWidth;
/**
*/
public long fBucketDuration;
/**
- * The maximum number of events of all buckets.
+ * The maximum number of events of all buckets.
*/
public long fMaxValue;
/**
*/
public int fCurrentBucket;
/**
- * The index of the last bucket.
+ * The index of the last bucket.
*/
public int fLastBucket;
/**
fScalingFactor = other.fScalingFactor;
fFirstBucketTime = other.fFirstBucketTime;
}
-
+
// ------------------------------------------------------------------------
// Setter and Getter
// ------------------------------------------------------------------------
}
/**
- * Set the first event time.
- * @param firstEventTime
+ * Set the first event time.
+ * @param firstEventTime The time to set
*/
public void setFirstBucketTime(long firstEventTime) {
fFirstBucketTime = firstEventTime;
}
-
+
/**
* Returns the time of the last bucket.
* @return last bucket time
public long getLastBucketTime() {
return getBucketStartTime(fLastBucket);
}
-
+
/**
* Returns the time of the bucket start time for given index.
* @param index A bucket index.
public long getBucketStartTime(int index) {
return fFirstBucketTime + index * fBucketDuration;
}
-
+
/**
* Returns the time of the bucket end time for given index.
* @param index A bucket index.
/*******************************************************************************
* Copyright (c) 2011, 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
* Francois Chouinard - Moved from LTTng to TMF
/**
* Class to handle zooming within histogram windows..
- *
+ *
* @version 1.0
* @author Francois Chouinard
* <p>
// Constructors
// ------------------------------------------------------------------------
- public HistogramZoom(Histogram histogram, Canvas canvas, long start, long end) {
+ /**
+ * Standard constructor.
+ *
+ * @param histogram
+ * The parent histogram object
+ * @param canvas
+ * The canvas
+ * @param start
+ * The start time of the zoom area
+ * @param end
+ * The end time of the zoom area
+ */
+ public HistogramZoom(Histogram histogram, Canvas canvas, long start,
+ long end) {
fHistogram = histogram;
fCanvas = canvas;
fAbsoluteStartTime = start;
/**
* The the full time range of the histogram
- *
+ *
* @param startTime the start time the histogram
* @param endTime the end time of the histogram
*/
* @param duration the duration
*/
public synchronized void setNewRange(long startTime, long duration) {
- if (startTime < fAbsoluteStartTime)
+ if (startTime < fAbsoluteStartTime) {
startTime = fAbsoluteStartTime;
+ }
long endTime = startTime + duration;
if (endTime > fAbsoluteEndTime) {
endTime = fAbsoluteEndTime;
- if (endTime - duration > fAbsoluteStartTime)
+ if (endTime - duration > fAbsoluteStartTime) {
startTime = endTime - duration;
- else {
+ } else {
startTime = fAbsoluteStartTime;
}
}
}
private long validateStart(long start) {
- if (start < fAbsoluteStartTime)
+ if (start < fAbsoluteStartTime) {
start = fAbsoluteStartTime;
- if (start > fAbsoluteEndTime)
+ }
+ if (start > fAbsoluteEndTime) {
start = fAbsoluteEndTime - fMinWindowSize;
+ }
return start;
}
private long validateEnd(long start, long end) {
- if (end > fAbsoluteEndTime)
+ if (end > fAbsoluteEndTime) {
end = fAbsoluteEndTime;
- if (end < start + fMinWindowSize)
+ }
+ if (end < start + fMinWindowSize) {
end = start + fMinWindowSize;
+ }
return end;
}
// Constructors
// --------------------------------------------------------------------
- /**
+ /**
* Constructor of inner class to handle consecutive scrolls of mouse wheel.
* @param zoom the histogram zoom reference
*/
// --------------------------------------------------------------------
// Operation
// --------------------------------------------------------------------
-
+
/**
* Increments the number of scroll clicks.
* @param nbScrolls the number to add to the current value
}
}
// Done waiting. Notify the histogram.
- if (!isInterrupted())
+ if (!isInterrupted()) {
fZoom.zoom(nbScrollClick);
+ }
}
}
/*******************************************************************************
* Copyright (c) 2011, 20112 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:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Generalized version based on LTTng
* Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming
- *
+ *
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics;
/**
* The generic Statistics View displays statistics for any kind of traces.
- *
+ *
* It is implemented according to the MVC pattern. - The model is a TmfStatisticsTreeNode built by the State Manager. - The view is built with a
* TreeViewer. - The controller that keeps model and view synchronized is an observer of the model.
* </p>
- *
+ *
* @version 1.0
* @author @author Mathieu Denis
*/
*/
public static final String TMF_STATISTICS_VIEW = "StatisticsView"; //$NON-NLS-1$
/**
- * Refresh frequency
+ * Refresh frequency
*/
protected static final Long STATS_INPUT_CHANGED_REFRESH = 5000L;
/**
/**
* Flag to force request the data from trace
*/
- protected boolean fRequestData = false;
+ protected boolean fRequestData = false;
/**
* Object to store the cursor while waiting for the experiment to load
*/
private Cursor fWaitCursor = null;
/**
- * View instance counter (for multiple statistic views)
+ * View instance counter (for multiple statistic views)
*/
private static int fCountInstance = 0;
/**
* Number of this instance. Used as an instance ID.
*/
- private int fInstanceNb;
+ private final int fInstanceNb;
/**
* Constructor of a statistics view.
- *
+ *
* @param viewName
* The name to give to the view.
*/
/**
* Refresh the view.
+ *
+ * @param complete
+ * Should a pending update be sent afterwards or not
*/
public void modelInputChanged(boolean complete) {
// Ignore update if disposed
- if (fTreeViewer.getTree().isDisposed())
+ if (fTreeViewer.getTree().isDisposed()) {
return;
+ }
fTreeViewer.getTree().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
- if (!fTreeViewer.getTree().isDisposed())
+ if (!fTreeViewer.getTree().isDisposed()) {
fTreeViewer.refresh();
+ }
}
});
-
+
if (complete) {
sendPendingUpdate();
}
/**
* Called when an experiment request has failed or has been canceled Remove the data retrieved from the experiment from the statistics tree.
- *
+ *
* @param name The experiment name
*/
public void modelIncomplete(String name) {
/**
* Handles the signal about disposal of the current experiment.
- *
+ *
* @param signal The disposed signal
*/
@TmfSignalHandler
}
/**
- * Handler called when an experiment is selected. Checks if the experiment has changed
+ * Handler called when an experiment is selected. Checks if the experiment has changed
* and requests the selected experiment if it has not yet been cached.
- *
+ *
* @param signal Contains the information about the selection.
*/
@TmfSignalHandler
if (same) {
// no need to reload data, all traces are already loaded
fTreeViewer.setInput(experimentTreeNode);
-
+
resetUpdateSynchronization();
return;
// set input to a clean data model
fTreeViewer.setInput(treeModelRoot);
-
+
if (fRequestData) {
requestData(experiment, experiment.getTimeRange());
fRequestData = false;
requestData(experiment, signal.getRange());
}
-
+
/**
* Return the size of the request when performing background request.
- *
+ *
* @return the block size for background request.
*/
protected int getIndexPageSize() {
/**
* Returns the quantity of data to retrieve before a refresh of the view is performed
- *
+ *
* @return the quantity of data to retrieve before a refresh of the view is performed.
*/
protected long getInputChangedRefresh() {
/**
* This method can be overridden to implement another way to represent the statistics data and to retrieve the information for display.
- *
+ *
* @return a TmfStatisticsData object.
*/
protected AbsTmfStatisticsTree getStatisticData() {
/**
* This method can be overridden to change the representation of the data in the columns.
- *
+ *
* @return an object implementing ITmfBaseColumnDataProvider.
*/
protected ITmfColumnDataProvider getColumnDataProvider() {
/**
* Constructs the ID based on the experiment name and <code>fInstanceNb</code>
- *
- * @param experimentName the name of the trace name to show in the view
+ *
+ * @param experimentName the name of the trace name to show in the view
* @return a view ID
*/
protected String getTreeID(String experimentName) {
/**
* When the experiment is loading the cursor will be different so the user know the processing is not finished yet.
- *
+ *
* @param waitInd Indicates if we need to show the waiting cursor, or the default one
*/
protected void waitCursor(final boolean waitInd) {
/**
* Perform the request for an experiment and populates the statistics tree with event.
- *
+ *
* @param experiment experiment for which we need the statistics data.
* @param timeRange to request
*/
super.handleData(data);
if (data != null) {
AbsTmfStatisticsTree statisticsData = TmfStatisticsTreeRootFactory.getStatTree(getTreeID(experiment.getName()));
-
+
final String traceName = data.getTrace().getName();
ITmfExtraEventInfo extraInfo = new ITmfExtraEventInfo() {
@Override
fRequest.cancel();
}
}
-
+
/**
* Reset update synchronization information
*/
}
/**
- * Checks if statistic update is ongoing. If it is ongoing the new time range is stored as pending
- *
+ * Checks if statistic update is ongoing. If it is ongoing the new time range is stored as pending
+ *
* @param timeRange - new time range
- * @return true if statistic update is ongoing else false
+ * @return true if statistic update is ongoing else false
*/
protected boolean checkUpdateBusy(TmfTimeRange timeRange) {
synchronized (fStatisticsUpdateSyncObj) {
fStatisticsUpdatePending = true;
fStatisticsUpdateRange = timeRange;
return true;
- }
+ }
fStatisticsUpdateBusy = true;
return false;
}
/*******************************************************************************
* Copyright (c) 2011, 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:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Implementation and Initial API
- *
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Implementation and Initial API
+ *
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
* It allow to implement a tree structure while avoiding the need to run through
* the tree each time you need to add a node at a given place.
* </p>
- *
+ *
* @version 1.0
* @author Mathieu Denis
*/
/**
* <h4>Function to merge many string with more efficacy.</h4>
- *
+ *
* @param strings
* Strings to merge.
* @return A new string containing all the strings.
*/
public synchronized static String mergeString(String... strings) {
fBuilder.setLength(0);
- for (String s : strings)
+ for (String s : strings) {
fBuilder.append(s);
+ }
return fBuilder.toString();
}
/**
* <h4>Get a node.</h4>
- *
+ *
* @param path
* Path to the node.
* @return The node or null.
/**
* <h4>Get the children of a node.</h4>
- *
+ *
* @param path
* Path to the node.
* @return Collection containing the children.
/**
* <h4>Get every children of a node, even if it doesn't have any registered events, as opposed to getChildren</h4>
- *
+ *
* @param path
* Path to the node.
* @return Collection containing all the children.
*/
public abstract Collection<TmfStatisticsTreeNode> getAllChildren(final TmfFixedArray<String> path);
-
+
/**
* <h4>Get the map of existing elements of path classified by parent.</h4>
- *
+ *
* @return The map.
*/
public Map<String, Set<String>> getKeys() {
/**
* <h4>Get or create a node.</h4>
- *
+ *
* @param path
* Path to the node.
* @return The node.
/**
* <h4>Get the parent of a node.</h4>
- *
+ *
* @param path
* Path to the node.
* @return Parent node or null.
*/
public TmfStatisticsTreeNode getParent(final TmfFixedArray<String> path) {
if (path.size() == 1) {
- if (path.equals(ROOT))
+ if (path.equals(ROOT)) {
return null;
- else
+ } else {
return get(ROOT);
+ }
}
return get(path.subArray(0, path.size() - 1));
}
* Must make sure the {@link #getChildren(TmfFixedArray)} on the parent node
* will return the newly created node.
* </p>
- *
+ *
* @param path
* Path of the new node.
*/
* <p>
* Work recursively.
* </p>
- *
+ *
* @param path
* Path to the node.
*/
* Used to draw bar charts in columns.
*/
public interface ITmfColumnPercentageProvider {
+
+ /**
+ * Percentage provider
+ *
+ * @param node
+ * The statistics tree node
+ * @return The value as a percentage
+ */
public double getPercentage(TmfStatisticsTreeNode node);
}
/**
* Constructor with parameters
*
- * @param h header of the column. The name will be shown at the top of the column.
- * @param w width of the column.
- * @param a alignment of the text
- * @param t text to shown as a tooltip when the cursor comes over the header
- * @param l provide all the column element
- * @param c used to compare element between them to be able to classify the content of the columns
- * @param p provide the percentage of a specific element
- */
- public TmfBaseColumnData(String h, int w, int a, String t, ColumnLabelProvider l, ViewerComparator c, ITmfColumnPercentageProvider p) {
+ * @param h
+ * header of the column. The name will be shown at the top of the
+ * column.
+ * @param w
+ * width of the column.
+ * @param a
+ * alignment of the text
+ * @param t
+ * text to shown as a tooltip when the cursor comes over the
+ * header
+ * @param l
+ * provide all the column element
+ * @param c
+ * used to compare element between them to be able to classify
+ * the content of the columns
+ * @param p
+ * provide the percentage of a specific element
+ */
+ public TmfBaseColumnData(String h, int w, int a, String t,
+ ColumnLabelProvider l, ViewerComparator c,
+ ITmfColumnPercentageProvider p) {
fHeader = h;
fWidth = w;
fAlignment = a;
/*******************************************************************************
* Copyright (c) 2011, 2011 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:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Implementation and Initial API
+ * Mathieu Denis <mathieu.denis@polymtl.ca> - Implementation and Initial API
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
/**
* Create a basic list of columns with providers.
- *
+ *
* @version 1.0
* @author Mathieu Denis
*/
/*******************************************************************************
* Copyright (c) 2011 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:
* Mathieu Denis (mathieu.denis@polymtl.ca) - Initial API
*******************************************************************************/
/**
* Factory class to create and store TMF statistic trees.
- *
+ *
* Based on a given tree node ID a TMF statistic tree is stored internally.
- * A root node is created for each tree. Using the tree node ID the statistics
- * tree can be retrieved.
- *
+ * A root node is created for each tree. Using the tree node ID the statistics
+ * tree can be retrieved.
+ *
* @version 1.0
* @author Mathieu Denis
*
/**
* Provide a statisticsTree instance per trace
- *
+ *
+ * @param traceUniqueId
+ * Unique ID for the trace
* @return the corresponding trace statistics tree
*/
public static TmfStatisticsTreeNode getStatTreeRoot(String traceUniqueId) {
}
/**
- *
+ * Get the tree that's being used for statistics
+ *
* @param traceUniqueId
+ * Unique ID for the trace
* @return the corresponding trace statistics tree
*/
public static AbsTmfStatisticsTree getStatTree(String traceUniqueId) {
- if (traceUniqueId == null)
+ if (traceUniqueId == null) {
return null;
+ }
AbsTmfStatisticsTree tree = fTreeInstances.get(traceUniqueId);
return tree;
}
/**
- * Add the new trace statistics data in the tree. Can be used later on if the same traces is selected back.
- *
+ * Add the new trace statistics data in the tree. Can be used later on if
+ * the same traces is selected back.
+ *
* @param traceUniqueId
- * the name of the trace which will be used as a key to store the data. Must be different for each traces, otherwise the traces might
- * be overwritten which would trigger a reload of the same trace.
+ * The name of the trace which will be used as a key to store the
+ * data. Must be different for each traces, otherwise the traces
+ * might be overwritten which would trigger a reload of the same
+ * trace.
* @param statsData
- * the information about the trace
+ * The information about the trace
*/
public static void addStatsTreeRoot(String traceUniqueId, AbsTmfStatisticsTree statsData) {
- if (traceUniqueId == null || statsData == null)
+ if (traceUniqueId == null || statsData == null) {
return;
+ }
fTreeInstances.put(traceUniqueId, statsData);
// if called for the first time, create the root node
}
/**
- *
+ * Return if the given trace is currently known by the statistics manager.
+ *
* @param traceUniqueId
+ * The unique ID of the trace
* @return true if the trace id is known
*/
public static boolean containsTreeRoot(String traceUniqueId) {
/**
* Remove previously registered statistics tree.
- *
+ *
* @param traceUniqueId
+ * The unique ID of the trace
*/
public static void removeStatTreeRoot(String traceUniqueId) {
if (traceUniqueId != null && fTreeInstances.containsKey(traceUniqueId)) {
\r
}\r
\r
+ /**\r
+ * Add a time event to the time chart entry\r
+ *\r
+ * @param timeEvent\r
+ * The event to add\r
+ */\r
public void addTraceEvent(ITimeEvent timeEvent) {\r
long time = timeEvent.getTime();\r
synchronized (fTraceEvents) {\r
}\r
}\r
\r
+ /**\r
+ * Retrieve the trace associated with this entry\r
+ *\r
+ * @return The trace object\r
+ */\r
public ITmfTrace<?> getTrace() {\r
return fTrace;\r
}\r
\r
+ /**\r
+ * Set the last rank of the entry\r
+ *\r
+ * @param rank\r
+ * The rank to set\r
+ */\r
public void setLastRank(long rank) {\r
fLastRank = rank;\r
}\r
\r
+ /**\r
+ * Retrieve the last rank of the entry\r
+ *\r
+ * @return The last rank\r
+ */\r
public long getLastRank() {\r
return fLastRank;\r
}\r
private ITmfFilter fFilterFilter;\r
private ITmfFilter fSearchFilter;\r
\r
- public TimeChartDecorationProvider(IFile bookmarksFile) {\r
- fBookmarksFile = bookmarksFile;\r
- refreshBookmarks();\r
+ /**\r
+ * Constructor\r
+ *\r
+ * @param bookmarksFile\r
+ * Bookmark file associated with the trace\r
+ */\r
+ public TimeChartDecorationProvider(IFile bookmarksFile) {\r
+ fBookmarksFile = bookmarksFile;\r
+ refreshBookmarks();\r
}\r
\r
- public IFile getBookmarksFile() {\r
- return fBookmarksFile;\r
- }\r
+ /**\r
+ * Retrieve the bookmark file that was assigned to this provider\r
+ *\r
+ * @return The bookmark file\r
+ */\r
+ public IFile getBookmarksFile() {\r
+ return fBookmarksFile;\r
+ }\r
\r
- public boolean isBookmark(long rank) {\r
- return fBookmarksSet.contains(rank);\r
+ /**\r
+ * Verify if the selected rank has a bookmark assigned to it.\r
+ *\r
+ * @param rank\r
+ * The rank to check for\r
+ * @return If there is a bookmark there\r
+ */\r
+ public boolean isBookmark(long rank) {\r
+ return fBookmarksSet.contains(rank);\r
}\r
\r
- public void refreshBookmarks() {\r
- try {\r
- fBookmarksSet.clear();\r
- for (IMarker bookmark : fBookmarksFile.findMarkers(IMarker.BOOKMARK, false, IResource.DEPTH_ZERO)) {\r
- int location = bookmark.getAttribute(IMarker.LOCATION, -1);\r
- if (location != -1) {\r
- Long rank = (long) location;\r
- fBookmarksSet.add(rank);\r
- }\r
- }\r
+ /**\r
+ * Refresh the bookmark display.\r
+ */\r
+ public void refreshBookmarks() {\r
+ try {\r
+ fBookmarksSet.clear();\r
+ for (IMarker bookmark : fBookmarksFile.findMarkers(\r
+ IMarker.BOOKMARK, false, IResource.DEPTH_ZERO)) {\r
+ int location = bookmark.getAttribute(IMarker.LOCATION, -1);\r
+ if (location != -1) {\r
+ Long rank = (long) location;\r
+ fBookmarksSet.add(rank);\r
+ }\r
+ }\r
} catch (CoreException e) {\r
Activator.getDefault().logError("Error refreshing bookmarks", e); //$NON-NLS-1$\r
}\r
}\r
\r
- public void filterApplied(ITmfFilter filter) {\r
- fFilterFilter = filter;\r
+ /**\r
+ * Notify that a filter is now applied on the view.\r
+ *\r
+ * @param filter\r
+ * The filter that was applied\r
+ */\r
+ public void filterApplied(ITmfFilter filter) {\r
+ fFilterFilter = filter;\r
}\r
\r
- public boolean isVisible(ITmfEvent event) {\r
- if (fFilterFilter != null) {\r
- return fFilterFilter.matches(event);\r
- }\r
- return true;\r
- }\r
+ /**\r
+ * Check if an event is currently visible in the view or not.\r
+ *\r
+ * @param event\r
+ * The event to check for\r
+ * @return If the event is visible or not\r
+ */\r
+ public boolean isVisible(ITmfEvent event) {\r
+ if (fFilterFilter != null) {\r
+ return fFilterFilter.matches(event);\r
+ }\r
+ return true;\r
+ }\r
\r
- public void searchApplied(ITmfFilter filter) {\r
- fSearchFilter = filter;\r
+ /**\r
+ * Notify that a search is applied on the view.\r
+ *\r
+ * @param filter\r
+ * The search filter that was applied\r
+ */\r
+ public void searchApplied(ITmfFilter filter) {\r
+ fSearchFilter = filter;\r
}\r
\r
- public boolean isSearchMatch(ITmfEvent event) {\r
- if (fSearchFilter != null) {\r
- return fSearchFilter.matches(event);\r
- }\r
- return false;\r
- }\r
+ /**\r
+ * Verify if the currently active search filter applies to the given event\r
+ * or not.\r
+ *\r
+ * @param event\r
+ * The event to check for\r
+ * @return If the event matches\r
+ */\r
+ public boolean isSearchMatch(ITmfEvent event) {\r
+ if (fSearchFilter != null) {\r
+ return fSearchFilter.matches(event);\r
+ }\r
+ return false;\r
+ }\r
\r
}\r
private TimeChartAnalysisEntry fItemizedEntry;\r
private boolean fItemizing;\r
\r
- public TimeChartEvent(TimeChartAnalysisEntry parentEntry, ITmfEvent event, long rank, TimeChartDecorationProvider decorationProvider) {\r
+ /**\r
+ * Standard constructor\r
+ *\r
+ * @param parentEntry\r
+ * The parent entry\r
+ * @param event\r
+ * The event from which this time chart event originates\r
+ * @param rank\r
+ * The rank of the event in the trace\r
+ * @param decorationProvider\r
+ * The decoration provider to use\r
+ */\r
+ public TimeChartEvent(TimeChartAnalysisEntry parentEntry, ITmfEvent event,\r
+ long rank, TimeChartDecorationProvider decorationProvider) {\r
fParentEntry = parentEntry;\r
fTime = event.getTimestamp().normalize(0, TIMESTAMP_SCALE).getValue();\r
fDuration = 0;\r
return fDuration;\r
}\r
\r
+ /**\r
+ * Retrieve the rank of the trace event which started this time event.\r
+ *\r
+ * @return The rank of the beginning\r
+ */\r
public long getFirstRank() {\r
return fFirstRank;\r
}\r
\r
+ /**\r
+ * Retrieve the rank of the trace event which *finished* this time event.\r
+ *\r
+ * @return The rank of the end\r
+ */\r
public long getLastRank() {\r
return fLastRank;\r
}\r
\r
+ /**\r
+ * Get the list of rank ranges corresponding to this time event.\r
+ *\r
+ * @return The rank range list\r
+ */\r
public RankRangeList getRankRangeList() {\r
return fRankRangeList;\r
}\r
\r
+ /**\r
+ * Merge another time event with this one.\r
+ *\r
+ * @param event\r
+ * The other event\r
+ */\r
public void merge(TimeChartEvent event) {\r
mergeDecorations(event);\r
if (fTime == event.getTime() && fDuration == event.getDuration()) {\r
}\r
}\r
\r
+ /**\r
+ * Merge the decorations of another time event with the decorations of this\r
+ * one.\r
+ *\r
+ * @param event\r
+ * The other event\r
+ */\r
public void mergeDecorations(TimeChartEvent event) {\r
fColorSettingPriority = Math.min(fColorSettingPriority, event.getColorSettingPriority());\r
fIsBookmark |= event.fIsBookmark;\r
fIsSearchMatch |= event.fIsSearchMatch;\r
}\r
\r
+ /**\r
+ * Get the number of time events that have been merged with this one (starts\r
+ * counting at 1 if no merge happened).\r
+ *\r
+ * @return The current number of events in the bath\r
+ */\r
public long getNbEvents() {\r
return fNbEvents;\r
}\r
\r
+ /**\r
+ * Retrieve the color setting priority.\r
+ *\r
+ * @return The priority\r
+ */\r
public int getColorSettingPriority() {\r
return fColorSettingPriority;\r
}\r
\r
+ /**\r
+ * Set the color setting priority.\r
+ *\r
+ * @param priority\r
+ * The priority to set\r
+ */\r
public void setColorSettingPriority(int priority) {\r
fColorSettingPriority = priority;\r
}\r
\r
+ /**\r
+ * Check if this time event is bookmarked\r
+ *\r
+ * @return Y/N\r
+ */\r
public boolean isBookmarked() {\r
return fIsBookmark;\r
}\r
\r
+ /**\r
+ * Set this time event to be bookmarked or not.\r
+ *\r
+ * @param isBookmarked\r
+ * Should time time event become a bookmark, or not\r
+ */\r
public void setIsBookmarked(boolean isBookmarked) {\r
fIsBookmark = isBookmarked;\r
}\r
\r
+ /**\r
+ * Check if this time is currently visible or not.\r
+ *\r
+ * @return If the event is visible\r
+ */\r
public boolean isVisible() {\r
return fIsVisible;\r
}\r
\r
+ /**\r
+ * Set this time event to visible (or to non-visible).\r
+ *\r
+ * @param isVisible The new status\r
+ */\r
public void setIsVisible(boolean isVisible) {\r
fIsVisible = isVisible;\r
}\r
\r
+ /**\r
+ * Check if the time event matches the current search.\r
+ *\r
+ * @return If it matches, Y/N\r
+ */\r
public boolean isSearchMatch() {\r
return fIsSearchMatch;\r
}\r
\r
+ /**\r
+ * Mark this event as matching (or non-matching) the current search.\r
+ *\r
+ * @param isSearchMatch\r
+ * The new matching status\r
+ */\r
public void setIsSearchMatch(boolean isSearchMatch) {\r
fIsSearchMatch = isSearchMatch;\r
}\r