summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMathieu Denis2012-07-27 19:19:06 (EDT)
committer Bernd Hufmann2012-08-03 12:59:54 (EDT)
commitcbc6aff52149ae67d65957220ba99513f5640da4 (patch)
treea145b6d25bfa4c4fc4761b75dc29253e7080bb22
parent6fa9afbfd081bc1a50dcca46cd4dd70855a2a7cd (diff)
downloadorg.eclipse.linuxtools-cbc6aff52149ae67d65957220ba99513f5640da4.zip
org.eclipse.linuxtools-cbc6aff52149ae67d65957220ba99513f5640da4.tar.gz
org.eclipse.linuxtools-cbc6aff52149ae67d65957220ba99513f5640da4.tar.bz2
tmf: Add a column in the statistics view
Bug 383246: Add a column for statistics only in the visible window Change-Id: Ic619c3297f815052e6c90fee7bc87097986fe6ef Signed-off-by: Mathieu Denis <mathieu.denis@polymtl.ca> Reviewed-on: https://git.eclipse.org/r/6984 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Bernd Hufmann <bhufmann@gmail.com> IP-Clean: Bernd Hufmann <bhufmann@gmail.com> Tested-by: Bernd Hufmann <bhufmann@gmail.com> Reviewed-by: Francois Chouinard <fchouinard@gmail.com> IP-Clean: Francois Chouinard <fchouinard@gmail.com> Tested-by: Francois Chouinard <fchouinard@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java2
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java4
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java8
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java18
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java12
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java130
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java168
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties4
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java37
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java59
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java83
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java99
-rwxr-xr-xlttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java16
13 files changed, 515 insertions, 125 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
index 58aafde..037c8c1 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataProviderTest.java
@@ -164,7 +164,7 @@ public class TmfBaseColumnDataProviderTest extends TestCase {
if (columnData.getHeader().compareTo(LEVEL_COLUMN) == 0) {
assertNull("getColumnData", percentProvider);
} else if (columnData.getHeader().compareTo(EVENTS_COUNT_COLUMN) == 0) {
- double percentage = (double) treeNode1.getValue().nbEvents / parentNode.getValue().nbEvents;
+ double percentage = (double) treeNode1.getValue().getTotal() / parentNode.getValue().getTotal();
assertEquals("getColumnData", percentage, percentProvider.getPercentage(treeNode1));
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
index a123c41..89bef92 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseColumnDataTest.java
@@ -83,12 +83,12 @@ public class TmfBaseColumnDataTest extends TestCase {
TmfStatisticsTreeNode parent = node;
do {
parent = parent.getParent();
- } while (parent != null && parent.getValue().nbEvents == 0);
+ } while (parent != null && parent.getValue().getTotal() == 0);
if (parent == null) {
return 0;
}
- return (double) node.getValue().nbEvents / parent.getValue().nbEvents;
+ return (double) node.getValue().getTotal() / parent.getValue().getTotal();
}
};
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
index 7e7ebb2..2ed137a 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfBaseStatisticsDataTest.java
@@ -209,14 +209,14 @@ public class TmfBaseStatisticsDataTest extends TestCase {
*/
public void testRegisterEvent() {
TmfStatisticsTreeNode trace = fStatsData.get(new TmfFixedArray<String>(fTestName));
- assertEquals("registerEvent", 3, trace.getValue().nbEvents);
+ assertEquals("registerEvent", 3, trace.getValue().getTotal());
Collection<TmfStatisticsTreeNode> childrenTreeNode = fStatsData.getChildren(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes));
for (TmfStatisticsTreeNode child : childrenTreeNode) {
if (child.getKey().compareTo(fEvent1.getType().toString()) == 0) {
- assertEquals("registerEvent", 2, child.getValue().nbEvents);
+ assertEquals("registerEvent", 2, child.getValue().getTotal());
} else if (child.getKey().compareTo(fEvent3.getType().toString()) == 0) {
- assertEquals("registerEvent", 1, child.getValue().nbEvents);
+ assertEquals("registerEvent", 1, child.getValue().getTotal());
}
}
}
@@ -232,7 +232,7 @@ public class TmfBaseStatisticsDataTest extends TestCase {
TmfStatisticsTreeNode traceRoot = fStatsData.get(new TmfFixedArray<String>(fTestName));
assertNotNull("get", traceRoot);
assertEquals("get", 0, traceRoot.getPath().toString().compareTo("[" + fTestName + "]"));
- assertEquals("get", 3, traceRoot.getValue().nbEvents);
+ assertEquals("get", 3, traceRoot.getValue().getTotal());
assertEquals("get", 1, traceRoot.getNbChildren());
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
index c9d3d71..e329df9 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/statistics/TmfStatisticsTreeNodeTest.java
@@ -357,11 +357,11 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
TmfStatisticsTreeNode elementNode1 = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
TmfStatisticsTreeNode elementNode2 = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent3.getType().toString()));
- assertEquals("getValue", 0, rootNode.getValue().nbEvents);
- assertEquals("getValue", 3, traceNode.getValue().nbEvents);
- assertEquals("getValue", 0, catNode.getValue().nbEvents);
- assertEquals("getValue", 2, elementNode1.getValue().nbEvents);
- assertEquals("getValue", 1, elementNode2.getValue().nbEvents);
+ assertEquals("getValue", 0, rootNode.getValue().getTotal());
+ assertEquals("getValue", 3, traceNode.getValue().getTotal());
+ assertEquals("getValue", 0, catNode.getValue().getTotal());
+ assertEquals("getValue", 2, elementNode1.getValue().getTotal());
+ assertEquals("getValue", 1, elementNode2.getValue().getTotal());
}
// ------------------------------------------------------------------------
@@ -378,20 +378,20 @@ public class TmfStatisticsTreeNodeTest extends TestCase {
TmfStatisticsTreeNode elementNode = fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString()));
elementNode.reset();
- assertEquals("reset", 0, elementNode.getValue().nbEvents);
+ assertEquals("reset", 0, elementNode.getValue().getTotal());
catNode.reset();
- assertEquals("reset", 0, catNode.getValue().nbEvents);
+ assertEquals("reset", 0, catNode.getValue().getTotal());
assertEquals("reset", 0, catNode.getNbChildren());
assertNull("reset", fStatsData.get(new TmfFixedArray<String>(fTestName, Messages.TmfStatisticsData_EventTypes, fEvent1.getType().toString())));
traceNode.reset();
- assertEquals("reset", 0, traceNode.getValue().nbEvents);
+ assertEquals("reset", 0, traceNode.getValue().getTotal());
// A trace always have at least one child that is eventType
assertEquals("reset", 1, traceNode.getNbChildren());
rootNode.reset();
- assertEquals("reset", 0, rootNode.getValue().nbEvents);
+ assertEquals("reset", 0, rootNode.getValue().getTotal());
assertEquals("reset", 1, rootNode.getNbChildren());
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java
index 2fd8cae..9d9b929 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/Messages.java
@@ -17,7 +17,7 @@ import org.eclipse.osgi.util.NLS;
/**
* Messages file for statistics view strings.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
*/
public class Messages extends NLS {
@@ -39,6 +39,16 @@ public class Messages extends NLS {
*/
public static String TmfStatisticsView_NbEventsTip;
/**
+ * Partial number of events column.
+ * @since 2.0
+ */
+ public static String TmfStatisticsView_NbEventsTimeRangeColumn;
+ /**
+ * Partial number of events column tool tip.
+ * @since 2.0
+ */
+ public static String TmfStatisticsView_NbEventsTimeRangeTip;
+ /**
* String for unknown trace name.
*/
public static String TmfStatisticsView_UnknownTraceName;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java
new file mode 100644
index 0000000..735586b
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsRequest.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * 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> - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.views.statistics;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree;
+import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsTreeRootFactory;
+
+/**
+ * Class for the TMF event requests specific to the statistics view.
+ * @version 2.0
+ */
+class TmfStatisticsRequest extends TmfEventRequest {
+
+ /**
+ * Reference to the statistics viewer that sent the request
+ */
+ private final TmfStatisticsView fSender;
+
+ /**
+ * The experiment for which to send the request
+ */
+ private final TmfExperiment fExperiment;
+
+ /**
+ * Tells if the request is for the whole trace or for a smaller time range
+ */
+ private final boolean fGlobal;
+
+ /**
+ * The statistics tree that will be updated from the requested data
+ */
+ private final AbsTmfStatisticsTree fStatisticsData;
+
+ /**
+ * Constructor
+ *
+ * @param sender
+ * Sender of this request
+ * @param experiment
+ * Experiment targeted by this request
+ * @param range
+ * The target time range
+ * @param index
+ * The starting index
+ * @param prio
+ * The priority of the request
+ * @param global
+ * Is this for a global statistics request (true), or a partial
+ * one (false)?
+ */
+ TmfStatisticsRequest(TmfStatisticsView sender, TmfExperiment experiment, TmfTimeRange range, long index, ExecutionType prio, boolean global) {
+ super(ITmfEvent.class, range, index, TmfDataRequest.ALL_DATA, sender.getIndexPageSize(), prio);
+ String treeID = sender.getTreeID(experiment.getName());
+
+ fSender = sender;
+ fExperiment = experiment;
+ fGlobal = global;
+ fStatisticsData = TmfStatisticsTreeRootFactory.getStatTree(treeID);
+ }
+
+ @Override
+ public void handleData(ITmfEvent data) {
+ super.handleData(data);
+ if (data != null) {
+ final String traceName = data.getTrace().getName();
+ ITmfExtraEventInfo extraInfo = new ITmfExtraEventInfo() {
+ @Override
+ public String getTraceName() {
+ if (traceName == null) {
+ return Messages.TmfStatisticsView_UnknownTraceName;
+ }
+ return traceName;
+ }
+ };
+ if (fGlobal) {
+ fStatisticsData.registerEvent(data, extraInfo);
+ } else {
+ fStatisticsData.registerEventInTimeRange(data, extraInfo);
+ }
+ fStatisticsData.increase(data, extraInfo, 1);
+ // Refresh view
+ if ((getNbRead() % fSender.getInputChangedRefresh()) == 0) {
+ fSender.modelInputChanged(false);
+ }
+ }
+ }
+
+ @Override
+ public void handleSuccess() {
+ super.handleSuccess();
+ fSender.modelInputChanged(true);
+ if (fGlobal) {
+ fSender.waitCursor(false);
+ }
+ }
+
+ @Override
+ public void handleFailure() {
+ super.handleFailure();
+ fSender.modelIncomplete(fExperiment.getName());
+ }
+
+ @Override
+ public void handleCancel() {
+ super.handleCancel();
+ /*
+ * The global request can be cancelled when another experiment is
+ * selected, but a time range request can also be cancelled when there is
+ * a time range update, which means the model must not be deleted.
+ */
+ if (fGlobal) {
+ fSender.modelIncomplete(fExperiment.getName());
+ }
+ }
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
index 73d8eb6..40f4f6d 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java
@@ -9,6 +9,7 @@
* Contributors:
* Mathieu Denis <mathieu.denis@polymtl.ca> - Generalized version based on LTTng
* Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming
+ * Mathieu Denis - New request added to update the statistics from the selected time range
*
*******************************************************************************/
@@ -20,16 +21,15 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentDisposedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentRangeUpdatedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentSelectedSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfExperimentUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
@@ -61,7 +61,7 @@ import org.eclipse.swt.widgets.Listener;
* TreeViewer. - The controller that keeps model and view synchronized is an
* observer of the model.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
*/
public class TmfStatisticsView extends TmfView {
@@ -87,6 +87,20 @@ public class TmfStatisticsView extends TmfView {
protected static final int PAGE_SIZE = 50000;
/**
+ * The initial window span (in nanoseconds)
+ *
+ * @since 2.0
+ */
+ public static final long INITIAL_WINDOW_SPAN = (1L * 100 * 1000 * 1000); // .1sec
+
+ /**
+ * Timestamp scale (nanosecond)
+ *
+ * @since 2.0
+ */
+ public static final byte TIME_SCALE = -9;
+
+ /**
* The actual tree viewer to display
*/
protected TreeViewer fTreeViewer;
@@ -97,6 +111,12 @@ public class TmfStatisticsView extends TmfView {
protected ITmfEventRequest fRequest = null;
/**
+ * Stores the ranged request to the experiment
+ * @since 2.0
+ */
+ protected ITmfEventRequest fRequestRange = null;
+
+ /**
* Update synchronization parameter (used for streaming): Update busy
* indicator
*/
@@ -223,7 +243,7 @@ public class TmfStatisticsView extends TmfView {
event.detail &= ~SWT.SELECTED;
}
- int barWidth = (int) ((fTreeViewer.getTree().getColumn(1).getWidth() - 8) * percentage);
+ int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
int oldAlpha = event.gc.getAlpha();
Color oldForeground = event.gc.getForeground();
Color oldBackground = event.gc.getBackground();
@@ -270,7 +290,8 @@ public class TmfStatisticsView extends TmfView {
* Make sure there is no request running before removing the statistics
* tree
*/
- cancelOngoingRequest();
+ cancelOngoingRequest(fRequestRange);
+ cancelOngoingRequest(fRequest);
// clean the model
TmfStatisticsTreeRootFactory.removeAll();
}
@@ -345,7 +366,13 @@ public class TmfStatisticsView extends TmfView {
if (signal.getExperiment() != TmfExperiment.getCurrentExperiment()) {
return;
}
- cancelOngoingRequest();
+ /*
+ * The range request must be cancelled first, since the global one removes
+ * the statistics tree
+ */
+ cancelOngoingRequest(fRequestRange);
+ cancelOngoingRequest(fRequest);
+ resetTimeRangeValue();
}
/**
@@ -364,7 +391,8 @@ public class TmfStatisticsView extends TmfView {
if (TmfStatisticsTreeRootFactory.containsTreeRoot(getTreeID(experimentName))) {
// The experiment root is already present
- TmfStatisticsTreeNode experimentTreeNode = TmfStatisticsTreeRootFactory.getStatTreeRoot(getTreeID(experimentName));
+ String treeID = getTreeID(experimentName);
+ TmfStatisticsTreeNode experimentTreeNode = TmfStatisticsTreeRootFactory.getStatTreeRoot(treeID);
ITmfTrace[] traces = experiment.getTraces();
@@ -433,6 +461,13 @@ public class TmfStatisticsView extends TmfView {
return;
}
+ // Calculate the selected timerange for the request
+ long startTime = signal.getRange().getStartTime().normalize(0, TIME_SCALE).getValue();
+ TmfTimestamp startTS = new TmfTimestamp(startTime, TIME_SCALE);
+ TmfTimestamp endTS = new TmfTimestamp(startTime + INITIAL_WINDOW_SPAN, TIME_SCALE);
+ TmfTimeRange timeRange = new TmfTimeRange(startTS, endTS);
+
+ requestTimeRangeData(experiment, timeRange);
requestData(experiment, signal.getRange());
}
@@ -454,7 +489,7 @@ public class TmfStatisticsView extends TmfView {
int nbEvents = 0;
for (TmfStatisticsTreeNode node : ((TmfStatisticsTreeNode) fTreeViewer.getInput()).getChildren()) {
- nbEvents += (int) node.getValue().nbEvents;
+ nbEvents += (int) node.getValue().getTotal();
}
/*
@@ -468,6 +503,26 @@ public class TmfStatisticsView extends TmfView {
}
/**
+ * Handles the time range updated signal. It updates the time range
+ * statistics.
+ *
+ * @param signal
+ * Contains the information about the new selected time range.
+ * @since 2.0
+ */
+ @TmfSignalHandler
+ public void timeRangeUpdated(TmfRangeSynchSignal signal) {
+ /*
+ * It is possible that the time range changes while a request is
+ * processing
+ */
+ cancelOngoingRequest(fRequestRange);
+ resetTimeRangeValue();
+
+ requestTimeRangeData(TmfExperiment.getCurrentExperiment(), signal.getCurrentRange());
+ }
+
+ /**
* Return the size of the request when performing background request.
*
* @return the block size for background request.
@@ -554,7 +609,7 @@ public class TmfStatisticsView extends TmfView {
}
/**
- * Perform the request for an experiment and populates the statistics tree
+ * Performs the request for an experiment and populates the statistics tree
* with events.
*
* @param experiment
@@ -572,67 +627,60 @@ public class TmfStatisticsView extends TmfView {
int index = 0;
for (TmfStatisticsTreeNode node : ((TmfStatisticsTreeNode) fTreeViewer.getInput()).getChildren()) {
- index += (int) node.getValue().nbEvents;
+ index += (int) node.getValue().getTotal();
}
- // Preparation of the event request
- fRequest = new TmfEventRequest(ITmfEvent.class, timeRange, index, TmfDataRequest.ALL_DATA, getIndexPageSize(), ExecutionType.BACKGROUND) {
-
- private final AbsTmfStatisticsTree statisticsData = TmfStatisticsTreeRootFactory.getStatTree(getTreeID(experiment.getName()));
-
- @Override
- public void handleData(ITmfEvent data) {
- super.handleData(data);
- if (data != null) {
- final String traceName = data.getTrace().getName();
- ITmfExtraEventInfo extraInfo = new ITmfExtraEventInfo() {
- @Override
- public String getTraceName() {
- if (traceName == null) {
- return Messages.TmfStatisticsView_UnknownTraceName;
- }
- return traceName;
- }
- };
- statisticsData.registerEvent(data, extraInfo);
- statisticsData.increase(data, extraInfo, 1);
- // Refresh View
- if ((getNbRead() % getInputChangedRefresh()) == 0) {
- modelInputChanged(false);
- }
- }
- }
-
- @Override
- public void handleSuccess() {
- super.handleSuccess();
- modelInputChanged(true);
- waitCursor(false);
- }
-
- @Override
- public void handleFailure() {
- super.handleFailure();
- modelIncomplete(experiment.getName());
- }
+ // Prepare the global event request
+ fRequest = new TmfStatisticsRequest(this, experiment, timeRange, index, ExecutionType.BACKGROUND, true);
- @Override
- public void handleCancel() {
- super.handleCancel();
- modelIncomplete(experiment.getName());
- }
- };
experiment.sendRequest(fRequest);
waitCursor(true);
}
}
/**
+ * Performs the time range request for an experiment and populates the
+ * statistics tree with events.
+ *
+ * @param experiment
+ * Experiment for which we need the statistics data.
+ * @param timeRange
+ * To request
+ * @since 2.0
+ */
+ protected void requestTimeRangeData(final TmfExperiment experiment, TmfTimeRange timeRange) {
+ if (experiment != null) {
+
+ // Prepare the partial event request
+ fRequestRange = new TmfStatisticsRequest(this, experiment, timeRange, 0, ExecutionType.FOREGROUND, false);
+ experiment.sendRequest(fRequestRange);
+ }
+ }
+
+ /**
+ * Reset the number of events within the time range
+ *
+ * @since 2.0
+ */
+ protected void resetTimeRangeValue() {
+ // Reset the number of events in the time range
+ String treeID = getTreeID(TmfExperiment.getCurrentExperiment().getName());
+ TmfStatisticsTreeNode treeModelRoot = TmfStatisticsTreeRootFactory.getStatTreeRoot(treeID);
+ if (treeModelRoot.hasChildren()) {
+ treeModelRoot.resetTimeRangeValue();
+ }
+ }
+
+ /**
* Cancels the current ongoing request
+ *
+ * @param request
+ * The request to be canceled
+ * @since 2.0
*/
- protected void cancelOngoingRequest() {
- if (fRequest != null && !fRequest.isCompleted()) {
- fRequest.cancel();
+ protected void cancelOngoingRequest(ITmfEventRequest request) {
+ if (request != null && !request.isCompleted()) {
+ request.cancel();
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties
index 29e0b71..2542d73 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/messages.properties
@@ -1,5 +1,7 @@
TmfStatisticsView_LevelColumn=Level
TmfStatisticsView_LevelColumnTip=Level at which statistics apply.
-TmfStatisticsView_NbEventsColumn=Number of Events
+TmfStatisticsView_NbEventsColumn=Global event count
TmfStatisticsView_NbEventsTip=Total amount of events that are tied to given resource.
+TmfStatisticsView_NbEventsTimeRangeColumn=Partial event count
+TmfStatisticsView_NbEventsTimeRangeTip=Number of events in the selected time range
TmfStatisticsView_UnknownTraceName=Unknown_Trace
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java
index e268f3c..7938047 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/AbsTmfStatisticsTree.java
@@ -27,13 +27,13 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
* while avoiding the need to run through the tree each time you need to add a
* node at a given place.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
*/
public abstract class AbsTmfStatisticsTree {
/**
- * String builder used to merge string with more efficiency.
+ * String builder used to merge string more efficienctly.
*/
protected static final StringBuilder fBuilder = new StringBuilder();
@@ -43,7 +43,7 @@ public abstract class AbsTmfStatisticsTree {
public static final TmfFixedArray<String> ROOT = new TmfFixedArray<String>("root"); //$NON-NLS-1$
/**
- * Function to merge many string with more efficiency.
+ * Function to merge many string more efficienctly.
*
* @param strings
* Strings to merge.
@@ -176,6 +176,19 @@ public abstract class AbsTmfStatisticsTree {
public abstract void registerEvent(ITmfEvent event, ITmfExtraEventInfo extraInfo);
/**
+ * Register an event within a time range.
+ *
+ * This method must be implemented by subclasses.
+ *
+ * @param event
+ * Current event.
+ * @param extraInfo
+ * Extra information to pass along with the event.
+ * @since 2.0
+ */
+ public abstract void registerEventInTimeRange(ITmfEvent event, ITmfExtraEventInfo extraInfo);
+
+ /**
* Register that a new node was created.
*
* Must make sure the {@link #getChildren(TmfFixedArray)} on the parent node
@@ -189,7 +202,7 @@ public abstract class AbsTmfStatisticsTree {
/**
* Reset a node.
*
- * Work recursively.
+ * Works recursively.
*
* @param path
* Path to the node.
@@ -200,4 +213,20 @@ public abstract class AbsTmfStatisticsTree {
fNodes.remove(node.getPath());
}
}
+
+ /**
+ * Reset the time range value of a node.
+ *
+ * Works recursively.
+ *
+ * @param path
+ * Path to the node.
+ * @since 2.0
+ */
+ public void resetTimeRangeValue(final TmfFixedArray<String> path) {
+ for (TmfStatisticsTreeNode node : getChildren(path)) {
+ resetTimeRangeValue(node.getPath());
+ node.resetTimeRangeValue();
+ }
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java
index 7bc3ac3..aee9f60 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseColumnDataProvider.java
@@ -31,7 +31,7 @@ import org.eclipse.ui.PlatformUI;
/**
* Create a basic list of columns with providers.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
*/
public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
@@ -52,6 +52,11 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
protected final static String EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsColumn;
/**
+ * Number of events in time range column names
+ * @since 2.0
+ */
+ protected final static String PARTIAL_EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsTimeRangeColumn;
+ /**
* Level column tooltips
*/
protected final static String LEVEL_COLUMN_TIP = Messages.TmfStatisticsView_LevelColumnTip;
@@ -62,6 +67,11 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
protected final static String EVENTS_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTip;
/**
+ * Number of events in time range column tooltips
+ * @since 2.0
+ */
+ protected final static String PARTIAL_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTimeRangeTip;
+ /**
* Level for which statistics should not be displayed.
*/
protected Set<String> fFolderLevels = new HashSet<String>(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$
@@ -72,6 +82,7 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
public TmfBaseColumnDataProvider() {
/* List that will be used to create the table. */
fColumnData = new Vector<TmfBaseColumnData>();
+ /* Column showing the name of the events and its level in the tree */
fColumnData.add(new TmfBaseColumnData(LEVEL_COLUMN, 200, SWT.LEFT, LEVEL_COLUMN_TIP, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
@@ -96,12 +107,48 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
}
}, null));
- fColumnData.add(new TmfBaseColumnData(EVENTS_COUNT_COLUMN, 125, SWT.LEFT, EVENTS_COUNT_COLUMN_TIP, new ColumnLabelProvider() {
+ /* Column showing the total number of events */
+ fColumnData.add(new TmfBaseColumnData(EVENTS_COUNT_COLUMN, 140, SWT.LEFT, EVENTS_COUNT_COLUMN_TIP, new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
+ if (!fFolderLevels.contains(node.getKey())) {
+ return Long.toString(node.getValue().getTotal());
+ }
+ return ""; //$NON-NLS-1$
+ }
+ }, new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
+ TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
+
+ return (int) (n1.getValue().getTotal() - n2.getValue().getTotal());
+ }
+ }, new ITmfColumnPercentageProvider() {
+
+ @Override
+ public double getPercentage(TmfStatisticsTreeNode node) {
+ TmfStatisticsTreeNode parent = node;
+ do {
+ parent = parent.getParent();
+ } while (parent != null && parent.getValue().getTotal() == 0);
+
+ if (parent == null) {
+ return 0;
+ }
+ return (double) node.getValue().getTotal() / parent.getValue().getTotal();
+ }
+ }));
+
+ /* Column showing the number of events within the selected time range */
+ fColumnData.add(new TmfBaseColumnData(PARTIAL_EVENTS_COUNT_COLUMN, 140, SWT.LEFT, PARTIAL_COUNT_COLUMN_TIP,
+ new ColumnLabelProvider() {
@Override
public String getText(Object element) {
TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) element;
if (!fFolderLevels.contains(node.getKey())) {
- return Long.toString(node.getValue().nbEvents);
+ return Long.toString(node.getValue().getPartial());
}
return ""; //$NON-NLS-1$
}
@@ -111,7 +158,7 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
TmfStatisticsTreeNode n1 = (TmfStatisticsTreeNode) e1;
TmfStatisticsTreeNode n2 = (TmfStatisticsTreeNode) e2;
- return (int) (n1.getValue().nbEvents - n2.getValue().nbEvents);
+ return (int) (n1.getValue().getPartial() - n2.getValue().getPartial());
}
}, new ITmfColumnPercentageProvider() {
@@ -120,12 +167,12 @@ public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
TmfStatisticsTreeNode parent = node;
do {
parent = parent.getParent();
- } while (parent != null && parent.getValue().nbEvents == 0);
+ } while (parent != null && parent.getValue().getPartial() == 0);
if (parent == null) {
return 0;
}
- return (double) node.getValue().nbEvents / parent.getValue().nbEvents;
+ return (double) node.getValue().getPartial() / parent.getValue().getPartial();
}
}));
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java
index 5e835a4..d64bf26 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfBaseStatisticsTree.java
@@ -28,13 +28,13 @@ import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
* This class provides a way to represent statistics data that is compatible
* with every type of trace.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
*/
public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/**
- * Header for the event types categories.
+ * Header for the event type categories.
*/
public static final String HEADER_EVENT_TYPES = Messages.TmfStatisticsData_EventTypes;
@@ -91,7 +91,7 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
TmfStatisticsTreeNode current = null;
for (String value : getKeys().get(path.get(path.size() - 1))) {
current = get(path.append(value));
- if (current != null && current.getValue().nbEvents != 0) {
+ if (current != null && current.getValue().getTotal() != 0) {
result.add(current);
}
}
@@ -153,6 +153,52 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
return result;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#increase(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo, int)
+ */
+ @Override
+ public void increase(ITmfEvent event, ITmfExtraEventInfo extraInfo, int values) {
+ // Do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerEvent(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo)
+ */
+ @Override
+ public void registerEvent(ITmfEvent event, ITmfExtraEventInfo extraInfo) {
+ TmfFixedArray<String>[] paths = getNormalPaths(event, extraInfo);
+ for (TmfFixedArray<String> path : paths) {
+ getOrCreate(path).getValue().incrementTotal();
+ }
+
+ paths = getTypePaths(event, extraInfo);
+ for (TmfFixedArray<String> path : paths) {
+ getOrCreate(path).getValue().incrementTotal();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree#registerEventInTimeRange(org.eclipse.linuxtools.tmf.core.event.ITmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo)
+ */
+ @Override
+ public void registerEventInTimeRange(ITmfEvent event, ITmfExtraEventInfo extraInfo) {
+ TmfFixedArray<String>[] paths = getNormalPaths(event, extraInfo);
+ for (TmfFixedArray<String> path : paths) {
+ getOrCreate(path).getValue().incrementPartial();
+ }
+
+ paths = getTypePaths(event, extraInfo);
+ for (TmfFixedArray<String> path : paths) {
+ getOrCreate(path).getValue().incrementPartial();
+ }
+ }
+
/**
* Get the event types paths.
*
@@ -194,35 +240,8 @@ public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
/*
* (non-Javadoc)
*
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#increase(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo, int)
- */
- @Override
- public void increase(ITmfEvent event, ITmfExtraEventInfo extraInfo, int values) {
- // Do nothing
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerEvent(org.eclipse.linuxtools.tmf.event.TmfEvent, org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfEventInfo)
- */
- @Override
- public void registerEvent(ITmfEvent event, ITmfExtraEventInfo extraInfo) {
- TmfFixedArray<String>[] paths = getNormalPaths(event, extraInfo);
- for (TmfFixedArray<String> path : paths) {
- ++(getOrCreate(path).getValue().nbEvents);
- }
-
- paths = getTypePaths(event, extraInfo);
- for (TmfFixedArray<String> path : paths) {
- ++(getOrCreate(path).getValue().nbEvents);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.AbsTmfStatisticsTree#registerName(org.eclipse.linuxtools.tmf.core.util.TmfFixedArray)
+ * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfStatisticsData#registerName
+ * (org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfFixedArray)
*/
@Override
protected void registerName(TmfFixedArray<String> path) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java
index b5d0f28..49f618b 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatistics.java
@@ -18,12 +18,105 @@ package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
* Contains information about statistics that can be retrieved with any type of
* traces
*
- * @version 1.0
+ * There are two counters : one for the total number of events in the trace and
+ * another for the number of events in the selected time range
+ *
+ * @version 2.0
* @author Mathieu Denis
*/
public class TmfStatistics {
/**
- * Number of events.
+ * Total number of events.
+ *
+ * @since 2.0
+ */
+ protected long fNbEvents = 0;
+ /**
+ * Number of events within a time range (Partial event count).
+ *
+ * @since 2.0
+ */
+ protected long fNbEventsInTimeRange = 0;
+
+ /**
+ * @return the total events count
+ * @since 2.0
+ */
+ public long getTotal() {
+ return fNbEvents;
+ }
+
+ /**
+ * @return the partial events count within a time range
+ * @since 2.0
+ */
+ public long getPartial() {
+ return fNbEventsInTimeRange;
+ }
+
+ /**
+ * Increments by one the total number of events.
+ *
+ * @since 2.0
+ */
+ public void incrementTotal() {
+ ++fNbEvents;
+ }
+
+ /**
+ * Increments <b>nb</b> times the total number of events.
+ *
+ * @param nb
+ * Amount that will be added to the total events count. Ignored
+ * if negative.
+ * @since 2.0
+ */
+ public void incrementTotal(int nb) {
+ if (nb > 0) {
+ fNbEvents += nb;
+ }
+ }
+
+ /**
+ * Increments by one the number of events within a time range (partial events
+ * count).
+ *
+ * @since 2.0
+ */
+ public void incrementPartial() {
+ ++fNbEventsInTimeRange;
+ }
+
+ /**
+ * Increments <b>nb</b> times the number of events within a time range
+ * (partial events count).
+ *
+ * @param nb
+ * Amount that will be added to the partial events count. Ignored
+ * if negative.
+ * @since 2.0
+ */
+ public void incrementPartial(int nb) {
+ if (nb > 0) {
+ fNbEventsInTimeRange += nb;
+ }
+ }
+
+ /**
+ * Resets the total number of events.
+ *
+ * @since 2.0
+ */
+ public void resetTotalCount() {
+ fNbEvents = 0;
+ }
+
+ /**
+ * Resets the number of events within a time range (partial events count).
+ *
+ * @since 2.0
*/
- public long nbEvents = 0;
+ public void resetPartialCount() {
+ fNbEventsInTimeRange = 0;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java
index bfc1de2..4f3d084 100755
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/model/TmfStatisticsTreeNode.java
@@ -25,7 +25,7 @@ import org.eclipse.linuxtools.tmf.core.util.TmfFixedArray;
* array ({@link TmfFixedArray}) of String. The elements of the array represent
* the path from the root to this node.
*
- * @version 1.0
+ * @version 2.0
* @author Mathieu Denis
*/
public class TmfStatisticsTreeNode {
@@ -53,7 +53,8 @@ public class TmfStatisticsTreeNode {
* @param nodes
* Corresponding StatisticsData.
*/
- public TmfStatisticsTreeNode(final TmfFixedArray<String> path, AbsTmfStatisticsTree nodes) {
+ public TmfStatisticsTreeNode(final TmfFixedArray<String> path,
+ AbsTmfStatisticsTree nodes) {
fPath = path;
fNodes = nodes;
fValue = new TmfStatistics();
@@ -154,4 +155,15 @@ public class TmfStatisticsTreeNode {
fValue = new TmfStatistics();
fNodes.reset(fPath);
}
+
+ /**
+ * Resets the number of events in the time range. It doesn't remove any node
+ * and doesn't modify the global event count.
+ *
+ * @since 2.0
+ */
+ public void resetTimeRangeValue() {
+ getValue().resetPartialCount();
+ fNodes.resetTimeRangeValue(fPath);
+ }
}