Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Overholt2011-02-28 04:02:13 +0000
committerAndrew Overholt2011-02-28 04:02:15 +0000
commit06a76551b58ee2fe14f83306a355323091e7c600 (patch)
treeb04fa6f7b24c35353f8c4ee3c260880b711a8315
parentafedfb1b2ab3aad0b8abda8eb063821bb666d19f (diff)
parent789216c5e6f9ff477322663a53750cd845af542b (diff)
downloadorg.eclipse.linuxtools-06a76551b58ee2fe14f83306a355323091e7c600.tar.gz
org.eclipse.linuxtools-06a76551b58ee2fe14f83306a355323091e7c600.tar.xz
org.eclipse.linuxtools-06a76551b58ee2fe14f83306a355323091e7c600.zip
Merge lttng 0.6.2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.headless/src/TmfTraceTest.java12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.tests/ChangeLog13
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/LttngTestPreparation.java8
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java59
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java48
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/AllLTTngCoreTests.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java114
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/.options3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/ChangeLog59
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java68
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java9
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java8
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java20
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java63
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java59
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java16
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsView.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java14
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramRequest.java22
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java98
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/ParentHistogramCanvas.java6
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java47
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java36
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java28
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java27
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java3
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/ChangeLog50
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java425
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java12
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java17
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventField.java10
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java7
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java10
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngSyntheticEvent.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java6
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngBaseEventRequest.java29
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java6
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java69
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java6
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java11
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java10
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java171
-rw-r--r--lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java49
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/ChangeLog23
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/component/TmfEventProviderTest.java27
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfEventContentTest.java23
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfTimeRangeTest.java60
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java52
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfMultiTraceExperimentTest.java53
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedDataRequestTest.java66
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedEventRequestTest.java102
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfDataRequestTest.java40
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfEventRequestTest.java39
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfExperimentTest.java53
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfTraceTest.java44
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/component/TmfSyntheticEventProviderStub.java19
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfDataRequestStub.java4
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfEventRequestStub.java4
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/ChangeLog17
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java33
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/TmfVirtualTable.java278
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/ChangeLog54
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/Tracer.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java95
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEvent.java21
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java24
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventField.java22
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java14
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventType.java34
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimeRange.java17
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java182
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java250
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java11
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java28
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java39
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java98
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java10
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java7
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/ITmfContext.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfContext.java3
-rw-r--r--lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java219
92 files changed, 2170 insertions, 1692 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng.headless/src/TmfTraceTest.java b/lttng/org.eclipse.linuxtools.lttng.headless/src/TmfTraceTest.java
index be3636ed5b..6775ea7514 100644
--- a/lttng/org.eclipse.linuxtools.lttng.headless/src/TmfTraceTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng.headless/src/TmfTraceTest.java
@@ -80,15 +80,11 @@ public class TmfTraceTest extends TmfEventRequest<LttngEvent> {
}
-
@Override
- public void handleData() {
- LttngEvent[] result = getData();
-
- LttngEvent evt = (result.length > 0) ? result[0] : null;
-
- if ( (evt != null) && (PARSE_EVENTS) ) {
- ((LttngEvent) evt).getContent().getFields();
+ public void handleData(LttngEvent event) {
+ super.handleData(event);
+ if ( (event != null) && (PARSE_EVENTS) ) {
+ ((LttngEvent) event).getContent().getFields();
// *** Uncomment the following to print the parsed content
// Warning : this is VERY intensive
diff --git a/lttng/org.eclipse.linuxtools.lttng.tests/ChangeLog b/lttng/org.eclipse.linuxtools.lttng.tests/ChangeLog
new file mode 100644
index 0000000000..8a2ae3e2b2
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng.tests/ChangeLog
@@ -0,0 +1,13 @@
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java (fStartTime): Fixed unit test for updated start time
+
+2010-09-17 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java: Adjusted unit test
+ * src/org/eclipse/linuxtools/lttng/LttngTestPreparation.java: Adjusted unit test
+
+2010-09-09 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/tests/AllLTTngCoreTests.java: Invoke new test
+ * src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java: New test \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/LttngTestPreparation.java b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/LttngTestPreparation.java
index 41fe461273..58739b851f 100644
--- a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/LttngTestPreparation.java
+++ b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/LttngTestPreparation.java
@@ -211,14 +211,10 @@ public abstract class LttngTestPreparation extends TestCase {
// request
validSequence = true;
- TmfEventRequest<T> request = new TmfEventRequest<T>(k,
- trange, TmfDataRequest.ALL_DATA, DEFAULT_CHUNK) {
+ TmfEventRequest<T> request = new TmfEventRequest<T>(k, trange, TmfDataRequest.ALL_DATA, DEFAULT_CHUNK) {
@Override
- public void handleData() {
- T[] result = getData();
-
- T event = (result.length > 0) ? result[0] : null;
+ public void handleData(T event) {
if (event == null) {
System.out
.println("Syntheric Event Received is null, after event: "
diff --git a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java
index 3c7f861b60..ae1536ce4f 100644
--- a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java
@@ -12,6 +12,9 @@
package org.eclipse.linuxtools.lttng.control;
import org.eclipse.linuxtools.lttng.LttngTestPreparation;
+import org.eclipse.linuxtools.lttng.event.LttngEvent;
+import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
+import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
public class LTTngSyntheticEventProviderTest extends LttngTestPreparation {
// ========================================================================
@@ -19,31 +22,31 @@ public class LTTngSyntheticEventProviderTest extends LttngTestPreparation {
// ========================================================================
public void testPlainDataRequest() {
-// // prepare
-// init();
-// TmfExperiment<LttngEvent> experiment = prepareExperimentToTest();
-// TmfEventRequest<LttngEvent> request = prepareEventRequest(
-// LttngEvent.class, 0, 31);
-//
-// // execute
-// experiment.sendRequest(request);
-// try {
-// request.waitForCompletion();
-// } catch (InterruptedException e) {
-// e.printStackTrace();
-// }
-//
-// // finish
-// assertEquals("Unexpected eventCount", 15316, feventCount);
-// boolean expected = true;
-// assertEquals("Events received out of expected order", expected,
-// validSequence);
+ // prepare
+ init();
+ TmfExperiment<LttngEvent> experiment = prepareExperimentToTest();
+ TmfEventRequest<LttngEvent> request = prepareEventRequest(
+ LttngEvent.class, 0, 31);
+
+ // execute
+ experiment.sendRequest(request);
+ try {
+ request.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ // finish
+ assertEquals("Unexpected eventCount", 15316, feventCount);
+ boolean expected = true;
+ assertEquals("Events received out of expected order", expected,
+ validSequence);
}
- /**
- *
- */
- public void testSyntheticEventRequest() {
+// /**
+// *
+// */
+// public void testSyntheticEventRequest() {
// init();
// // Create a new Experiment manager context
// IStateExperimentManager expManager = prepareExperimentContext(false);
@@ -86,16 +89,8 @@ public class LTTngSyntheticEventProviderTest extends LttngTestPreparation {
// }
// System.out.println("EventCount " + feventCount);
//
-//// try {
-//// request1.waitForCompletion();
-//// request2.waitForCompletion();
-//// } catch (InterruptedException e) {
-//// e.printStackTrace();
-//// }
-//// System.out.println("EventCount " + feventCount);
-//
// // finish
// assertEquals("Unexpected eventCount", 3002, feventCount);
- }
+// }
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java
index 3e1c23b78d..7a17ecf4a4 100644
--- a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManagerTextTest.java
@@ -12,10 +12,6 @@
package org.eclipse.linuxtools.lttng.state.experiment;
import org.eclipse.linuxtools.lttng.LttngTestPreparation;
-import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.model.LTTngTreeNode;
-import org.eclipse.linuxtools.lttng.state.trace.StateTraceManager;
-import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
/**
* @author alvaro
@@ -62,28 +58,28 @@ public class StateExperimentManagerTextTest extends LttngTestPreparation {
* .
*/
public void testExperimentSelected_real() {
- // Create a new Experiment manager context
- IStateExperimentManager expManager = prepareExperimentContext(true);
- expManager.waitForCompletion(true);
-
- // make sure a TmfExperiment instance is registered as provider and
- // selected as current
- TmfExperiment<LttngEvent> experiment = prepareExperimentToTest();
-
- // preparation
- expManager.experimentSelected_prep(experiment);
- // Action trigger
- expManager.experimentSelected(this, experiment);
-
- // Access context tree for Validation
- // access to the context tree
- LTTngTreeNode experimentNode = expManager.getSelectedExperiment();
- StateTraceManager traceManager = (StateTraceManager) experimentNode
- .getChildById(0L);
-
- // validate
- int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length;
- assertEquals("Total number of processes created", 276, numProcesses);
+// // Create a new Experiment manager context
+// IStateExperimentManager expManager = prepareExperimentContext(true);
+// expManager.waitForCompletion(true);
+//
+// // make sure a TmfExperiment instance is registered as provider and
+// // selected as current
+// TmfExperiment<LttngEvent> experiment = prepareExperimentToTest();
+//
+// // preparation
+// expManager.experimentSelected_prep(experiment);
+// // Action trigger
+// expManager.experimentSelected(this, experiment);
+//
+// // Access context tree for Validation
+// // access to the context tree
+// LTTngTreeNode experimentNode = expManager.getSelectedExperiment();
+// StateTraceManager traceManager = (StateTraceManager) experimentNode
+// .getChildById(0L);
+//
+// // validate
+// int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length;
+// assertEquals("Total number of processes created", 276, numProcesses);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/AllLTTngCoreTests.java b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/AllLTTngCoreTests.java
index 8e299c97fa..f6bc841e0a 100644
--- a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/AllLTTngCoreTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/AllLTTngCoreTests.java
@@ -19,6 +19,7 @@ import org.eclipse.linuxtools.lttng.tests.jni.JniMarkerFieldTest;
import org.eclipse.linuxtools.lttng.tests.jni.JniMarkerTest;
import org.eclipse.linuxtools.lttng.tests.jni.JniTraceTest;
import org.eclipse.linuxtools.lttng.tests.jni.JniTracefileTest;
+import org.eclipse.linuxtools.lttng.tests.trace.LTTngExperimentTest;
import org.eclipse.linuxtools.lttng.tests.trace.LTTngTextTraceTest;
import org.eclipse.linuxtools.lttng.tests.trace.LTTngTraceTest;
@@ -43,6 +44,7 @@ public class AllLTTngCoreTests {
suite.addTestSuite(LTTngTextTraceTest.class);
suite.addTestSuite(LTTngTraceTest.class);
+ suite.addTestSuite(LTTngExperimentTest.class);
suite.addTestSuite(LTTngSyntheticEventProviderTest.class);
suite.addTestSuite(LTTngSyntheticEventProviderTextTest.class);
diff --git a/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java
new file mode 100644
index 0000000000..4704b0d4e9
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng.tests.trace;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.lttng.tests.LTTngCoreTestPlugin;
+import org.eclipse.linuxtools.lttng.trace.LTTngExperiment;
+import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
+import org.eclipse.linuxtools.tmf.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
+
+/**
+ * <b><u>TmfExperimentTest</u></b>
+ * <p>
+ * TODO: Implement me. Please.
+ */
+public class LTTngExperimentTest extends TestCase {
+
+ private static final String DIRECTORY = "traceset";
+ private static final String TEST_STREAM = "trace-15316events_nolost_newformat";
+ private static final String EXPERIMENT = "MyExperiment";
+ private static int NB_EVENTS = 15316;
+
+ // Note: Start/end times are for the LTTng *trace*, not the actual events
+ private static final TmfTimestamp fStartTime = new TmfTimestamp(13589759412128L, (byte) -9);
+ private static final TmfTimestamp fEndTime = new TmfTimestamp(13589907059242L, (byte) -9);
+
+ private static ITmfTrace[] fTraces;
+ private static LTTngExperiment<TmfEvent> fExperiment;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ private synchronized static ITmfTrace[] setupTrace(String path) {
+ if (fTraces == null) {
+ fTraces = new ITmfTrace[1];
+ try {
+ URL location = FileLocator.find(LTTngCoreTestPlugin.getPlugin().getBundle(), new Path(path), null);
+ File testfile = new File(FileLocator.toFileURL(location).toURI());
+ LTTngTrace trace = new LTTngTrace(testfile.getPath());
+ fTraces[0] = trace;
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return fTraces;
+ }
+
+ private synchronized static void setupExperiment() {
+ if (fExperiment == null) {
+ fExperiment = new LTTngExperiment<TmfEvent>(TmfEvent.class, EXPERIMENT, fTraces, TmfTimestamp.Zero, 1000, true);
+ }
+ }
+
+ public LTTngExperimentTest(String name) throws Exception {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+ setupExperiment();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ // ------------------------------------------------------------------------
+ // Constructor
+ // ------------------------------------------------------------------------
+
+ public void testBasicTmfExperimentConstructor() {
+
+ assertEquals("GetId", EXPERIMENT, fExperiment.getName());
+ assertEquals("GetEpoch", TmfTimestamp.Zero, fExperiment.getEpoch());
+ assertEquals("GetNbEvents", NB_EVENTS, fExperiment.getNbEvents());
+
+ long nbTraceEvents = fExperiment.getTraces()[0].getNbEvents();
+ assertEquals("GetNbEvents", NB_EVENTS, nbTraceEvents);
+
+ TmfTimeRange timeRange = fExperiment.getTimeRange();
+ assertTrue("getStartTime", fStartTime.equals(timeRange.getStartTime()));
+ assertTrue("getEndTime", fEndTime.equals(timeRange.getEndTime()));
+ }
+
+} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/.options b/lttng/org.eclipse.linuxtools.lttng.ui/.options
index 31efb0f57a..723c673179 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/.options
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/.options
@@ -1,3 +1,6 @@
org.eclipse.linuxtools.lttng.ui/debug=false
org.eclipse.linuxtools.lttng.ui/info=false
org.eclipse.linuxtools.lttng.ui/warn=false
+
+org.eclipse.linuxtools.lttng.ui/cfv=false
+org.eclipse.linuxtools.lttng.ui/rv=false
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/ChangeLog b/lttng/org.eclipse.linuxtools.lttng.ui/ChangeLog
index 6cc6fa1704..7c2c205052 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/ChangeLog
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/ChangeLog
@@ -1,3 +1,62 @@
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java (asynchronousNotifyParentUpdatedInformation): Fixed typo
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java (controlMoved): Check for NPE
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java: Cosmetic adjustemnts
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java: Cosmetic adjustemnts
+
+2010-10-13 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java : Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/ParentHistogramCanvas.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java: Added checks for disposed widget
+ * .options: TraceDebug options file
+ * src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java (stop): Closes the trace log file
+ * src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java (toString): Added
+ * src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java (toString): Added
+ * src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java (toString): Added
+ * src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java (toString): Added
+ * src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java: Support for new traces (CFV/RV)
+ * src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java: Fixed a few constants
+ * src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java (getPixelsPerNs): Adjusted field type
+ * src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java: Added debug tracing
+ * src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java: Added debug tracing
+ * src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java: Use default pixels/ns
+
+2010-10-06 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java: Fixed initial time window size (0.1s)
+
+2010-09-17 Francois Chouinard <fchouinard@gmail.com>
+
+ * plugin.xml: Fixed perspective ID
+ * src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramRequest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java: Fixed perspective ID
+
+2010-09-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java: ExecutionType update
+
+2010-09-12 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/events/EventsView.java: Fixed the events cache size
+
+2010-09-09 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java: Hook to LTTngExperiment
+
2010-07-30 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/lttng/ui/views/histogram/ChildrenHistogramCanvas.java:
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml b/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml
index e9fd478e9e..1a00545379 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml
@@ -2,7 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension
- id="org,eclipse.linuxtools.lttng.ui.perspective"
+ id="org.eclipse.linuxtools.lttng.ui.perspective"
name="%extension.name.0"
point="org.eclipse.ui.perspectives">
<perspective
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java
index 460ed6a8f6..37e709163b 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/LTTngUiPlugin.java
@@ -49,6 +49,7 @@ public class LTTngUiPlugin extends AbstractUIPlugin {
*/
@Override
public void stop(BundleContext context) throws Exception {
+ TraceDebug.stop();
plugin = null;
super.stop(context);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java
index c0b24d242d..8dd82a9d8c 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java
@@ -1,5 +1,8 @@
package org.eclipse.linuxtools.lttng.ui;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -14,11 +17,18 @@ public class TraceDebug {
static boolean INFO = false;
static boolean WARN = false;
+ static boolean CFV = false;
+ static boolean RV = false;
+
private static Plugin plugin = LTTngUiPlugin.getDefault();
private static String pluginID = LTTngUiPlugin.PLUGIN_ID;
private static SimpleDateFormat stimeformat = new SimpleDateFormat(
"HH:mm:ss:SSS");
+ // Note: files are created in $HOME
+ static private PrintWriter fCFVfile = null;
+ static private PrintWriter fRVfile = null;
+
public static void init() {
// Update Trace configuration options
String debugTrace = Platform.getDebugOption(pluginID + "/debug");
@@ -36,6 +46,56 @@ public class TraceDebug {
if (warnTrace != null) {
WARN = (new Boolean(warnTrace)).booleanValue();
}
+
+ String cfvTrace = Platform.getDebugOption(pluginID + "/cfv");
+ if (cfvTrace != null) {
+ CFV = (new Boolean(cfvTrace)).booleanValue();
+ if (CFV) {
+ try {
+ fCFVfile = new PrintWriter(new FileWriter("CFVTrace.txt"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ String rvTrace = Platform.getDebugOption(pluginID + "/rv");
+ if (rvTrace != null) {
+ RV = (new Boolean(rvTrace)).booleanValue();
+ if (RV) {
+ try {
+ fRVfile = new PrintWriter(new FileWriter("RVTrace.txt"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public static void stop() {
+ if (fCFVfile != null) {
+ fCFVfile.close();
+ fCFVfile = null;
+ }
+
+ if (fRVfile != null) {
+ fRVfile.close();
+ fRVfile = null;
+ }
+ }
+
+ public static void traceCFV(String trace) {
+ if (CFV && fCFVfile != null) {
+ fCFVfile.println(trace);
+ fCFVfile.flush();
+ }
+ }
+
+ public static void traceRV(String trace) {
+ if (RV && fRVfile != null) {
+ fRVfile.println(trace);
+ fRVfile.flush();
+ }
}
public static void info(String message) {
@@ -129,4 +189,12 @@ public class TraceDebug {
public static boolean isWARN() {
return WARN;
}
+
+ public static boolean isCFV() {
+ return CFV;
+ }
+
+ public static boolean isRV() {
+ return RV;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java
index d7a4fc2d1f..1bef71eff2 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComponent.java
@@ -90,4 +90,11 @@ public abstract class TimeRangeComponent implements ITimeRangeComponent {
public boolean isVisible() {
return visible;
}
+
+ @Override
+ public String toString() {
+ return "[TimeRangeComponent:" + "startTime=" + startTime + ",stopTime=" + stopTime +
+ ",parent=" + (eventParent != null ? eventParent.id : "null") + "]";
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java
index 7cf42f2cd7..21d86de050 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java
@@ -202,4 +202,13 @@ ITmfTimeAnalysisEntry {
public long getInsertionTime() {
return insertionTime;
}
+
+ @Override
+ public String toString() {
+ return "[TimeRangeComposite:" + super.toString() +
+ ",id=" + id + ",name=" + name + ",group=" + groupName + ",class=" + className +
+ ",ctype=" + contType + ",itime=" + insertionTime +
+ ",leaves=" + ChildEventLeafs + ",composites=" + ChildEventComposites + "]";
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java
index 5512996172..82c12dc839 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java
@@ -219,4 +219,12 @@ public class TimeRangeEventProcess extends TimeRangeComposite implements
return 0;
}
+
+ @Override
+ public String toString() {
+ return "[TimeRangeEventProcess:" + super.toString() +
+ ",pid=" + pid + ",tgid=" + tgid + ",ppid=" + ppid + ",ctime=" + creationTime +
+ ",trace=" + traceID + ",ptype=" + processType + ",cpu=" + cpu + ",brand=" + brand + "]";
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java
index b7a417ae9a..5be744cd4e 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java
@@ -128,13 +128,19 @@ public abstract class TimeRangeEventResource extends TimeRangeComposite
*
* @see java.lang.Object#toString()
*/
- @Override
- public String toString() {
- return getResourceId().toString() + ":" + getTraceId().toString() + ":"
- + getType().toString();
- }
-
- /**
+// @Override
+// public String toString() {
+// return getResourceId().toString() + ":" + getTraceId().toString() + ":"
+// + getType().toString();
+// }
+
+ @Override
+ public String toString() {
+ return "[TimeRangeEventResource: " + super.toString() +
+ ",type=" + type + ",resourceId=" + resourceId + "]";
+ }
+
+ /**
* Compare function to implement Comparable<br>
* <br>
* Compare by traceId THEN IF EQUAL by resourceType THEN IF EQUAL by
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java
index bd28bc3c82..081bd4d1be 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/PerspectiveFactory.java
@@ -31,6 +31,9 @@ import org.eclipse.ui.IPerspectiveFactory;
*/
public class PerspectiveFactory implements IPerspectiveFactory {
+ // Perspective ID
+ public static final String ID = "org.eclipse.linuxtools.lttng.ui.perspective";
+
// LTTng views
private static final String PROJECT_VIEW_ID = ProjectView.ID;
private static final String CONTROL_VIEW_ID = ControlView.ID;
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java
index 9664c525f2..57cd0e9248 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java
@@ -45,7 +45,7 @@ public abstract class AbsTRangeUpdate extends AbsStateProcessing implements
*/
protected double getPixelsPerNs(LttngTraceState traceSt, ParamsUpdater params) {
double pixPerNs = params.getPixelsPerNs();
- if (pixPerNs == 0) {
+ if (pixPerNs == 0.0) {
TmfTimeRange tsetRange = traceSt.getContext().getExperimentTimeWindow();
long startTime = tsetRange.getStartTime().getValue();
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java
index 45514254bc..82340348cc 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java
@@ -26,7 +26,6 @@ import org.eclipse.linuxtools.lttng.request.RequestStartedSignal;
import org.eclipse.linuxtools.lttng.state.evProcessor.ITransEventProcessor;
import org.eclipse.linuxtools.lttng.ui.TraceDebug;
import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer;
-import org.eclipse.linuxtools.tmf.event.TmfEvent;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
@@ -57,22 +56,18 @@ import org.eclipse.swt.widgets.Display;
* @author alvaro
*
*/
-public abstract class AbsTimeUpdateView extends TmfView implements
- IRequestStatusListener {
+public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatusListener {
// ========================================================================
// Data
// ========================================================================
- /**
- * One second in nanoseconds
- */
- private static final long INITIAL_WINDOW_OFFSET = 1000000000L; /*
- * 1 sec //
- * in ns //
- */
- // private static final long INITIAL_WINDOW_OFFSET = 100000000L; /* 100 ms
- // in ns */
- /**
+
+// private static final long INITIAL_WINDOW_OFFSET = (1L * 1 * 1000 * 1000); // .001sec
+// private static final long INITIAL_WINDOW_OFFSET = (1L * 10 * 1000 * 1000); // .01sec
+ private static final long INITIAL_WINDOW_OFFSET = (1L * 100 * 1000 * 1000); // .1sec
+// private static final long INITIAL_WINDOW_OFFSET = (1L * 1000 * 1000 * 1000); // 1sec
+
+ /**
* Number of events before a GUI refresh
*/
private static final Long INPUT_CHANGED_REFRESH = 3000L;
@@ -206,7 +201,7 @@ public abstract class AbsTimeUpdateView extends TmfView implements
}
// Clearing of process data is configurable
- dataRequest(trange, experiment.getTimeRange(), clearingData, ExecutionType.SHORT);
+ dataRequest(trange, experiment.getTimeRange(), clearingData, ExecutionType.FOREGROUND);
}
}
}
@@ -373,26 +368,30 @@ public abstract class AbsTimeUpdateView extends TmfView implements
* org.eclipse.linuxtools.lttng.request.LttngSyntEventRequest#handleData
* ()
*/
-// int handleDataCount = 0;
-// int handleDataValidCount = 0;
+//// int handleDataCount = 0;
+//// int handleDataValidCount = 0;
+// @Override
+// public void handleData() {
+// LttngSyntheticEvent[] result = getData();
+//
+// TmfEvent evt = (result.length > 0) ? result[0] : null;
+//// handleDataCount++;
+
@Override
- public void handleData() {
- LttngSyntheticEvent[] result = getData();
-
- TmfEvent evt = (result.length > 0) ? result[0] : null;
-// handleDataCount++;
- if (evt != null) {
+ public void handleData(LttngSyntheticEvent event) {
+ super.handleData(event);
+ if (event != null) {
// handleDataValidCount++;
- LttngSyntheticEvent synEvent = (LttngSyntheticEvent) evt;
+ LttngSyntheticEvent synEvent = (LttngSyntheticEvent) event;
// process event
SequenceInd indicator = synEvent.getSynType();
if (indicator == SequenceInd.BEFORE
|| indicator == SequenceInd.AFTER) {
- processor.process(evt, synEvent.getTraceModel());
+ processor.process(event, synEvent.getTraceModel());
} else if (indicator == SequenceInd.STARTREQ) {
handleRequestStarted();
} else if (indicator == SequenceInd.ENDREQ) {
- processor.process(evt, synEvent.getTraceModel());
+ processor.process(event, synEvent.getTraceModel());
// handleCompleted();
}
@@ -403,7 +402,7 @@ public abstract class AbsTimeUpdateView extends TmfView implements
modelInputChanged(this, false);
if (TraceDebug.isDEBUG()) {
- frunningTimeStamp = evt.getTimestamp();
+ frunningTimeStamp = event.getTimestamp();
TraceDebug.debug("handled: " + fCount + " sequence: " + synEvent.getSynType());
}
@@ -481,13 +480,15 @@ public abstract class AbsTimeUpdateView extends TmfView implements
* @param waitInd
*/
protected void waitCursor(final boolean waitInd) {
- if (tsfviewer != null) {
+ if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
Display display = tsfviewer.getControl().getDisplay();
// Perform the updates on the UI thread
display.asyncExec(new Runnable() {
public void run() {
- tsfviewer.waitCursor(waitInd);
+ if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+ tsfviewer.waitCursor(waitInd);
+ }
}
});
}
@@ -597,14 +598,16 @@ public abstract class AbsTimeUpdateView extends TmfView implements
if (complete) {
// reselect to original time
ParamsUpdater paramUpdater = getParamsUpdater();
- if (paramUpdater != null && tsfviewer != null) {
+ if ((paramUpdater != null) && (tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
final Long selTime = paramUpdater.getSelectedTime();
if (selTime != null) {
TraceDebug.debug("View: " + getName() + "\n\t\tRestoring the selected time to: " + selTime);
Display display = tsfviewer.getControl().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- tsfviewer.setSelectedTime(selTime, false, this);
+ if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+ tsfviewer.setSelectedTime(selTime, false, this);
+ }
}
});
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java
index edc10dd4cc..631fa6944c 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java
@@ -889,36 +889,41 @@ public class ControlFlowView extends AbsTimeUpdateView implements
if(tableViewer != null) {
final Table table = tableViewer.getTable();
+
+ // Ignore update if widget is disposed
+ if (table.isDisposed()) return;
+
Display display = table.getDisplay();
-
+
// Perform the updates on the UI thread)
display.asyncExec(new Runnable() {
public void run() {
-
- tableViewer.setInput(items); // This shall be the minimal
- // initial
- tableFilter = new ViewProcessFilter(tableViewer);
- tableViewer.setFilters(new ViewerFilter[] { tableFilter });
-
- resizeTableColumns(table);
- table.update();
- tableViewer.refresh();
-
- tsfviewer.display(items, startBoundTime, endBoundTime,
- updateTimeBounds);
-
- // validate visible boundaries
- if (startVisibleWindow > -1 && endVisibleWindow > -1) {
- tsfviewer.setSelectVisTimeWindow(startVisibleWindow,
- endVisibleWindow, source);
- }
-
- tsfviewer.resizeControls();
-
- // Adjust the size of the vertical scroll bar to fit the
- // contents
- if (scrollFrame != null) {
- updateScrolls(scrollFrame);
+ if (!table.isDisposed()) {
+ tableViewer.setInput(items); // This shall be the minimal
+ // initial
+ tableFilter = new ViewProcessFilter(tableViewer);
+ tableViewer.setFilters(new ViewerFilter[] { tableFilter });
+
+ resizeTableColumns(table);
+ table.update();
+ tableViewer.refresh();
+
+ tsfviewer.display(items, startBoundTime, endBoundTime,
+ updateTimeBounds);
+
+ // validate visible boundaries
+ if (startVisibleWindow > -1 && endVisibleWindow > -1) {
+ tsfviewer.setSelectVisTimeWindow(startVisibleWindow,
+ endVisibleWindow, source);
+ }
+
+ tsfviewer.resizeControls();
+
+ // Adjust the size of the vertical scroll bar to fit the
+ // contents
+ if (scrollFrame != null) {
+ updateScrolls(scrollFrame);
+ }
}
}
});
@@ -1048,7 +1053,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements
// user to select the interesting area based on the perspective
TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
- dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.SHORT);
+ dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.FOREGROUND);
if (TraceDebug.isDEBUG()) {
TraceDebug.debug("Initialization request time range is: "
+ initTimeWindow.getStartTime().toString() + "-"
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java
index c0a9ccc599..845668cbce 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java
@@ -16,10 +16,11 @@ import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus;
import org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor;
import org.eclipse.linuxtools.lttng.state.model.LttngProcessState;
import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
+import org.eclipse.linuxtools.lttng.ui.TraceDebug;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent.Type;
+import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
import org.eclipse.linuxtools.lttng.ui.views.common.AbsTRangeUpdate;
import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowModelFactory;
@@ -57,6 +58,11 @@ public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILt
localProcess.setTraceID(traceId);
localProcess.setProcessType(stateProcess.getType().getInName());
procContainer.addItem(localProcess);
+
+ if (TraceDebug.isCFV()) {
+ TraceDebug.traceCFV("addLocalProcess():" + localProcess);
+ }
+
return localProcess;
}
@@ -105,6 +111,10 @@ public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILt
long endTime, TimeRangeEventProcess localProcess,
ParamsUpdater params, String stateMode) {
+ if (TraceDebug.isCFV()) {
+ TraceDebug.traceCFV("makeDraw():[" + localProcess + ",candidate=[stime=" + startTime + ",etime=" + endTime + ",state=" + stateMode + "]]");
+ }
+
// Determine start and end times to establish duration
Long stime = startTime;
Long etime = endTime;
@@ -142,7 +152,7 @@ public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILt
// Display a "more information" indication by allowing non visible event
// as long as its previous event is visible.
boolean visible = true;
- if (pixels < 1) {
+ if (pixels < 1.0) {
boolean prevEventVisibility = true;
// Get the visibility indication on previous event for
// this process
@@ -160,7 +170,7 @@ public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILt
// return i.e. event discarded to free up memory
Long eventSpan = stime - prevEvent.getStartTime();
if (prevEventVisibility == false
- && ((double) eventSpan * k) < 2) {
+ && ((double) eventSpan * k) < 2.0) {
// discard the item
params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsView.java
index 11531d85e3..b96f962e42 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/events/EventsView.java
@@ -25,12 +25,14 @@ public class EventsView extends TmfEventsView {
public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.events";
+ private static final int BUFFERED_EVENTS = 1000;
+
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
public EventsView() {
- super(1);
+ super(BUFFERED_EVENTS);
}
@Override
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java
index 64aadd5a37..b6ce7c3395 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java
@@ -403,18 +403,20 @@ class AsyncCanvasRedrawer {
*
*/
public void asynchronousRedraw() {
- if (parentCanvas != null) {
+ if ((parentCanvas != null) && (!parentCanvas.isDisposed())) {
Display display = parentCanvas.getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- parentCanvas.redraw();
+ if ((parentCanvas != null) && (!parentCanvas.isDisposed())) {
+ parentCanvas.redraw();
+ }
}
});
}
}
/**
- * Function to asynchonously notify the parent of the related canvas that the window changed.<p>
+ * Function to asynchronously notify the parent of the related canvas that the window changed.<p>
*
* Basically, it just run "notifyParentSelectionWindowChanged()" in asyncExec.
*
@@ -440,11 +442,13 @@ class AsyncCanvasRedrawer {
*
*/
public void asynchronousNotifyParentUpdatedInformation() {
- if(parentCanvas != null) {
+ if((parentCanvas != null) && (!parentCanvas.isDisposed())) {
Display display = parentCanvas.getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- parentCanvas.notifyParentUpdatedInformation();
+ if((parentCanvas != null) && (!parentCanvas.isDisposed())) {
+ parentCanvas.notifyParentUpdatedInformation();
+ }
}
});
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java
index e811eaf8b3..8851268ba8 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java
@@ -49,7 +49,8 @@ public class HistogramCanvasControlListener implements ControlListener {
* @param event The controle event generated by the move.
*/
public void controlMoved(ControlEvent event) {
- ourCanvas.redraw();
+ if (ourCanvas != null)
+ ourCanvas.redraw();
}
/**
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramRequest.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramRequest.java
index 4426326b5a..c21816d19f 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramRequest.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramRequest.java
@@ -80,11 +80,15 @@ public class HistogramRequest extends TmfEventRequest<LttngEvent> {
* HandleData function : will be called by TMF each time a new event is receive for the request.<p>
* Calculation for the content is done here.
*/
- @Override
- public void handleData() {
- LttngEvent[] result = getData();
- LttngEvent event = (result.length > 0) ? result[0] : null;
+// @Override
+// public void handleData() {
+// LttngEvent[] result = getData();
+// LttngEvent event = (result.length > 0) ? result[0] : null;
+ @Override
+ public void handleData(LttngEvent event) {
+ super.handleData(event);
+
// *** FIXME ***
// *** EVIL BUG ***
// The request by timerange only does not work! (see constructor above)
@@ -93,23 +97,21 @@ public class HistogramRequest extends TmfEventRequest<LttngEvent> {
//
if (event != null) {
- LttngEvent tmpEvent = (LttngEvent) event;
-
// Tracer.trace("Hst: " + event.getTimestamp());
// This check is linked to the evil fix mentionned above
- if ( ( tmpEvent.getTimestamp().getValue() >= parentCanvas.getHistogramContent().getStartTime() ) &&
- ( tmpEvent.getTimestamp().getValue() <= parentCanvas.getHistogramContent().getEndTime() ) )
+ if ( ( event.getTimestamp().getValue() >= parentCanvas.getHistogramContent().getStartTime() ) &&
+ ( event.getTimestamp().getValue() <= parentCanvas.getHistogramContent().getEndTime() ) )
{
// Distance (in time) between this event and the last one we read
- long distance = ( tmpEvent.getTimestamp().getValue() - lastRangeTime );
+ long distance = ( event.getTimestamp().getValue() - lastRangeTime );
// Check if we changed of interval (the distance is higher than the interval time)
if ( distance > parentCanvas.getHistogramContent().getElementsTimeInterval() ) {
parentCanvas.getHistogramContent().getElementByIndex(lastInterval).intervalNbEvents = nbEventsInInterval;
- lastRangeTime = tmpEvent.getTimestamp().getValue();
+ lastRangeTime = event.getTimestamp().getValue();
// * NOTE *
// We can skip several interval at once, so we need to find what was our interval now
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java
index fed5e11450..952871e80e 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java
@@ -49,7 +49,7 @@ import org.eclipse.swt.widgets.Text;
* View that contain an visual approach to the window that control the request.
* This is intended to replace the TimeFrameView
* <p>
- * This view is composed of 2 canvas, one for the whole experiment and one for the selectionned window in the experiment.
+ * This view is composed of 2 canvas, one for the whole experiment and one for the selected window in the experiment.
* It also contain a certain number of controls to print or change informations about the experiment.
*/
public class HistogramView extends TmfView implements ControlListener {
@@ -108,7 +108,8 @@ public class HistogramView extends TmfView implements ControlListener {
// *** TODO ***
// This need to be changed as soon the framework implement a "window"
- private static long DEFAULT_WINDOW_SIZE = (10L * 100 * 1000 * 1000); // 1sec
+// private static long DEFAULT_WINDOW_SIZE = (10L * 100 * 1000 * 1000); // 1sec
+ private static long DEFAULT_WINDOW_SIZE = (1L * 100 * 1000 * 1000); // .1sec
// The last experiment received/used by the view
private TmfExperiment<LttngEvent> lastUsedExperiment = null;
@@ -142,16 +143,19 @@ public class HistogramView extends TmfView implements ControlListener {
private Text txtWindowMinNbEvents = null;
// We move the time label to header from TimeTextGroup.java
- protected static final String NANOSEC_LABEL = "(sec)";
- private static final String WINDOW_TIMERANGE_LABEL_TEXT = "Window Timerange, " + NANOSEC_LABEL;
- private static final String WINDOW_CURRENT_TIME_LABEL_TEXT = "Cursor Centered on, " + NANOSEC_LABEL;
- private static final String EVENT_CURRENT_TIME_LABEL_TEXT = "Current Event Time, " + NANOSEC_LABEL;
- private TimeTextGroup ntgTimeRangeWindow = null;
- private TimeTextGroup ntgCurrentWindowTime = null;
+// protected static final String NANOSEC_LABEL = "(sec)";
+// private static final String WINDOW_TIMERANGE_LABEL_TEXT = "Window Timerange, " + NANOSEC_LABEL;
+// private static final String WINDOW_CURRENT_TIME_LABEL_TEXT = "Cursor Centered on, " + NANOSEC_LABEL;
+// private static final String EVENT_CURRENT_TIME_LABEL_TEXT = "Current Event Time, " + NANOSEC_LABEL;
+ private static final String WINDOW_TIMESPAN_LABEL_TEXT = "Window Span (sec)";
+ private static final String WINDOW_CENTER_TIME_LABEL_TEXT = "Window Center (sec)";
+ private static final String CURRENT_EVENT_TIME_LABEL_TEXT = "Current Event (sec)";
+ private TimeTextGroup ntgWindowTimeSpan = null;
+ private TimeTextGroup ntgWindowCenterTime = null;
private TimeTextGroup ntgCurrentEventTime = null;
/**
- * Default contructor of the view
+ * Default constructor of the view
*/
public HistogramView() {
super(ID);
@@ -180,7 +184,7 @@ public class HistogramView extends TmfView implements ControlListener {
// Calculate if we need "small screen" fixes
if ( parent.getDisplay().getBounds().width < SCREEN_SMALL_IF_SMALLER_THAN ) {
- // A lot smaller font for timstampe
+ // A lot smaller font for timestamp
smallFont = new Font(font.getDevice(), tmpFontData.getName(), tmpFontData.getHeight() - VERY_SMALL_FONT_MODIFIER, tmpFontData.getStyle());
/*
@@ -228,38 +232,41 @@ public class HistogramView extends TmfView implements ControlListener {
/////////////////////////////////////////////////////////////////////////////////////
- // Layout that contain the time spinner
+ // Layout that contain the time spinners
// Contains :
- // NanosecTextGroup spTimeRangeWindow
- // NanosecTextGroup spCurrentWindowTime
- // NanosecTextGroup spCurrentEventTime
+ // NanosecTextGroup ntgCurrentEventTime
+ // NanosecTextGroup ntgTimeRangeWindow
+ // NanosecTextGroup ntgCurrentWindowTime
/////////////////////////////////////////////////////////////////////////////////////
- Composite layoutTimesSpinner = new Composite(layoutFullView, SWT.NONE);
+ Composite layoutTimeSpinners = new Composite(layoutFullView, SWT.NONE);
GridLayout gridTimesSpinner = new GridLayout();
gridTimesSpinner.numColumns = 3;
gridTimesSpinner.marginHeight = 0;
gridTimesSpinner.marginWidth = 0;
- gridTimesSpinner.horizontalSpacing = 0;
+ gridTimesSpinner.horizontalSpacing = 5;
gridTimesSpinner.verticalSpacing = 0;
- layoutTimesSpinner.setLayout(gridTimesSpinner);
+ gridTimesSpinner.makeColumnsEqualWidth = true;
+ gridTimesSpinner.marginLeft = 5;
+ gridTimesSpinner.marginRight = 5;
+ layoutTimeSpinners.setLayout(gridTimesSpinner);
GridData gridDataCurrentEvent = new GridData();
gridDataCurrentEvent.horizontalAlignment = SWT.LEFT;
gridDataCurrentEvent.verticalAlignment = SWT.CENTER;
- ntgCurrentEventTime = new TimeTextGroup(this, layoutTimesSpinner, SWT.BORDER, SWT.BORDER, EVENT_CURRENT_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime( 0L ), doesTimeTextGroupNeedAdjustment);
+ ntgCurrentEventTime = new TimeTextGroup(this, layoutTimeSpinners, SWT.BORDER, SWT.BORDER, CURRENT_EVENT_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime(0L), doesTimeTextGroupNeedAdjustment);
ntgCurrentEventTime.setLayoutData(gridDataCurrentEvent);
- GridData gridDataTimeRange = new GridData();
- gridDataCurrentEvent.horizontalAlignment = SWT.CENTER;
- gridDataCurrentEvent.verticalAlignment = SWT.CENTER;
- ntgTimeRangeWindow = new TimeTextGroup(this, layoutTimesSpinner, SWT.BORDER, SWT.BORDER, WINDOW_TIMERANGE_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime( 0L ), doesTimeTextGroupNeedAdjustment);
- ntgTimeRangeWindow.setLayoutData(gridDataTimeRange);
+ GridData gridDataTimeSpan = new GridData();
+ gridDataTimeSpan.horizontalAlignment = SWT.CENTER;
+ gridDataTimeSpan.verticalAlignment = SWT.CENTER;
+ ntgWindowTimeSpan = new TimeTextGroup(this, layoutTimeSpinners, SWT.BORDER, SWT.BORDER, WINDOW_TIMESPAN_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime(0L), doesTimeTextGroupNeedAdjustment);
+ ntgWindowTimeSpan.setLayoutData(gridDataTimeSpan);
- GridData gridDataCurrentWindow = new GridData();
- gridDataCurrentEvent.horizontalAlignment = SWT.RIGHT;
- gridDataCurrentEvent.verticalAlignment = SWT.CENTER;
- ntgCurrentWindowTime = new TimeTextGroup(this, layoutTimesSpinner, SWT.BORDER, SWT.BORDER, WINDOW_CURRENT_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime( 0L ), doesTimeTextGroupNeedAdjustment);
- ntgCurrentWindowTime.setLayoutData(gridDataCurrentWindow);
+ GridData gridDataWindowCenter = new GridData();
+ gridDataWindowCenter.horizontalAlignment = SWT.RIGHT;
+ gridDataWindowCenter.verticalAlignment = SWT.CENTER;
+ ntgWindowCenterTime = new TimeTextGroup(this, layoutTimeSpinners, SWT.BORDER, SWT.BORDER, WINDOW_CENTER_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime(0L), doesTimeTextGroupNeedAdjustment);
+ ntgWindowCenterTime.setLayoutData(gridDataWindowCenter);
/////////////////////////////////////////////////////////////////////////////////////
@@ -275,7 +282,8 @@ public class HistogramView extends TmfView implements ControlListener {
GridLayout gridSelectionWindow = new GridLayout();
gridSelectionWindow.numColumns = 3;
gridSelectionWindow.marginHeight = 0;
- gridSelectionWindow.marginWidth = 0;
+ gridSelectionWindow.marginWidth = 2;
+ gridSelectionWindow.marginTop = 5;
gridSelectionWindow.horizontalSpacing = 0;
gridSelectionWindow.verticalSpacing = 0;
layoutSelectionWindow.setLayout(gridSelectionWindow);
@@ -408,6 +416,8 @@ public class HistogramView extends TmfView implements ControlListener {
gridExperimentHistogram.marginWidth = 0;
gridExperimentHistogram.horizontalSpacing = 0;
gridExperimentHistogram.verticalSpacing = 0;
+ gridExperimentHistogram.marginLeft = 5;
+ gridExperimentHistogram.marginRight = 5;
layoutExperimentHistogram.setLayout(gridExperimentHistogram);
/*
@@ -517,7 +527,7 @@ public class HistogramView extends TmfView implements ControlListener {
*/
/**
- * Method called when synchonization is active and that the user select an event.<p>
+ * Method called when synchronization is active and that the user select an event.
* We update the current event timeTextGroup and move the selected window if needed.
*
* @param signal Signal received from the framework. Contain the event.
@@ -714,8 +724,7 @@ public class HistogramView extends TmfView implements ControlListener {
// Set a (dynamic) time interval
long intervalTime = ( (ts2.getValue() - ts1.getValue()) / selectedWindowCanvas.getHistogramContent().getNbElement() );
- selectedWindowRequest = performRequest(experiment, selectedWindowCanvas, tmpRange, intervalTime,
- ExecutionType.SHORT);
+ selectedWindowRequest = performRequest(experiment, selectedWindowCanvas, tmpRange, intervalTime, ExecutionType.FOREGROUND);
selectedWindowCanvas.redrawAsynchronously();
}
@@ -751,7 +760,7 @@ public class HistogramView extends TmfView implements ControlListener {
// It would be interesting if there was a way to tell the framework to run the request "in parallel" here.
// Mean a completetly independant copy of the Expereiment would be done and we would proceed on that.
//
- dataBackgroundFullRequest = performRequest(experiment, fullExperimentCanvas, tmpRange, intervalTime, ExecutionType.LONG);
+ dataBackgroundFullRequest = performRequest(experiment, fullExperimentCanvas, tmpRange, intervalTime, ExecutionType.BACKGROUND);
fullExperimentCanvas.getCurrentWindow().setWindowXPositionLeft(fullExperimentCanvas.getHistogramContent().getClosestXPositionFromTimestamp(fullExperimentCanvas.getCurrentWindow().getTimestampOfLeftPosition()));
@@ -800,7 +809,7 @@ public class HistogramView extends TmfView implements ControlListener {
if ( lastUsedExperiment != null ) {
// If a request is ongoing, try to stop it
- if ( selectedWindowRequest != null && selectedWindowRequest.isCompleted() == false ) {
+ if (selectedWindowRequest != null && !selectedWindowRequest.isCompleted()) {
selectedWindowRequest.cancel();
}
@@ -892,9 +901,9 @@ public class HistogramView extends TmfView implements ControlListener {
}
}
- if(ntgCurrentWindowTime != null && fullExperimentCanvas != null) {
+ if(ntgWindowCenterTime != null && fullExperimentCanvas != null) {
// If the user changed the selected window time, recenter the window and call the notification
- long newSelectedWindowTime = ntgCurrentWindowTime.getValue();
+ long newSelectedWindowTime = ntgWindowCenterTime.getValue();
if ( newSelectedWindowTime != fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition() ) {
fullExperimentCanvas.setWindowCenterPosition(newSelectedWindowTime);
windowChangedNotification();
@@ -903,9 +912,9 @@ public class HistogramView extends TmfView implements ControlListener {
}
}
- if(ntgTimeRangeWindow != null && fullExperimentCanvas != null) {
+ if(ntgWindowTimeSpan != null && fullExperimentCanvas != null) {
// If the user changed the selected window size, resize the window and call the notification
- long newSelectedWindowTimeRange = ntgTimeRangeWindow.getValue();
+ long newSelectedWindowTimeRange = ntgWindowTimeSpan.getValue();
if ( newSelectedWindowTimeRange != fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth() ) {
fullExperimentCanvas.resizeWindowByAbsoluteTime(newSelectedWindowTimeRange);
windowChangedNotification();
@@ -977,8 +986,8 @@ public class HistogramView extends TmfView implements ControlListener {
txtWindowStopTime.setText( HistogramConstant.formatNanoSecondsTime( 0L ) );
txtWindowStartTime.getParent().layout();
- ntgCurrentWindowTime.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
- ntgTimeRangeWindow.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
+ ntgWindowCenterTime.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
+ ntgWindowTimeSpan.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
// Using "startTime" here can avoid an useless TmfTimeSynchSignal here
// However it look ugly to have only this time
@@ -1039,8 +1048,8 @@ public class HistogramView extends TmfView implements ControlListener {
}
if(fullExperimentCanvas != null) {
- ntgCurrentWindowTime.setValue( fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition() );
- ntgTimeRangeWindow.setValue( fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth() );
+ ntgWindowCenterTime.setValue( fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition() );
+ ntgWindowTimeSpan.setValue( fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth() );
// If the current event time is outside the selection window, recenter our window
if ( isGivenTimestampInSelectedWindow(ntgCurrentEventTime.getValue()) == false ) {
@@ -1051,7 +1060,7 @@ public class HistogramView extends TmfView implements ControlListener {
// Take one control in each group to call to refresh the layout
// Since both control have the same parent, only one call is needed
txtWindowStartTime.getParent().layout();
- ntgCurrentWindowTime.getParent().layout();
+ ntgWindowCenterTime.getParent().layout();
}
/**
@@ -1060,6 +1069,7 @@ public class HistogramView extends TmfView implements ControlListener {
*/
public void updateSelectedEventTime() {
ntgCurrentEventTime.setValueAsynchronously(currentEventTime);
+// sendTmfTimeSynchSignalBroadcast();
// Tell the selection canvas which event is currently selected
// This give a nice graphic output
selectedWindowCanvas.getHistogramContent().setSelectedEventTimeInWindow(currentEventTime);
@@ -1071,7 +1081,7 @@ public class HistogramView extends TmfView implements ControlListener {
*
* Just redraw everything...
*
- * @param event The controle event generated by the move.
+ * @param event The control event generated by the move.
*/
public void controlMoved(ControlEvent event) {
parent.redraw();
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/ParentHistogramCanvas.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/ParentHistogramCanvas.java
index 30c71cd9b0..31f7ba0ff4 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/ParentHistogramCanvas.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/ParentHistogramCanvas.java
@@ -470,10 +470,14 @@ public class ParentHistogramCanvas extends HistogramCanvas {
*
*/
public void asynchronousNotifyParentSelectionWindowChanged() {
+ // Ignore update if widget is disposed
+ if (this.isDisposed()) return;
+
Display display = this.getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- notifyParentSelectionWindowChanged();
+ if(!ParentHistogramCanvas.this.isDisposed())
+ notifyParentSelectionWindowChanged();
}
});
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java
index 543cc7b7f0..23c8d07f08 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java
@@ -48,7 +48,7 @@ public class TimeTextGroup implements FocusListener, KeyListener {
private static final int SMALL_FONT_MODIFIER = 1;
// Indentation size
- private static final int DEFAULT_INDENT_SIZE = 10;
+// private static final int DEFAULT_INDENT_SIZE = 10;
private HistogramView parentView = null;
private AsyncTimeTextGroupRedrawer asyncRedrawer = null;
@@ -99,14 +99,14 @@ public class TimeTextGroup implements FocusListener, KeyListener {
}
/**
- * Default Constructor with adjustement for small screen, allow you to give the groupname and the textbox value.<p>
- *
+ * Default Constructor with adjustment for small screen, allow you to give the group name and the text box value.<p>
+ *
* @param newParentView Parent HistogramView
* @param parent Parent Composite, used to position the inner controls.
- * @param textStyle Style of the textbox. Usually SWT.BORDER or SWT.NONE (or anything that suit a Text)
+ * @param textStyle Style of the text box. Usually SWT.BORDER or SWT.NONE (or anything that suit a Text)
* @param groupStyle Style of the group. Anything that suite a Text
* @param groupValue Value (label) of the group.
- * @param textValue Value of the textbox.
+ * @param textValue Value of the text box.
* @param isSpaceSaverNeeded Value that tell if we try to save some space in the control.
*/
public TimeTextGroup(HistogramView newParentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue, boolean isSpaceSaverNeeded) {
@@ -115,7 +115,7 @@ public class TimeTextGroup implements FocusListener, KeyListener {
Font smallFont = null;
int textBoxSize = -1;
- int indentSize = -1;
+// int indentSize = -1;
// If we were asked to save size, calculate the correct value here
if ( isSpaceSaverNeeded == true ) {
@@ -123,7 +123,7 @@ public class TimeTextGroup implements FocusListener, KeyListener {
// No minimum textBoxSize and no indent size
textBoxSize = 0;
- indentSize = 0;
+// indentSize = 0;
}
else {
// We use only a slightly smaller font
@@ -135,13 +135,14 @@ public class TimeTextGroup implements FocusListener, KeyListener {
textBoxSize = HistogramConstant.getTextSizeInControl(parent, LONGEST_STRING_VALUE);
// Default indent
- indentSize = DEFAULT_INDENT_SIZE;
+// indentSize = DEFAULT_INDENT_SIZE;
}
parentView = newParentView;
// ** Creation of the group
- GridLayout gridLayoutgroup = new GridLayout(2, false);
+// GridLayout gridLayoutgroup = new GridLayout(2, false);
+ GridLayout gridLayoutgroup = new GridLayout(1, false);
gridLayoutgroup.horizontalSpacing = 0;
gridLayoutgroup.verticalSpacing = 0;
grpName = new Group(parent, groupStyle);
@@ -151,10 +152,10 @@ public class TimeTextGroup implements FocusListener, KeyListener {
txtNanosec = new Text(grpName, textStyle);
txtNanosec.setTextLimit( MAX_CHAR_IN_TEXTBOX );
- txtNanosec.setText( textValue );
+ txtNanosec.setText(textValue);
txtNanosec.setFont(smallFont);
GridData gridDataTextBox = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- gridDataTextBox.horizontalIndent = indentSize;
+ gridDataTextBox.horizontalIndent = 0; // indentSize;
gridDataTextBox.verticalIndent = 0;
gridDataTextBox.minimumWidth = textBoxSize;
txtNanosec.setLayoutData(gridDataTextBox);
@@ -435,13 +436,16 @@ class AsyncTimeTextGroupRedrawer {
*
* @param newTime The new time to set
*/
- public void asynchronousSetValue(long newTime) {
- final long tmpTime = newTime;
+ public void asynchronousSetValue(final long newTime) {
+ // Ignore setting of value if widget is disposed
+ if (parentTimeTextGroup.getParent().isDisposed()) return;
Display display = parentTimeTextGroup.getParent().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- parentTimeTextGroup.setValue(tmpTime);
+ if (!parentTimeTextGroup.getParent().isDisposed()) {
+ parentTimeTextGroup.setValue(newTime);
+ }
}
});
}
@@ -454,12 +458,16 @@ class AsyncTimeTextGroupRedrawer {
* @param newGroupName The new group name to set
*/
public void asynchronousSetGroupName(String newGroupName) {
+ // Ignore setting of name if widget is disposed
+ if (parentTimeTextGroup.getParent().isDisposed()) return;
+
final String tmpName = newGroupName;
-
Display display = parentTimeTextGroup.getParent().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- parentTimeTextGroup.setGroupName(tmpName);
+ if (!parentTimeTextGroup.getParent().isDisposed()) {
+ parentTimeTextGroup.setGroupName(tmpName);
+ }
}
});
}
@@ -471,10 +479,15 @@ class AsyncTimeTextGroupRedrawer {
*
*/
public void asynchronousRedraw() {
+ // Ignore redraw if widget is disposed
+ if (parentTimeTextGroup.getParent().isDisposed()) return;
+
Display display = parentTimeTextGroup.getParent().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
- parentTimeTextGroup.getParent().redraw();
+ if (!parentTimeTextGroup.getParent().isDisposed()) {
+ parentTimeTextGroup.getParent().redraw();
+ }
}
});
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java
index 1999aa05cf..5751cb2cc8 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/ProjectView.java
@@ -26,6 +26,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.linuxtools.lttng.event.LttngEvent;
import org.eclipse.linuxtools.lttng.state.experiment.StateManagerFactory;
+import org.eclipse.linuxtools.lttng.trace.LTTngExperiment;
import org.eclipse.linuxtools.lttng.trace.LTTngTrace;
import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode;
import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode;
@@ -59,7 +60,7 @@ public class ProjectView extends TmfView {
private TreeViewer fViewer;
private LTTngProjectRoot fProjectRoot;
- private TmfExperiment<LttngEvent> fSelectedExperiment = null;
+ private LTTngExperiment<LttngEvent> fSelectedExperiment = null;
private IWorkspace fWorkspace;
private IResourceChangeListener fResourceChangeListener;
@@ -71,7 +72,7 @@ public class ProjectView extends TmfView {
// Perform updates on the UI thread
private Runnable fViewRefresher = new Runnable() {
public void run() {
- if (fViewer != null) {
+ if ((fViewer != null) && (!fViewer.getTree().isDisposed())) {
Object[] elements = fViewer.getExpandedElements();
fViewer.refresh();
fViewer.setExpandedElements(elements);
@@ -183,7 +184,7 @@ public class ProjectView extends TmfView {
ITmfTrace trace = new LTTngTrace(location, waitForCompletion);
traces[i] = trace;
}
- fSelectedExperiment = new TmfExperiment<LttngEvent>(LttngEvent.class, expId, traces);
+ fSelectedExperiment = new LTTngExperiment<LttngEvent>(LttngEvent.class, expId, traces);
// Make sure the lttng-core, experiment selection context is ready
// for an event request from any view
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java
index 6d7041d046..5cd34ebaf3 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java
@@ -116,8 +116,8 @@ public class ResourcesView extends AbsTimeUpdateView implements
// Viewer to notify selection to this class
// This class will synchronise selections with table.
- tsfviewer.addWidgetSelectionListner(this);
- tsfviewer.addWidgetTimeScaleSelectionListner(this);
+// tsfviewer.addWidgetSelectionListner(this);
+// tsfviewer.addWidgetTimeScaleSelectionListner(this);
// Create the help context id for the viewer's control
// TODO: Associate with help system
@@ -129,11 +129,11 @@ public class ResourcesView extends AbsTimeUpdateView implements
hookContextMenu();
contributeToActionBars();
- // Read relevant values
- int timeSpaceWidth = tsfviewer.getTimeSpace();
- if (timeSpaceWidth < 0) {
- timeSpaceWidth = -timeSpaceWidth;
- }
+// // Read relevant values
+// int timeSpaceWidth = tsfviewer.getTimeSpace();
+// if (timeSpaceWidth < 0) {
+// timeSpaceWidth = -timeSpaceWidth;
+// }
TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
if (experiment != null) {
@@ -142,7 +142,7 @@ public class ResourcesView extends AbsTimeUpdateView implements
long time0 = experimentTRange.getStartTime().getValue();
long time1 = experimentTRange.getEndTime().getValue();
ParamsUpdater paramUpdater = getParamsUpdater();
- paramUpdater.update(time0, time1, timeSpaceWidth);
+ paramUpdater.update(time0, time1); // , timeSpaceWidth);
}
// send the initial request and obtained the adjusted time used
TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this, experimentTRange);
@@ -440,17 +440,21 @@ public class ResourcesView extends AbsTimeUpdateView implements
public void displayModel(final ITmfTimeAnalysisEntry[] items, final long startBoundTime,
final long endBoundTime, final boolean updateTimeBounds, final long startVisibleWindow,
final long endVisibleWindow, final Object source) {
-
+
+ // Return if disposed
+ if ((tsfviewer == null) || (tsfviewer.getControl().isDisposed())) return;
+
Display display = tsfviewer.getControl().getDisplay();
display.asyncExec(new Runnable() {
-
public void run() {
- tsfviewer.display(items, startBoundTime, endBoundTime, updateTimeBounds);
- // validate visible boundaries
- if (startVisibleWindow > -1 && endVisibleWindow > -1) {
- tsfviewer.setSelectVisTimeWindow(startVisibleWindow, endVisibleWindow, source);
+ if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
+ tsfviewer.display(items, startBoundTime, endBoundTime, updateTimeBounds);
+ // validate visible boundaries
+ if (startVisibleWindow > -1 && endVisibleWindow > -1) {
+ tsfviewer.setSelectVisTimeWindow(startVisibleWindow, endVisibleWindow, source);
+ }
+ tsfviewer.resizeControls();
}
- tsfviewer.resizeControls();
}
});
}
@@ -533,7 +537,7 @@ public class ResourcesView extends AbsTimeUpdateView implements
// user to select the interesting area based on the perspective
TmfTimeRange initTimeWindow = getInitTRange(experimentTRange);
- dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.SHORT);
+ dataRequest(initTimeWindow, experimentTRange, true, ExecutionType.FOREGROUND);
if (TraceDebug.isDEBUG()) {
TraceDebug.debug("Initialization request time range is: " + initTimeWindow.getStartTime().toString() + "-"
+ initTimeWindow.getEndTime().toString());
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java
index 8b9b511b68..87a2d2196f 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java
@@ -55,6 +55,11 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
traceStartTime, traceEndTime, resourceName, traceId,
"", type, resId, insertionTime);
resContainer.addItem(localRessource);
+
+ if (TraceDebug.isRV()) {
+ TraceDebug.traceRV("addLocalResource():" + localRessource);
+ }
+
return localRessource;
}
@@ -68,10 +73,6 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
long windowStartTime = params.getStartTime();
long windowEndTime = params.getEndTime();
- if (stime == 13589765052286L) {
- TraceDebug.debug("Debug event catched");
- }
-
// Start of event is already out of range
if (stime > windowEndTime) {
return false;
@@ -163,11 +164,10 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
trcEvent.getCpuId());
Long cpu = trcEvent.getCpuId();
if (localResource == null) {
- TmfTimeRange timeRange = traceSt.getContext()
- .getTraceTimeWindow();
+ TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow();
localResource = addLocalResource(timeRange.getStartTime()
- .getValue(), timeRange.getEndTime().getValue(), traceSt
- .getTraceId(), ResourceTypes.CPU, cpu, trcEvent
+ .getValue(), timeRange.getEndTime().getValue(),
+ traceSt.getTraceId(), ResourceTypes.CPU, cpu, trcEvent
.getTimestamp().getValue());
}
@@ -192,8 +192,12 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
* @return
*/
protected boolean makeDraw(LttngTraceState traceSt, long stime, long etime,
- TimeRangeEventResource localResource,
- ParamsUpdater params, String stateMode) {
+ TimeRangeEventResource localResource, ParamsUpdater params,
+ String stateMode) {
+
+ if (TraceDebug.isRV()) {
+ TraceDebug.traceRV("makeDraw():[" + localResource + ",candidate=[stime=" + stime + ",etime=" + etime + ",state=" + stateMode + "]]");
+ }
// Check if the event is out of range
if (!withinViewRange(stime, etime)) {
@@ -224,7 +228,7 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
// Display a "more information" indication by allowing non visible event
// as long as its previous event is visible.
boolean visible = true;
- if (pixels < 1) {
+ if (pixels < 1.0) {
boolean prevEventVisibility = true;
// Get the visibility indication on previous event for
// this process
@@ -242,7 +246,7 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
// return i.e. event discarded to free up memory
Long eventSpan = stime - prevEvent.getStartTime();
if (prevEventVisibility == false
- && ((double) eventSpan * k) < 2) {
+ && ((double) eventSpan * k) < 2.0) {
params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
return false;
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java
index 8807678885..99787b18e4 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java
@@ -493,7 +493,7 @@ public class StatisticsView extends AbsTimeUpdateView {
*/
@Override
protected void waitCursor(final boolean waitInd) {
- if (treeViewer == null) {
+ if ((treeViewer == null) || (treeViewer.getTree().isDisposed())) {
return;
}
@@ -505,11 +505,13 @@ public class StatisticsView extends AbsTimeUpdateView {
// Perform the updates on the UI thread
display.asyncExec(new Runnable() {
public void run() {
- Cursor cursor = null; /* indicates default */
- if (waitInd) {
- cursor = fwaitCursor;
+ if ((treeViewer != null) && (!treeViewer.getTree().isDisposed())) {
+ Cursor cursor = null; /* indicates default */
+ if (waitInd) {
+ cursor = fwaitCursor;
+ }
+ treeViewer.getControl().setCursor(cursor);
}
- treeViewer.getControl().setCursor(cursor);
}
});
}
@@ -517,12 +519,13 @@ public class StatisticsView extends AbsTimeUpdateView {
@Override
public void ModelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) {
Object input = treeViewer.getInput();
- if (input != null && input instanceof StatisticsTreeNode) {
+ if ((input != null) && (input instanceof StatisticsTreeNode) && (!treeViewer.getTree().isDisposed())) {
((StatisticsTreeNode) input).reset();
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
// @Override
public void run() {
- treeViewer.refresh();
+ if (!treeViewer.getTree().isDisposed())
+ treeViewer.refresh();
}
});
}
@@ -530,13 +533,17 @@ public class StatisticsView extends AbsTimeUpdateView {
@Override
public void modelInputChanged(ILttngSyntEventRequest request, boolean complete) {
+ // Ignore update if disposed
+ if (treeViewer.getTree().isDisposed()) return;
+
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
// @Override
public void run() {
- treeViewer.refresh();
+ if (!treeViewer.getTree().isDisposed())
+ treeViewer.refresh();
}
});
- }
+ }
/*
* (non-Javadoc)
@@ -617,7 +624,7 @@ public class StatisticsView extends AbsTimeUpdateView {
TmfTimeRange experimentTRange = experiment.getTimeRange();
// send the initial request, to start filling up model
- dataRequest(experimentTRange, experimentTRange, true, ExecutionType.LONG);
+ dataRequest(experimentTRange, experimentTRange, true, ExecutionType.BACKGROUND);
} else {
TraceDebug.debug("No selected experiment information available");
}
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java
index be2a5e7622..167cecd421 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java
@@ -275,7 +275,9 @@ public class SpinnerGroup {
* Perform the update on the UI thread
*/
public void updateSpinners() {
-
+ // Ignore update if disposed
+ if (seconds.isDisposed()) return;
+
seconds.getDisplay().asyncExec(new Runnable() {
public void run() {
if (!seconds.isDisposed() && !nanosec.isDisposed()) {
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java
index dd234847e1..90e3c1f407 100644
--- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java
+++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/TimeFrameView.java
@@ -239,6 +239,9 @@ public class TimeFrameView extends TmfView {
*/
private void updateSlider(TmfTimeRange range, TmfTimestamp timestamp) {
+ // Ignore update if disposed
+ if (fSlider.isDisposed()) return;
+
// Determine the new relative position
byte scale = range.getEndTime().getScale();
long total = range.getStartTime().getAdjustment(range.getEndTime(), scale);
diff --git a/lttng/org.eclipse.linuxtools.lttng/ChangeLog b/lttng/org.eclipse.linuxtools.lttng/ChangeLog
index 6ed398b383..6b903d65e5 100644
--- a/lttng/org.eclipse.linuxtools.lttng/ChangeLog
+++ b/lttng/org.eclipse.linuxtools.lttng/ChangeLog
@@ -1,3 +1,53 @@
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/event/LttngEvent.java: Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java: Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventField.java: Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventType.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java: (StateExperimentManager): Counter fix
+ (buildCheckPoints): Proper timestamp cloning
+ (.handleData): Per-trace event counter (bug...)
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java (currentLttngEvent): Make the event unique (single)
+ (LTTngTrace): Fix the trace time range to start at first event
+
+2010-10-14 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java: Handle processing through a coalesced request
+ * src/org/eclipse/linuxtools/lttng/request/LttngBaseEventRequest.java: Removed references to trace and trace model
+ * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java: Replaced map key from trace path (String) to actual trace (ITmfTrace)
+
+2010-10-13 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java: Removed unecessary ACK event
+ * src/org/eclipse/linuxtools/lttng/event/LttngSyntheticEvent.java: Removed unecessary ACK event
+ * src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java (toString): Added
+ * src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java (toString): Added
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java: Cleanup comment
+
+2010-09-17 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/event/LttngEvent.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java: Adjusted to new handleData() API
+
+2010-09-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java: ExecutionType update
+ * src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java: ExecutionType update
+
+2010-09-09 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java: Fixed a ranking problem on a seek()
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java: New class
+
2010-07-29 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java: Fixed state of running process
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java
index 430c333892..3a63d13129 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java
@@ -8,12 +8,16 @@
*
* Contributors:
* Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ * Marc Dumais (marc.dumais@ericsson.com) - Fix for 316455 (first part)
*******************************************************************************/
package org.eclipse.linuxtools.lttng.control;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.Vector;
import org.eclipse.linuxtools.lttng.TraceDebug;
import org.eclipse.linuxtools.lttng.event.LttngEvent;
@@ -46,28 +50,26 @@ import org.eclipse.linuxtools.tmf.trace.TmfTrace;
* @author alvaro
*
*/
-public class LttngSyntheticEventProvider extends
- TmfEventProvider<LttngSyntheticEvent> {
+public class LttngSyntheticEventProvider extends TmfEventProvider<LttngSyntheticEvent> {
// ========================================================================
// Data
// ========================================================================
public static final int BLOCK_SIZE = 1;
public static final int NB_EVENTS = 1;
- public static final int QUEUE_SIZE = 1; // lttng specific, one event at a
- // time
+ public static final int QUEUE_SIZE = 1; // lttng specific, one event at a time
- // TmfDataProvider<LttngEvent> fExtProvider = null;
private ITmfDataRequest<LttngSyntheticEvent> fmainRequest = null;
- private final Map<IStateTraceManager, LttngBaseEventRequest> fEventProviderRequests = new HashMap<IStateTraceManager, LttngBaseEventRequest>();
+ private final List<IStateTraceManager> fEventProviderRequests = new Vector<IStateTraceManager>();
+
private final LttngSyntheticEvent fStatusEvent;
- private final LttngSyntheticEvent fStatusEventAck;
private int fMainReqEventCount = 0;
volatile boolean startIndSent = false;
private LTTngTreeNode fExperiment = null;
- private ITransEventProcessor fstateUpdateProcessor = StateEventToHandlerFactory
- .getInstance();
+ private ITransEventProcessor fstateUpdateProcessor = StateEventToHandlerFactory.getInstance();
private boolean waitForRequest = false;
+ long dispatchTime = 0L;
+ private final Map<ITmfTrace, LttngTraceState> traceToTraceStateModel = new HashMap<ITmfTrace, LttngTraceState>();
// ========================================================================
// Constructor
@@ -90,10 +92,6 @@ public class LttngSyntheticEventProvider extends
fStatusEvent = new LttngSyntheticEvent(null, statusTimeStamp, source,
dtype, null, null, null);
fStatusEvent.setSequenceInd(SequenceInd.STARTREQ);
-
- fStatusEventAck = new LttngSyntheticEvent(null, statusTimeStamp,
- source, dtype, null, null, null);
- fStatusEventAck.setSequenceInd(SequenceInd.ACK);
}
// ========================================================================
@@ -102,8 +100,7 @@ public class LttngSyntheticEventProvider extends
@SuppressWarnings("unchecked")
@Override
- public ITmfContext armRequest(
- final ITmfDataRequest<LttngSyntheticEvent> request) {
+ public ITmfContext armRequest(final ITmfDataRequest<LttngSyntheticEvent> request) {
// validate
// make sure we have the right type of request
if (!(request instanceof ITmfEventRequest<?>)) {
@@ -135,195 +132,166 @@ public class LttngSyntheticEventProvider extends
TraceDebug.debug("Main Synthethic event request started on thread: " + Thread.currentThread().getName());
- // loop for every traceManager in current experiment
boolean subRequestQueued = false;
TmfExperiment<LttngEvent> experiment = (TmfExperiment<LttngEvent>) fExperiment.getValue();
experiment.startSynch(new TmfStartSynchSignal(0));
- for (IStateTraceManager traceManager : fEventProviderRequests.keySet()) {
-
+
+ TmfTimeRange adjustedRange = reqWindow;
+
+ // Figure-out if we need to increase the range of the request: if some
+ // checkpoints are before the beginning of the range, increase the
+ // range to catch them. We will then exercise the state system of
+ // those traces until the requested beginning time range, discarding
+ // the unrequested data.
+ IStateTraceManager traceManager;
+ Iterator<IStateTraceManager> iter = fEventProviderRequests.iterator();
+ // For each traceManager in the current experiment...
+ while(iter.hasNext()) {
+ traceManager = iter.next();
// restore trace state system to nearest check point
TmfTimestamp checkPoint = traceManager
.restoreCheckPointByTimestamp(reqWindow.getStartTime());
- // adjust start time bound to check point
-
- // validate so checkpoint restore is within requested bounds
+ // validate that the checkpoint restored is within requested bounds
+ // (not outside the current trace's range or after the end of requested range)
TmfTimeRange traceRange = traceManager.getTrace().getTimeRange();
if ((checkPoint != null) && !(
checkPoint.getValue() >= traceRange.getStartTime().getValue() &&
checkPoint.getValue() <= traceRange.getEndTime().getValue() &&
checkPoint.getValue() < reqWindow.getEndTime().getValue())
) {
- // checkpoint is out of trace bounds
- continue;
+ // checkpoint is out of trace bounds; no need to adjust request for this
+ // trace
}
- TmfTimeRange adjustedRange = reqWindow;
- if (checkPoint != null) {
- adjustedRange = new TmfTimeRange(checkPoint, reqWindow.getEndTime());
+ else {
+ // use checkpoint time as new startTime for request if it's earlier than
+ // current startTime
+ if (checkPoint != null && adjustedRange.getStartTime().getValue() > checkPoint.getValue()) {
+ adjustedRange = new TmfTimeRange(checkPoint, reqWindow.getEndTime());
+ }
+ }
+ // Save which trace state model corresponds to current trace
+ traceToTraceStateModel.put(traceManager.getTrace(), traceManager.getStateModel());
+ }
+
+ dispatchTime = reqWindow.getStartTime().getValue();
+ // Create a single request for all traces in the experiment, with coalesced time range.
+ final LttngBaseEventRequest subRequest = new LttngBaseEventRequest(adjustedRange, reqWindow.getStartTime(),
+ 0, TmfEventRequest.ALL_DATA, BLOCK_SIZE, ITmfDataRequest.ExecutionType.FOREGROUND) {
+
+ private LttngSyntheticEvent syntheticEvent = null;
+ private LttngSyntheticEvent syntheticAckIndicator = null;
+ long subEventCount = 0L;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.lttng.control.LttngEventRequest#handleData()
+ */
+ @Override
+ public void handleData(LttngEvent event) {
+ super.handleData(event);
+ if (event != null) {
+ handleIncomingData(event);
+ } else {
+ TraceDebug.debug("handle data received with no data");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#done()
+ */
+ @Override
+ public void done() {
+ // mark this sub-request as completed
+ super.done();
+ handleProviderDone(/*getTraceModel()*/); // mcds
}
- LttngTraceState traceModel = traceManager.getStateModel();
- // String key = (traceManager.getTrace().getPath() +
- // traceManager.getTrace().getName()).hashCode();
- ITmfTrace trace = traceManager.getTrace();
- // create sub-request for one trace within experiment
- final LttngBaseEventRequest subRequest = new LttngBaseEventRequest(adjustedRange, reqWindow.getStartTime(),
- 0, TmfEventRequest.ALL_DATA, BLOCK_SIZE, traceModel, ITmfDataRequest.ExecutionType.SHORT, trace) {
-
- private LttngSyntheticEvent syntheticEvent = null;
- private LttngSyntheticEvent syntheticAckIndicator = null;
- long subEventCount = 0L;
-
- private final long fDispatchTime = getDispatchTime().getValue();
- private final LttngTraceState fTraceModel = getTraceModel();
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.linuxtools.lttng.control.LttngEventRequest#handleData
- * ()
- */
- @Override
- public void handleData() {
- LttngEvent[] events = getData();
-
-// Tracer.trace("Sep: " + events[0].getTimestamp());
-
- if (events.length > 0) {
- for (LttngEvent e : events) {
- handleIncomingData(e);
- }
- } else {
- TraceDebug.debug("handle data received with no data");
-// handleProviderDone(getTraceModel());
-// done();
- }
+ /**
+ * Trigger the Analysis and sequential control of the events.
+ *
+ * @param e
+ */
+ private void handleIncomingData(LttngEvent e) {
+ long eventTime = e.getTimestamp().getValue();
+
+ TmfTrace<LttngEvent> inTrace = e.getParentTrace();
+ LttngTraceState traceModel = traceToTraceStateModel.get(inTrace);
+
+ // queue the new event data and an ACK
+ updateSynEvent(e);
+
+ // If time at or above requested time, update application
+ if (eventTime >= dispatchTime) {
+ // Before update
+ syntheticEvent.setSequenceInd(SequenceInd.BEFORE);
+ fmainRequest.handleData(syntheticEvent);
+ fmainRequest.handleData(syntheticAckIndicator);
+
+ // Update state locally
+ syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
+ fstateUpdateProcessor.process(syntheticEvent, traceModel);
+
+ // After Update
+ syntheticEvent.setSequenceInd(SequenceInd.AFTER);
+ fmainRequest.handleData(syntheticEvent);
+ fmainRequest.handleData(syntheticAckIndicator);
+
+ // increment once per dispatch
+ incrementSynEvenCount();
+ subEventCount++;
+ } else {
+ // event time is between checkpoint adjusted time and
+ // requested time i.e. application does not expect the
+ // event, however the state system needs to be re-built
+ // to the dispatch point
+ syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
+ fstateUpdateProcessor.process(syntheticEvent, traceModel);
}
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#done()
- */
- @Override
- public void done() {
- // mark this sub-request as completed
- super.done();
- handleProviderDone(getTraceModel());
-// super.done();
+ /**
+ * Create a synthetic event from the received new reference, if
+ * the reference is the same there is no need for a new instance
+ *
+ * if this is the first event for this request, call start
+ * handler
+ *
+ * @param e
+ * @return
+ */
+ private LttngSyntheticEvent updateSynEvent(LttngEvent e) {
+ if (syntheticEvent == null
+ || syntheticEvent.getBaseEvent() != e) {
+ syntheticEvent = new LttngSyntheticEvent(e);
}
+
+ TmfTrace<LttngEvent> inTrace = e.getParentTrace();
+ LttngTraceState traceModel = traceToTraceStateModel.get(inTrace);
- /**
- * Trigger the Analysis and sequential control of the events.
- *
- * @param e
- */
- private void handleIncomingData(LttngEvent e) {
- long eventTime = e.getTimestamp().getValue();
-
- // if (eventTime == 13589777932952L) {
- // // syscall entry id 78 expected
- // System.out.println("debug mark at 13589777932952L");
- // }
-
- TmfTrace<LttngEvent> inTrace = e.getParentTrace();
- if (!(inTrace == getTrace())) {
-// System.out.println("Event from a different trace discarded");
- return;
- }
-
- // queue the new event data and an ACK
- updateSynEvent(e);
-
- // If time at or above requested time, update application
- if (eventTime >= fDispatchTime) {
- // Before update
- syntheticEvent.setSequenceInd(SequenceInd.BEFORE);
-// queueResult(syntheticEvent);
-// queueResult(syntheticAckIndicator);
-
- LttngSyntheticEvent[] result = new LttngSyntheticEvent[1];
- result[0] = syntheticEvent;
- fmainRequest.setData(result);
- fmainRequest.handleData();
- result[0] = syntheticAckIndicator;
- fmainRequest.setData(result);
- fmainRequest.handleData();
-
- // Update state locally
- syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
- fstateUpdateProcessor.process(syntheticEvent, fTraceModel);
-
- // After Update
- syntheticEvent.setSequenceInd(SequenceInd.AFTER);
-// queueResult(syntheticEvent);
-// queueResult(syntheticAckIndicator);
-
- result = new LttngSyntheticEvent[1];
- result[0] = syntheticEvent;
- fmainRequest.setData(result);
- fmainRequest.handleData();
- result[0] = syntheticAckIndicator;
- fmainRequest.setData(result);
- fmainRequest.handleData();
-
- // increment once per dispatch
- incrementSynEvenCount();
- subEventCount++;
- } else {
- // event time is between checkpoint adjusted time and
- // requested time i.e. application does not expect the
- // event, however the state system needs to be re-built
- // to the dispatch point
- syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
- fstateUpdateProcessor.process(syntheticEvent, fTraceModel);
- }
+ // Trace model needed by application handlers
+ syntheticEvent.setTraceModel(traceModel);
+
+ // send the start request indication once per request thread
+ if (!startIndSent) {
+ TraceDebug.debug("Thread started: " + Thread.currentThread().getName());
+ handleProviderStarted(traceModel);
+ startIndSent = true;
}
- /**
- * Create a synthetic event from the received new reference, if
- * the reference is the same there is no need for a new instance
- *
- * if this is the first event for this request, call start
- * handler
- *
- * @param e
- * @return
- */
- private LttngSyntheticEvent updateSynEvent(LttngEvent e) {
- if (syntheticEvent == null
- || syntheticEvent.getBaseEvent() != e) {
- syntheticEvent = new LttngSyntheticEvent(e);
- syntheticAckIndicator = new LttngSyntheticEvent(e);
- syntheticAckIndicator.setSequenceInd(SequenceInd.ACK);
- }
-
- // Trace model needed by application handlers
- syntheticEvent.setTraceModel(fTraceModel);
-
- // send the start request indication once per request thread
- if (!startIndSent) {
- TraceDebug.debug("Thread started: " + Thread.currentThread().getName());
- handleProviderStarted(getTraceModel());
- startIndSent = true;
- }
-
- return syntheticEvent;
- }
- };
-
- // preserve the associated sub request to control it e.g.
- // cancellation
- fEventProviderRequests.put(traceManager, subRequest);
-
- // start request
- TmfExperiment<LttngEvent> provider = (TmfExperiment<LttngEvent>) fExperiment.getValue();
- provider.sendRequest(subRequest);
-
- // provider.sendRequest(subRequest, ExecutionType.LONG);
- subRequestQueued = true;
- }
+ return syntheticEvent;
+ }
+ };
+
+ // start request
+ TmfExperiment<LttngEvent> provider = (TmfExperiment<LttngEvent>) fExperiment.getValue();
+ provider.sendRequest(subRequest);
+
+ // provider.sendRequest(subRequest, ExecutionType.LONG);
+ subRequestQueued = true;
experiment.endSynch(new TmfEndSynchSignal(0));
@@ -339,21 +307,7 @@ public class LttngSyntheticEventProvider extends
startIndEvent.setSequenceInd(SequenceInd.STARTREQ);
// Notify application
- LttngSyntheticEvent[] result = new LttngSyntheticEvent[1];
- result[0] = startIndEvent;
- fmainRequest.setData(result);
- fmainRequest.handleData();
- result[0] = fStatusEventAck;
- fmainRequest.setData(result);
- fmainRequest.handleData();
-
-// try {
-// queueResult(startIndEvent);
-// queueResult(fStatusEventAck);
-// } catch (InterruptedException e) {
-// // TODO: cancel this request
-// e.printStackTrace();
-// }
+ fmainRequest.handleData(startIndEvent);
// Notify state event processor
fstateUpdateProcessor.process(startIndEvent, null);
@@ -363,51 +317,22 @@ public class LttngSyntheticEventProvider extends
* Notify listeners, no more events for the current request will be
* distributed e.g. update view.
*/
- public synchronized void handleProviderDone(LttngTraceState traceModel) {
- // TODO: The use of a thread per main request and thread per sub-request
- // requires
- // to make sure the proper main request is marked completed. So a
- // relationship of sub-requests to parent needs to be established to
- // handle completion and cancellations properly
-
- // Close the main request when all sub-requests are marked completed
- for (LttngBaseEventRequest subRequest : fEventProviderRequests.values()) {
- if (subRequest != null) {
- if (!subRequest.isCompleted()) {
- // Not ready to complete main request
- return;
- }
- }
+ public synchronized void handleProviderDone() {
+ // Notify application. One notification per trace so the last state of each trace can be
+ // drawn
+ LttngTraceState traceModel;
+ Iterator<IStateTraceManager> iter = fEventProviderRequests.iterator();
+ while(iter.hasNext()) {
+ traceModel = iter.next().getStateModel();
+
+ LttngSyntheticEvent finishEvent = new LttngSyntheticEvent(fStatusEvent);
+ finishEvent.setSequenceInd(SequenceInd.ENDREQ);
+ finishEvent.setTraceModel(traceModel);
+
+ fmainRequest.handleData(finishEvent);
+ fmainRequest.done();
}
-
- // All sub-requests are marked completed so the main request can be
- // completed as well
- // Notify application,
- LttngSyntheticEvent finishEvent = new LttngSyntheticEvent(fStatusEvent);
- finishEvent.setSequenceInd(SequenceInd.ENDREQ);
- finishEvent.setTraceModel(traceModel);
-
- LttngSyntheticEvent[] result = new LttngSyntheticEvent[1];
- result[0] = finishEvent;
- fmainRequest.setData(result);
- fmainRequest.handleData();
- result[0] = fStatusEventAck;
- fmainRequest.setData(result);
- fmainRequest.handleData();
- fmainRequest.done();
-
- // try {
-// queueResult(finishEvent);
-// queueResult(fStatusEventAck);
-// // End the loop in the main request
-// queueResult(LttngSyntheticEvent.NullEvent);
-// } catch (InterruptedException e) {
-// // System.out.println(getName() +
-// // ":handleProviderDone() failed to queue request");
-// // TODO: Cancel the request
-//// e.printStackTrace();
-// }
}
/**
@@ -430,16 +355,8 @@ public class LttngSyntheticEventProvider extends
* @param experimentNode
*/
public synchronized void reset(LTTngTreeNode experimentNode) {
-
fmainRequest = null;
- // Make sure previous request are terminated
- for (LttngBaseEventRequest tmpRequest : fEventProviderRequests.values()) {
- if (tmpRequest != null && !tmpRequest.isCompleted()) {
- tmpRequest.cancel();
- }
- }
-
fEventProviderRequests.clear();
fMainReqEventCount = 0;
startIndSent = false;
@@ -449,7 +366,7 @@ public class LttngSyntheticEventProvider extends
LTTngTreeNode[] traces = fExperiment.getChildren();
for (LTTngTreeNode trace : traces) {
IStateTraceManager traceBaseEventProvider = (IStateTraceManager) trace;
- fEventProviderRequests.put(traceBaseEventProvider, null);
+ fEventProviderRequests.add(traceBaseEventProvider);
}
}
@@ -518,14 +435,4 @@ public class LttngSyntheticEventProvider extends
return null;
}
-// @Override
-// public LttngSyntheticEvent getNext(ITmfContext context) {
-// return super.getNext(context);
-// }
-
-// @Override
-// public void queueResult(LttngSyntheticEvent data) {
-// super.queueResult(data);
-// }
-
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java
index ea4a01025b..dbb15b9880 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java
@@ -65,7 +65,7 @@ public class LttngEvent extends TmfEvent {
/**
- * Return the parent trace asoociated with this event
+ * Return the parent trace associated with this event
*
* @return Parent trace
*/
@@ -179,4 +179,14 @@ public class LttngEvent extends TmfEvent {
return result.toString();
}
+
+ @Override
+ public LttngEvent clone() {
+ LttngEvent clone = (LttngEvent) super.clone();
+ clone.getContent().setEvent(clone);
+ clone.parentTrace = parentTrace;
+ clone.jniEventReference = jniEventReference;
+ return clone;
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java
index c8b6d45408..e6f8edeebc 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java
@@ -260,6 +260,21 @@ public class LttngEventContent extends TmfEventContent {
}
return strBuffer.toString();
-
}
+
+ @Override
+ public LttngEventContent clone() {
+ LttngEventContent clone = (LttngEventContent) super.clone();
+ LttngEventField[] fields = getFields();
+ clone.fFields = new LttngEventField[fields.length];
+ for (int i = 0; i < fields.length; i++) {
+ clone.fFields[i] = fields[i].clone();
+ }
+ clone.fFieldsMap = new HashMap<String, LttngEventField>();
+ for (String key : fFieldsMap.keySet()) {
+ clone.fFieldsMap.put(new String(key), ((LttngEventField) fFieldsMap.get(key)).clone());
+ }
+ return clone;
+ }
+
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventField.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventField.java
index 31b15bb2e0..ac67c760de 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventField.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventField.java
@@ -57,7 +57,15 @@ public class LttngEventField extends TmfEventField {
@Override
public String toString() {
- return getId().toString() + ":" + getValue().toString();
+ Object value = getValue();
+ return getId() + ":" + ((value != null) ? value.toString() : "null");
+ }
+
+ @Override
+ public LttngEventField clone() {
+ LttngEventField clone = (LttngEventField) super.clone();
+ clone.fValue = fValue;
+ return clone;
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java
index 9ed0652854..d6f8b124de 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java
@@ -85,4 +85,11 @@ public class LttngEventReference extends TmfEventReference {
return tracename;
}
+ @Override
+ public LttngEventReference clone() {
+ LttngEventReference clone = (LttngEventReference) super.clone();
+ clone.fReference = new String((String) fReference);
+ clone.tracename = new String((String) tracename);
+ return clone;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java
index 861c03bb38..68d9c61237 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java
@@ -62,4 +62,11 @@ public class LttngEventSource extends TmfEventSource {
public String toString() {
return fSourceId.toString();
}
+
+ @Override
+ public LttngEventSource clone() {
+ LttngEventSource clone = (LttngEventSource) super.clone();
+ clone.fSourceId = new String((String) fSourceId);
+ return clone;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java
index 156cd4e8f4..82505e532e 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java
@@ -84,4 +84,14 @@ public class LttngEventType extends TmfEventType {
// ...but maybe we should?
return tracefileName + "/" + cpuId.toString() + "/" + markerName;
}
+
+ @Override
+ public LttngEventType clone() {
+ LttngEventType clone = (LttngEventType) super.clone();
+ clone.tracefileName = new String(tracefileName);
+ clone.cpuId = new Long(cpuId);
+ clone.markerName = new String(markerName);
+ return clone;
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngSyntheticEvent.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngSyntheticEvent.java
index d348e161dc..92a45a8cb3 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngSyntheticEvent.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngSyntheticEvent.java
@@ -42,7 +42,7 @@ public class LttngSyntheticEvent extends LttngEvent {
* </p>
*/
public enum SequenceInd {
- STARTREQ, BEFORE, UPDATE, AFTER, ENDREQ, ACK
+ STARTREQ, BEFORE, UPDATE, AFTER, ENDREQ
};
private SequenceInd sequence = SequenceInd.BEFORE;
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java
index df1da9e42a..c282a554f0 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java
@@ -158,4 +158,10 @@ public class LttngTimestamp extends TmfTimestamp {
return result;
}
+
+ @Override
+ public LttngTimestamp clone() {
+ return (LttngTimestamp) super.clone();
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngBaseEventRequest.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngBaseEventRequest.java
index 700b355c34..91622be46b 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngBaseEventRequest.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngBaseEventRequest.java
@@ -8,17 +8,16 @@
*
* Contributors:
* Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ * Marc Dumais (marc.dumais@ericsson.com) - Fix for 316455 (first part)
*******************************************************************************/
package org.eclipse.linuxtools.lttng.request;
import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
import org.eclipse.linuxtools.tmf.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
/**
* This class is an extension of Tmf Event Request which includes specific
@@ -35,8 +34,6 @@ public abstract class LttngBaseEventRequest extends TmfEventRequest<LttngEvent>
// =======================================================================
private long numOfEvents = 0;
private boolean clearDataInd = false;
- private final LttngTraceState ftraceModel;
- private final ITmfTrace ftrace;
/**
* The time to send events to the application as requested, Note: The start
* time of the request for base events is adjusted to the nearest check
@@ -53,16 +50,13 @@ public abstract class LttngBaseEventRequest extends TmfEventRequest<LttngEvent>
* @param offset
* @param nbEvents
* @param maxBlockSize
- * @param traceModel
+ * @param traceState
* @param listener
*/
public LttngBaseEventRequest(TmfTimeRange range, TmfTimestamp dispatchTime, long offset, int nbEvents,
- int maxBlockSize, LttngTraceState traceModel, ITmfDataRequest.ExecutionType execType, ITmfTrace trace) {
- super(LttngEvent.class, range, nbEvents, maxBlockSize, execType);
- ftraceModel = traceModel;
+ int maxBlockSize, ITmfDataRequest.ExecutionType execType) {
+ super(LttngEvent.class, range, nbEvents, maxBlockSize, execType);
fDispatchTime = dispatchTime;
- ftrace = trace;
-
}
@Override
@@ -123,23 +117,10 @@ public abstract class LttngBaseEventRequest extends TmfEventRequest<LttngEvent>
}
/**
- * @return the ftraceModel, Trace state-data-model associated to this event
- */
- public LttngTraceState getTraceModel() {
- return ftraceModel;
- }
-
- /**
* @return The time to start dispatching events to the application
*/
public TmfTimestamp getDispatchTime() {
return fDispatchTime;
}
-
- /**
- * @return
- */
- public ITmfTrace getTrace() {
- return ftrace;
- }
+
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java
index 1a59d8210f..e7757dac8c 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/request/LttngSyntEventRequest.java
@@ -53,7 +53,7 @@ public class LttngSyntEventRequest extends TmfEventRequest<LttngSyntheticEvent>
int maxBlockSize, IRequestStatusListener listener,
TmfTimeRange experimentTimeRange, ITransEventProcessor processor) {
- this(range, offset, nbEvents, maxBlockSize, listener, experimentTimeRange, processor, ExecutionType.SHORT);
+ this(range, offset, nbEvents, maxBlockSize, listener, experimentTimeRange, processor, ExecutionType.FOREGROUND);
}
/**
@@ -68,7 +68,6 @@ public class LttngSyntEventRequest extends TmfEventRequest<LttngSyntheticEvent>
TmfTimeRange experimentTimeRange, ITransEventProcessor processor, ExecutionType execType) {
super(LttngSyntheticEvent.class, range, nbEvents, maxBlockSize, execType);
- //super(0, nbEvents, maxBlockSize);
fExperimentTimeRange = experimentTimeRange;
addListener(listener);
@@ -170,7 +169,8 @@ public class LttngSyntEventRequest extends TmfEventRequest<LttngSyntheticEvent>
* @see org.eclipse.linuxtools.lttng.request.ILttngEventRequest#handleData()
*/
@Override
- public void handleData() {
+ public void handleData(LttngSyntheticEvent event) {
+ super.handleData(event);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java
index dbd53ba3f8..2c73665e0a 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-+ * Copyright (c) 2009, 2010 Ericsson
+ * Copyright (c) 2009, 2010 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -8,6 +8,7 @@
*
* Contributors:
* Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
+ * Marc Dumais (marc.dumais@ericsson.com) - Fix for 316455 (second part)
*******************************************************************************/
package org.eclipse.linuxtools.lttng.state.experiment;
@@ -51,7 +52,8 @@ public class StateExperimentManager extends LTTngTreeNode implements
* Used to route incoming events to proper trace manager, during check point
* building
*/
- private final Map<String, IStateTraceManager> ftraceToManagerMap = new HashMap<String, IStateTraceManager>();
+ private final Map<ITmfTrace, IStateTraceManager> ftraceToManagerMap = new HashMap<ITmfTrace, IStateTraceManager>();
+ private final Map<ITmfTrace, Long> ftraceEventsReadMap = new HashMap<ITmfTrace, Long>();
private LttngSyntheticEvent syntheticEvent = null;
private ITmfEventRequest<LttngEvent> fStateCheckPointRequest = null;
@@ -61,8 +63,7 @@ public class StateExperimentManager extends LTTngTreeNode implements
// =======================================================================
public StateExperimentManager(Long id, String name) {
super(id, null, name, null);
- fexperimentListener = new StateExperimentListener("Experiment Manager",
- this);
+ fexperimentListener = new StateExperimentListener("Experiment Manager", this);
}
@@ -203,22 +204,6 @@ public class StateExperimentManager extends LTTngTreeNode implements
// trigger data request to build the state system check points
fStateCheckPointRequest = buildCheckPoints(experiment);
-
-// LTTngTreeNode experimentNode = getChildByName(experiment.getName());
-// if (experimentNode != null) {
-// // get the trace manager nodes
-// LTTngTreeNode[] traceNodes = experimentNode.getChildren();
-// for (LTTngTreeNode traceStateManagerNode : traceNodes) {
-// // The trace node needs to perform its first data request
-// // for this experiment with the main goal of building its
-// // checkpoints
-// if (traceStateManagerNode instanceof ILttExperimentSelectedListener) {
-// // no need to provide the trace to the trace manager
-// ((ILttExperimentSelectedListener) traceStateManagerNode).experimentUpdated(
-// new TmfExperimentUpdatedSignal(source, experiment, null), fwaitForCompletion);
-// }
-// }
-// }
}
/*
@@ -295,6 +280,7 @@ public class StateExperimentManager extends LTTngTreeNode implements
LTTngTreeNode[] traceNodes = experimentNode.getChildren();
synchronized (this) {
ftraceToManagerMap.clear();
+ ftraceEventsReadMap.clear();
}
ITmfTrace trace;
@@ -314,7 +300,8 @@ public class StateExperimentManager extends LTTngTreeNode implements
// build the trace to manager mapping for event dispatching
trace = traceManager.getTrace();
synchronized (this) {
- ftraceToManagerMap.put(getTraceKey(trace), traceManager);
+ ftraceToManagerMap.put(trace, traceManager);
+ ftraceEventsReadMap.put(trace, new Long(0));
}
}
@@ -327,10 +314,10 @@ public class StateExperimentManager extends LTTngTreeNode implements
// Prepare event data request to build state model
ITmfEventRequest<LttngEvent> request = new TmfEventRequest<LttngEvent>(
LttngEvent.class, TmfTimeRange.Eternity,
- TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.LONG) {
-
- Long nbEvents = 0L;
+ TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.BACKGROUND) {
+ long nbEventsHandled = 0;
+
/*
* (non-Javadoc)
*
@@ -338,21 +325,18 @@ public class StateExperimentManager extends LTTngTreeNode implements
* org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleData()
*/
@Override
- public void handleData() {
- LttngEvent[] events = getData();
- if (events.length > 0) {
- nbEvents++;
-
- LttngEvent event = (LttngEvent) events[0];
-
+ public void handleData(LttngEvent event) {
+ super.handleData(event);
+ if (event != null) {
// Tracer.trace("Chk: " + event.getTimestamp());
-
+ nbEventsHandled++;
ITmfTrace trace = event.getParentTrace();
- IStateTraceManager traceManager = ftraceToManagerMap.get(getTraceKey(trace));
+ IStateTraceManager traceManager = ftraceToManagerMap.get(trace);
+ long nbEvents = ftraceEventsReadMap.get(trace) + 1;
+ ftraceEventsReadMap.put(trace, nbEvents);
if (traceManager != null) {
// obtain synthetic event
- LttngSyntheticEvent synEvent = updateSynEvent(event,
- traceManager);
+ LttngSyntheticEvent synEvent = updateSynEvent(event, traceManager);
// update state system, and save check points as needed
traceManager.handleEvent(synEvent, nbEvents);
} else {
@@ -400,11 +384,8 @@ public class StateExperimentManager extends LTTngTreeNode implements
* @param header
*/
private void printCompletedMessage() {
-// System.out.println(System.currentTimeMillis() + ": StateExperimentManager completed checkpoints");
-
- // super.handleCompleted();
if (TraceDebug.isDEBUG()) {
- TraceDebug.debug("Trace check point building completed, number of events handled: " + nbEvents
+ TraceDebug.debug("Trace check point building completed, number of events handled: " + nbEventsHandled
+ "\n\t\t");
for (IStateTraceManager traceMgr : ftraceToManagerMap.values()) {
TraceDebug.debug(traceMgr.toString() + "\n\t\t");
@@ -427,16 +408,6 @@ public class StateExperimentManager extends LTTngTreeNode implements
return request;
}
- /**
- * Simplified trace key used to identify trace within experiment
- *
- * @param trace
- * @return
- */
- private String getTraceKey(ITmfTrace trace) {
- String traceKey = trace.getPath() + trace.getName();
- return traceKey;
- }
private LttngSyntheticEvent updateSynEvent(LttngEvent e, IStateTraceManager stateTraceManager) {
if (syntheticEvent == null || syntheticEvent.getBaseEvent() != e) {
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java
index 4a19227466..f1a065250f 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngExecutionState.java
@@ -149,4 +149,10 @@ public class LttngExecutionState implements Cloneable {
public void setExec_submode(String execSubmode) {
exec_submode = execSubmode;
}
+
+ @Override
+ public String toString() {
+ return "[LttngExecutionState: " + "entry=" + entry_LttTime + ",change=" + change_LttTime + ",cum_cpu=" + cum_cpu_time_Timens +
+ ",pstatus=" + proc_status + ",emode=" + exec_mode + ",esubmode=" + exec_submode +"]";
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java
index c30c61813e..90e0c551c9 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java
@@ -487,4 +487,15 @@ public class LttngProcessState implements Cloneable {
public LttngExecutionState getFirstElementFromExecutionStack() {
return execution_stack.firstElement();
}
+
+ @Override
+ public String toString() {
+ String stateSt = state.toString();
+ String eStackSt = execution_stack.toString();
+
+ return "[LttngProcessState: " + "cpu=" + cpu + ",pid=" + pid + ",tgid=" + tgid + ",name=" + name + ",ctime=" + creation_time +
+ ",brand=" + brand + ",type=" + type + ",cfunc=" + current_function + ",ppid=" + ppid + ",itime=" + insertion_time + ",ptime=" + pid_time +
+ ",fevents=" + free_events + ",state=" + stateSt + ",estack=" + eStackSt + ",ustack=" + user_stack + ",utrace=" + userTrace +
+ ",tpid=" + target_pid + ",trace=" + trace_id + "]";
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java
index 094aeb9a12..b26a519add 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/trace/StateTraceManager.java
@@ -351,12 +351,10 @@ public class StateTraceManager extends LTTngTreeNode implements IStateTraceManag
* ()
*/
@Override
- public void handleData() {
- LttngSyntheticEvent[] result = getData();
-
- evt[0] = (result.length > 0) ? result[0] : null;
- if (evt[0] != null) {
- synEvent = (LttngSyntheticEvent) evt[0];
+ public void handleData(LttngSyntheticEvent event) {
+ super.handleData(event);
+ if (event != null) {
+ synEvent = event;
if (synEvent.getSynType() == SequenceInd.AFTER) {
// Note : We call this function before incrementing
// eventCount to save a default check point at the "0th"
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java
new file mode 100644
index 0000000000..20589dd00f
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngExperiment.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng.trace;
+
+import org.eclipse.linuxtools.tmf.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.experiment.TmfExperiment;
+import org.eclipse.linuxtools.tmf.experiment.TmfExperimentContext;
+import org.eclipse.linuxtools.tmf.experiment.TmfExperimentLocation;
+import org.eclipse.linuxtools.tmf.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.trace.TmfContext;
+
+/**
+ * <b><u>LTTngExperiment</u></b>
+ * <p>
+ * Temporary class to resolve a basic incompatibility between TMF and LTTng.
+ * <p>
+ */
+public class LTTngExperiment<T extends TmfEvent> extends TmfExperiment<T> implements ITmfTrace {
+
+ private static final int DEFAULT_INDEX_PAGE_SIZE = 5000;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * @param type
+ * @param id
+ * @param traces
+ * @param epoch
+ * @param indexPageSize
+ */
+ public LTTngExperiment(Class<T> type, String id, ITmfTrace[] traces, TmfTimestamp epoch, int indexPageSize) {
+ this(type, id, traces, TmfTimestamp.Zero, indexPageSize, false);
+ }
+
+ public LTTngExperiment(Class<T> type, String id, ITmfTrace[] traces, TmfTimestamp epoch, int indexPageSize, boolean preIndexExperiment) {
+ super(type, id, traces, epoch, indexPageSize, preIndexExperiment);
+ }
+
+ /**
+ * @param type
+ * @param id
+ * @param traces
+ */
+ public LTTngExperiment(Class<T> type, String id, ITmfTrace[] traces) {
+ this(type, id, traces, TmfTimestamp.Zero, DEFAULT_INDEX_PAGE_SIZE);
+ }
+
+ /**
+ * @param type
+ * @param id
+ * @param traces
+ * @param indexPageSize
+ */
+ public LTTngExperiment(Class<T> type, String id, ITmfTrace[] traces, int indexPageSize) {
+ this(type, id, traces, TmfTimestamp.Zero, indexPageSize);
+ }
+
+ public LTTngExperiment(LTTngExperiment<T> other) {
+ super(other.getName() + "(clone)", other.fType);
+
+ fEpoch = other.fEpoch;
+ fIndexPageSize = other.fIndexPageSize;
+
+ fTraces = new ITmfTrace[other.fTraces.length];
+ for (int trace = 0; trace < other.fTraces.length; trace++) {
+ fTraces[trace] = other.fTraces[trace].createTraceCopy();
+ }
+
+ fNbEvents = other.fNbEvents;
+ fTimeRange = other.fTimeRange;
+ }
+
+ @Override
+ public LTTngExperiment<T> createTraceCopy() {
+ LTTngExperiment<T> experiment = new LTTngExperiment<T>(this);
+ TmfSignalManager.deregister(experiment);
+ return experiment;
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTrace trace positioning
+ // ------------------------------------------------------------------------
+
+ @Override
+ public synchronized TmfEvent getNextEvent(TmfContext context) {
+
+ // Validate the context
+ if (!(context instanceof TmfExperimentContext)) {
+ return null; // Throw an exception?
+ }
+
+ if (!context.equals(fExperimentContext)) {
+// Tracer.trace("Ctx: Restoring context");
+ seekLocation(context.getLocation());
+ }
+
+ TmfExperimentContext expContext = (TmfExperimentContext) context;
+
+// dumpContext(expContext, true);
+
+ // If an event was consumed previously, get the next one from that trace
+ int lastTrace = expContext.getLastTrace();
+ if (lastTrace != TmfExperimentContext.NO_TRACE) {
+ TmfContext traceContext = expContext.getContexts()[lastTrace];
+ expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].getNextEvent(traceContext);
+ expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
+ }
+
+ // Scan the candidate events and identify the "next" trace to read from
+ int trace = TmfExperimentContext.NO_TRACE;
+ TmfTimestamp timestamp = TmfTimestamp.BigCrunch;
+ for (int i = 0; i < expContext.getTraces().length; i++) {
+ TmfEvent event = expContext.getEvents()[i];
+ if (event != null && event.getTimestamp() != null) {
+ TmfTimestamp otherTS = event.getTimestamp();
+ if (otherTS.compareTo(timestamp, true) < 0) {
+ trace = i;
+ timestamp = otherTS;
+ }
+ }
+ }
+
+ // Update the experiment context and set the "next" event
+ TmfEvent event = null;
+ if (trace != TmfExperimentContext.NO_TRACE) {
+// updateIndex(expContext, timestamp);
+
+ TmfContext traceContext = expContext.getContexts()[trace];
+ TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation();
+ expLocation.getLocation()[trace] = traceContext.getLocation().clone();
+
+ updateIndex(expContext, timestamp);
+
+ expLocation.getRanks()[trace] = traceContext.getRank();
+ expContext.setLastTrace(trace);
+ expContext.updateRank(1);
+ event = expContext.getEvents()[trace];
+ }
+
+// if (event != null) {
+// Tracer.trace("Exp: " + (expContext.getRank() - 1) + ": " + event.getTimestamp().toString());
+// dumpContext(expContext, false);
+// Tracer.trace("Ctx: Event returned= " + event.getTimestamp().toString());
+// }
+
+ return event;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "[LTTngExperiment (" + getName() + ")]";
+ }
+
+}
diff --git a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java
index 9574719dc1..589759f139 100644
--- a/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java
+++ b/lttng/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java
@@ -33,6 +33,7 @@ import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.trace.TmfContext;
import org.eclipse.linuxtools.tmf.trace.TmfTrace;
@@ -54,14 +55,11 @@ class LTTngTraceException extends LttngException {
*/
public class LTTngTrace extends TmfTrace<LttngEvent> {
-// // [lmcfrch]
-// private long lastTime = 0;
-
- public static boolean printDebug = false;
- public static boolean uniqueEvent = false;
+ public static boolean printDebug = false;
+ public static boolean uniqueEvent = true;
private final static boolean SHOW_LTT_DEBUG_DEFAULT = false;
- private final static boolean IS_PARSING_NEEDED_DEFAULT = true;
+ private final static boolean IS_PARSING_NEEDED_DEFAULT = !uniqueEvent;
private final static int CHECKPOINT_PAGE_SIZE = 1000;
// Reference to our JNI trace
@@ -79,7 +77,6 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
LttngEventContent eventContent = null;
LttngEventReference eventReference = null;
-
// The actual event
LttngEvent currentLttngEvent = null;
@@ -167,11 +164,13 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
// Even if we don't have any index, set ONE checkpoint
// fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L) , new LttngLocation() ) );
- // Set the start time of the trace
- setTimeRange( new TmfTimeRange( new LttngTimestamp(currentJniTrace.getStartTime().getTime()),
- new LttngTimestamp(currentJniTrace.getEndTime().getTime())
- ) );
-// }
+ // Set the time range of the trace
+ TmfContext context = seekLocation(null);
+ LttngEvent event = getNextEvent(context);
+ LttngTimestamp startTime = new LttngTimestamp(event.getTimestamp());
+ LttngTimestamp endTime = new LttngTimestamp(currentJniTrace.getEndTime().getTime());
+
+ setTimeRange(new TmfTimeRange(startTime, endTime));
}
@@ -409,6 +408,9 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
LttngLocation curLocation = null;
if ( location == null ) {
curLocation = new LttngLocation();
+ TmfContext context = seekEvent(curLocation.getOperationTime());
+ context.setRank(ITmfContext.INITIAL_RANK);
+ return context;
}
else {
curLocation = (LttngLocation)location;
@@ -418,7 +420,21 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
// Update to location should (and will) be done in SeekEvent.
// The only seek valid in LTTng is with the time, we call seekEvent(timestamp)
- return seekEvent( curLocation.getOperationTime() );
+ TmfContext context = seekEvent(curLocation.getOperationTime());
+
+// // Adjust the previousLocation flags
+// if (location instanceof LttngLocation) {
+// LttngLocation lttngLocation = (LttngLocation) location;
+// if (lttngLocation.isLastOperationReadNext()) {
+// previousLocation.setLastOperationReadNext();
+// } else if (lttngLocation.isLastOperationParse()) {
+// previousLocation.setLastOperationParse();
+// } else if (lttngLocation.isLastOperationSeek()) {
+// previousLocation.setLastOperationSeek();
+// }
+// }
+
+ return context;
}
/**
@@ -476,9 +492,6 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
@Override
public synchronized TmfContext seekEvent(long position) {
-// // [lmcfrch]
-// lastTime = 0;
-
if ( printDebug == true ) {
System.out.println("seekEvent(position) position -> " + position);
}
@@ -500,6 +513,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
// Seek to the found time
TmfContext tmpContext = seekEvent(timestamp);
+ tmpContext.setRank((index + 1) * fIndexPageSize);
previousLocation = (LttngLocation)tmpContext.getLocation();
// Ajust the index of the event we found at this check point position
@@ -621,6 +635,9 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
//// [lmcfrch]
// LttngLocation prevLocation = (LttngLocation) savedContext.getLocation();
// LttngLocation currLocation = (LttngLocation) context.getLocation();
+// if (prevLocation.equals(currLocation)) {
+// System.out.println("Aie");
+// }
// Tracer.trace("Trc: " + context.getRank() + ": " + returnedEvent.getTimestamp().toString() + " (" +
// (prevLocation.isLastOperationParse() ? "T" : "F") + "," + (prevLocation.isLastOperationReadNext() ? "T" : "F") + "," + (prevLocation.isLastOperationSeek() ? "T" : "F") + "), (" +
// (currLocation.isLastOperationParse() ? "T" : "F") + "," + (currLocation.isLastOperationReadNext() ? "T" : "F") + "," + (currLocation.isLastOperationSeek() ? "T" : "F") + ")"
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/ChangeLog b/lttng/org.eclipse.linuxtools.tmf.tests/ChangeLog
new file mode 100644
index 0000000000..77377b76c5
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/ChangeLog
@@ -0,0 +1,23 @@
+2010-10-13 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/tests/event/TmfEventContentTest.java: Added unit test for setEvent()
+ * src/org/eclipse/linuxtools/tmf/tests/event/TmfTimeRangeTest.java: Adde unit test for getIntersection()
+
+2010-09-17 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/tests/component/TmfEventProviderTest.java: Adjusted unit test
+ * src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/experiment/TmfMultiTraceExperimentTest.java:Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedDataRequestTest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedEventRequestTest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/request/TmfDataRequestTest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/request/TmfEventRequestTest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/trace/TmfExperimentTest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/tests/trace/TmfTraceTest.java: Adjusted to new handleData() API
+ * stubs/org/eclipse/linuxtools/tmf/component/TmfSyntheticEventProviderStub.java: Adjusted to new handleData() API
+ * stubs/org/eclipse/linuxtools/tmf/request/TmfDataRequestStub.java: Adjusted to new handleData() API
+ * stubs/org/eclipse/linuxtools/tmf/request/TmfEventRequestStub.java: Adjusted to new handleData() API
+
+2010-09-09 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java: Added a few checks
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/component/TmfEventProviderTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/component/TmfEventProviderTest.java
index 8e354a648e..abbfcd2c2f 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/component/TmfEventProviderTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/component/TmfEventProviderTest.java
@@ -96,14 +96,12 @@ public class TmfEventProviderTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request =
new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
- };
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
+ };
provider.sendRequest(request);
try {
request.waitForCompletion();
@@ -132,13 +130,11 @@ public class TmfEventProviderTest extends TestCase {
final TmfEventRequest<TmfSyntheticEventStub> request =
new TmfEventRequest<TmfSyntheticEventStub>(TmfSyntheticEventStub.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfSyntheticEventStub[] events = getData();
- for (TmfSyntheticEventStub e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfSyntheticEventStub event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
provider.sendRequest(request);
@@ -203,7 +199,6 @@ public class TmfEventProviderTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(start, end);
try {
getSyntheticData(range, -1, TmfSyntheticEventProviderStub.BLOCK_SIZE);
-// System.out.println("aie");
} catch (InterruptedException e) {
fail();
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfEventContentTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfEventContentTest.java
index da1de6294c..70cf546c54 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfEventContentTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfEventContentTest.java
@@ -12,6 +12,8 @@
package org.eclipse.linuxtools.tmf.tests.event;
+import junit.framework.TestCase;
+
import org.eclipse.linuxtools.tmf.event.TmfEvent;
import org.eclipse.linuxtools.tmf.event.TmfEventContent;
import org.eclipse.linuxtools.tmf.event.TmfEventContentStub;
@@ -22,8 +24,6 @@ import org.eclipse.linuxtools.tmf.event.TmfEventTypeStub;
import org.eclipse.linuxtools.tmf.event.TmfNoSuchFieldException;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
-import junit.framework.TestCase;
-
/**
* <b><u>TmfEventContentTest</u></b>
* <p>
@@ -61,7 +61,7 @@ public class TmfEventContentTest extends TestCase {
public TmfEventContentTest(String name) {
super(name);
fTimestamp = new TmfTimestamp();
- fEventSource = new TmfEventSource();
+ fEventSource = new TmfEventSource(new Object());
fEventType = new TmfEventType();
fEventTypeStub = new TmfEventTypeStub();
fReference = new TmfEventReference();
@@ -113,6 +113,23 @@ public class TmfEventContentTest extends TestCase {
}
// ------------------------------------------------------------------------
+ // setEvent
+ // ------------------------------------------------------------------------
+
+ public void testSetEvent() {
+ TmfEvent event = new TmfEvent(fTimestamp, fEventSource, fEventType, fReference);
+ TmfEventContent content1 = new TmfEventContent(event, fRawContent0);
+ event.setContent(content1);
+ TmfEventContent content2 = new TmfEventContent(null, fRawContent1);
+
+ content2.setEvent(event);
+
+ assertEquals("setEvent", event, content2.getEvent());
+// assertEquals("setEvent", content2, event.getContent());
+// assertEquals("setEvent", null, content1.getEvent());
+ }
+
+ // ------------------------------------------------------------------------
// equals
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfTimeRangeTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfTimeRangeTest.java
index 4efb0335c3..ea99827e05 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfTimeRangeTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/event/TmfTimeRangeTest.java
@@ -219,4 +219,64 @@ public class TmfTimeRangeTest extends TestCase {
assertFalse("contains (high value)", range.contains(new TmfTimestamp(12351)));
}
+ // ------------------------------------------------------------------------
+ // getIntersection
+ // ------------------------------------------------------------------------
+
+ public void testGetIntersection() throws Exception {
+
+ TmfTimestamp ts1a = new TmfTimestamp(1000);
+ TmfTimestamp ts1b = new TmfTimestamp(2000);
+ TmfTimeRange range1 = new TmfTimeRange(ts1a, ts1b);
+
+ TmfTimestamp ts2a = new TmfTimestamp(2000);
+ TmfTimestamp ts2b = new TmfTimestamp(3000);
+ TmfTimeRange range2 = new TmfTimeRange(ts2a, ts2b);
+
+ TmfTimestamp ts3a = new TmfTimestamp(3000);
+ TmfTimestamp ts3b = new TmfTimestamp(4000);
+ TmfTimeRange range3 = new TmfTimeRange(ts3a, ts3b);
+
+ TmfTimestamp ts4a = new TmfTimestamp(1500);
+ TmfTimestamp ts4b = new TmfTimestamp(2500);
+ TmfTimeRange range4 = new TmfTimeRange(ts4a, ts4b);
+
+ TmfTimestamp ts5a = new TmfTimestamp(1500);
+ TmfTimestamp ts5b = new TmfTimestamp(2000);
+ TmfTimeRange range5 = new TmfTimeRange(ts5a, ts5b);
+
+ TmfTimestamp ts6a = new TmfTimestamp(2000);
+ TmfTimestamp ts6b = new TmfTimestamp(2500);
+ TmfTimeRange range6 = new TmfTimeRange(ts6a, ts6b);
+
+ TmfTimestamp ts7a = new TmfTimestamp(1500);
+ TmfTimestamp ts7b = new TmfTimestamp(3500);
+ TmfTimeRange range7 = new TmfTimeRange(ts7a, ts7b);
+
+ TmfTimestamp ts8a = new TmfTimestamp(2250);
+ TmfTimestamp ts8b = new TmfTimestamp(2750);
+ TmfTimeRange range8 = new TmfTimeRange(ts8a, ts8b);
+
+ assertEquals("getIntersection (below - not contiguous)", null, range1.getIntersection(range3));
+ assertEquals("getIntersection (above - not contiguous)", null, range3.getIntersection(range1));
+
+ assertEquals("getIntersection (below - contiguous)", new TmfTimeRange(ts1b, ts1b), range1.getIntersection(range2));
+ assertEquals("getIntersection (above - contiguous)", new TmfTimeRange(ts3a, ts3a), range3.getIntersection(range2));
+
+ assertEquals("getIntersection (below - overlap)", new TmfTimeRange(ts2a, ts4b), range2.getIntersection(range4));
+ assertEquals("getIntersection (above - overlap)", new TmfTimeRange(ts2a, ts4b), range4.getIntersection(range2));
+
+ assertEquals("getIntersection (within - overlap1)", range6, range2.getIntersection(range6));
+ assertEquals("getIntersection (within - overlap2)", range6, range6.getIntersection(range2));
+
+ assertEquals("getIntersection (within - overlap3)", range5, range1.getIntersection(range5));
+ assertEquals("getIntersection (within - overlap4)", range5, range5.getIntersection(range1));
+
+ assertEquals("getIntersection (within - overlap5)", range8, range2.getIntersection(range8));
+ assertEquals("getIntersection (within - overlap6)", range8, range8.getIntersection(range2));
+
+ assertEquals("getIntersection (accross1)", range2, range2.getIntersection(range7));
+ assertEquals("getIntersection (accross2)", range2, range7.getIntersection(range2));
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java
index 3943bd0859..589eac0a6c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfExperimentTest.java
@@ -106,6 +106,9 @@ public class TmfExperimentTest extends TestCase {
assertEquals("GetEpoch", TmfTimestamp.Zero, fExperiment.getEpoch());
assertEquals("GetNbEvents", NB_EVENTS, fExperiment.getNbEvents());
+ long nbTraceEvents = fExperiment.getTraces()[0].getNbEvents();
+ assertEquals("GetNbEvents", NB_EVENTS, nbTraceEvents);
+
TmfTimeRange timeRange = fExperiment.getTimeRange();
assertEquals("getStartTime", 1, timeRange.getStartTime().getValue());
assertEquals("getEndTime", NB_EVENTS, timeRange.getEndTime().getValue());
@@ -560,11 +563,9 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
@Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
}
};
fExperiment.sendRequest(request);
@@ -589,13 +590,11 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -620,13 +619,11 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -654,15 +651,14 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- // Cancel request after the first chunk is received
- cancel();
- }
+ int nbRead = 0;
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ if (++nbRead == blockSize)
+ cancel();
+ }
@Override
public void handleCancel() {
if (requestedEvents.size() < blockSize) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfMultiTraceExperimentTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfMultiTraceExperimentTest.java
index 739ad21bd9..a573bf19cc 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfMultiTraceExperimentTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/experiment/TmfMultiTraceExperimentTest.java
@@ -566,13 +566,11 @@ public class TmfMultiTraceExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -596,13 +594,11 @@ public class TmfMultiTraceExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -627,13 +623,11 @@ public class TmfMultiTraceExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -661,15 +655,14 @@ public class TmfMultiTraceExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- // Cancel request after the first chunk is received
- cancel();
- }
+ int nbRead = 0;
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ if (++nbRead == blockSize)
+ cancel();
+ }
@Override
public void handleCancel() {
if (requestedEvents.size() < blockSize) {
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedDataRequestTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedDataRequestTest.java
index 3187347c12..a0ddf94611 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedDataRequestTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedDataRequestTest.java
@@ -16,10 +16,6 @@ package org.eclipse.linuxtools.tmf.tests.request;
import junit.framework.TestCase;
import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.event.TmfEventReference;
-import org.eclipse.linuxtools.tmf.event.TmfEventSource;
-import org.eclipse.linuxtools.tmf.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.request.TmfCoalescedDataRequest;
import org.eclipse.linuxtools.tmf.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.request.TmfDataRequestStub;
@@ -112,7 +108,6 @@ public class TmfCoalescedDataRequestTest extends TestCase {
assertEquals("getIndex", 0, request.getIndex());
assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -129,7 +124,6 @@ public class TmfCoalescedDataRequestTest extends TestCase {
assertEquals("getIndex", 10, request.getIndex());
assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -146,7 +140,6 @@ public class TmfCoalescedDataRequestTest extends TestCase {
assertEquals("getIndex", 10, request.getIndex());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -163,7 +156,6 @@ public class TmfCoalescedDataRequestTest extends TestCase {
assertEquals("getIndex", 10, request.getIndex());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", 200, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -220,10 +212,10 @@ public class TmfCoalescedDataRequestTest extends TestCase {
// ------------------------------------------------------------------------
public void testToString() {
- String expected1 = "[TmfCoalescedDataRequest(0,TmfEvent,10,100,200)]";
- String expected2 = "[TmfCoalescedDataRequest(1,TmfEvent,20,100,200)]";
- String expected3 = "[TmfCoalescedDataRequest(2,TmfEvent,20,200,200)]";
- String expected4 = "[TmfCoalescedDataRequest(3,TmfEvent,20,200,300)]";
+ String expected1 = "[TmfCoalescedDataRequest(0,TmfEvent,10,100)]";
+ String expected2 = "[TmfCoalescedDataRequest(1,TmfEvent,20,100)]";
+ String expected3 = "[TmfCoalescedDataRequest(2,TmfEvent,20,200)]";
+ String expected4 = "[TmfCoalescedDataRequest(3,TmfEvent,20,200)]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@@ -240,60 +232,10 @@ public class TmfCoalescedDataRequestTest extends TestCase {
TmfDataRequest<TmfEvent> request1 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 100, 200);
TmfDataRequest<TmfEvent> request2 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 11, 100, 200);
TmfDataRequest<TmfEvent> request3 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 101, 200);
- TmfDataRequest<TmfEvent> request4 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 100, 201);
assertTrue ("isCompatible", coalescedRequest.isCompatible(request1));
assertFalse("isCompatible", coalescedRequest.isCompatible(request2));
assertFalse("isCompatible", coalescedRequest.isCompatible(request3));
- assertFalse("isCompatible", coalescedRequest.isCompatible(request4));
- }
-
- // ------------------------------------------------------------------------
- // setData/getData
- // ------------------------------------------------------------------------
-
- public void testSetData() {
-
- TmfCoalescedDataRequest<TmfEvent> coalescedRequest = new TmfCoalescedDataRequest<TmfEvent>(TmfEvent.class, 10, 100, 200);
- TmfDataRequest<TmfEvent> request1 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 100, 200);
- TmfDataRequest<TmfEvent> request2 = new TmfDataRequestStub<TmfEvent>(TmfEvent.class, 10, 100, 200);
- coalescedRequest.addRequest(request1);
- coalescedRequest.addRequest(request2);
-
- // Initialize the data
- int nbEvents = 10;
- TmfEvent[] events = new TmfEvent[nbEvents];
- for (int i = 0; i < nbEvents; i++) {
- events[i] = new TmfEvent(new TmfTimestamp(i), new TmfEventSource(),
- new TmfEventType(), new TmfEventReference());
- }
-
- coalescedRequest.setData(events);
- coalescedRequest.handleData();
-
- // Validate the coalescing request
- assertEquals("setData", nbEvents, coalescedRequest.getNbRead());
- TmfEvent[] eventsRead1 = coalescedRequest.getData();
- assertEquals("getData", nbEvents, eventsRead1.length);
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead1[i].getTimestamp().getValue());
- }
-
- // Validate the first coalesced request
- assertEquals("setData", nbEvents, request1.getNbRead());
- TmfEvent[] eventsRead2 = request1.getData();
- assertEquals("getData", nbEvents, eventsRead2.length);
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead2[i].getTimestamp().getValue());
- }
-
- // Validate the second coalesced request
- assertEquals("setData", nbEvents, request2.getNbRead());
- TmfEvent[] eventsRead3 = request2.getData();
- assertEquals("getData", nbEvents, eventsRead3.length);
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead3[i].getTimestamp().getValue());
- }
}
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedEventRequestTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedEventRequestTest.java
index 95ff324f8b..b044ccb823 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedEventRequestTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfCoalescedEventRequestTest.java
@@ -25,15 +25,10 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.tmf.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.component.TmfProviderManager;
import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.event.TmfEventReference;
-import org.eclipse.linuxtools.tmf.event.TmfEventSource;
-import org.eclipse.linuxtools.tmf.event.TmfEventType;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.request.TmfCoalescedDataRequest;
import org.eclipse.linuxtools.tmf.request.TmfCoalescedEventRequest;
-import org.eclipse.linuxtools.tmf.request.TmfDataRequest;
-import org.eclipse.linuxtools.tmf.request.TmfDataRequestStub;
import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.request.TmfEventRequestStub;
import org.eclipse.linuxtools.tmf.signal.TmfSignal;
@@ -133,7 +128,6 @@ public class TmfCoalescedEventRequestTest extends TestCase {
assertEquals("getRange", range1, request.getRange());
assertEquals("getNbRequestedEvents", TmfEventRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfEventRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -150,7 +144,6 @@ public class TmfCoalescedEventRequestTest extends TestCase {
assertEquals("getRange", range1, request.getRange());
assertEquals("getNbRequestedEvents", TmfEventRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfEventRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -167,7 +160,6 @@ public class TmfCoalescedEventRequestTest extends TestCase {
assertEquals("getRange", range1, request.getRange());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", TmfEventRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -184,7 +176,6 @@ public class TmfCoalescedEventRequestTest extends TestCase {
assertEquals("getRange", range1, request.getRange());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", 200, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -228,11 +219,11 @@ public class TmfCoalescedEventRequestTest extends TestCase {
public void testEqualsSuper() throws Exception {
TmfCoalescedDataRequest<TmfEvent> dataRequest1 = new TmfCoalescedDataRequest<TmfEvent>(
- fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested(), fRequest1.getBlockize());
+ fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
TmfCoalescedDataRequest<TmfEvent> dataRequest2 = new TmfCoalescedDataRequest<TmfEvent>(
- fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested(), fRequest1.getBlockize());
+ fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
TmfCoalescedDataRequest<TmfEvent> dataRequest3 = new TmfCoalescedDataRequest<TmfEvent>(
- fRequest3.getDataType(), fRequest3.getIndex(), fRequest3.getNbRequested(), fRequest3.getBlockize());
+ fRequest3.getDataType(), fRequest3.getIndex(), fRequest3.getNbRequested());
assertTrue("equals", fRequest1.equals(dataRequest2));
assertTrue("equals", fRequest2.equals(dataRequest1));
@@ -255,10 +246,10 @@ public class TmfCoalescedEventRequestTest extends TestCase {
// ------------------------------------------------------------------------
public void testToString() {
- String expected1 = "[TmfCoalescedEventRequest(0,TmfEvent," + range1 + ",100,200)]";
- String expected2 = "[TmfCoalescedEventRequest(1,TmfEvent," + range2 + ",100,200)]";
- String expected3 = "[TmfCoalescedEventRequest(2,TmfEvent," + range2 + ",200,200)]";
- String expected4 = "[TmfCoalescedEventRequest(3,TmfEvent," + range2 + ",200,300)]";
+ String expected1 = "[TmfCoalescedEventRequest(0,TmfEvent," + range1 + ",100)]";
+ String expected2 = "[TmfCoalescedEventRequest(1,TmfEvent," + range2 + ",100)]";
+ String expected3 = "[TmfCoalescedEventRequest(2,TmfEvent," + range2 + ",200)]";
+ String expected4 = "[TmfCoalescedEventRequest(3,TmfEvent," + range2 + ",200)]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@@ -275,62 +266,10 @@ public class TmfCoalescedEventRequestTest extends TestCase {
TmfEventRequest<TmfEvent> request1 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 200);
TmfEventRequest<TmfEvent> request2 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range2, 100, 200);
TmfEventRequest<TmfEvent> request3 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 101, 200);
- TmfEventRequest<TmfEvent> request4 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 201);
- TmfDataRequest<TmfEvent> request5 = new TmfDataRequestStub<TmfEvent> (TmfEvent.class, 10, 100, 201);
assertTrue ("isCompatible", coalescedRequest.isCompatible(request1));
assertTrue ("isCompatible", coalescedRequest.isCompatible(request2));
assertFalse("isCompatible", coalescedRequest.isCompatible(request3));
- assertFalse("isCompatible", coalescedRequest.isCompatible(request4));
- assertFalse("isCompatible", coalescedRequest.isCompatible(request5));
- }
-
- // ------------------------------------------------------------------------
- // setData/getData
- // ------------------------------------------------------------------------
-
- public void testSetData() {
-
- TmfCoalescedEventRequest<TmfEvent> coalescedRequest = new TmfCoalescedEventRequest<TmfEvent>(TmfEvent.class, range1, 100, 200);
- TmfEventRequest<TmfEvent> request1 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 200);
- TmfEventRequest<TmfEvent> request2 = new TmfEventRequestStub<TmfEvent>(TmfEvent.class, range1, 100, 200);
- coalescedRequest.addRequest(request1);
- coalescedRequest.addRequest(request2);
-
- // Initialize the data
- int nbEvents = 10;
- TmfEvent[] events = new TmfEvent[nbEvents];
- for (int i = 0; i < nbEvents; i++) {
- events[i] = new TmfEvent(new TmfTimestamp(i), new TmfEventSource(),
- new TmfEventType(), new TmfEventReference());
- }
-
- coalescedRequest.setData(events);
- coalescedRequest.handleData();
-
- // Validate the coalescing request
- assertEquals("setData", nbEvents, coalescedRequest.getNbRead());
- TmfEvent[] eventsRead1 = coalescedRequest.getData();
- assertEquals("getData", nbEvents, eventsRead1.length);
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead1[i].getTimestamp().getValue());
- }
-
- // Validate the first coalesced request
- assertEquals("setData", nbEvents, request1.getNbRead());
- TmfEvent[] eventsRead2 = request1.getData();
- assertEquals("getData", nbEvents, eventsRead2.length);
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead2[i].getTimestamp().getValue());
- }
-
- // Validate the second coalesced request
- assertEquals("setData", nbEvents, request2.getNbRead());
- TmfEvent[] eventsRead3 = request2.getData();
- assertEquals("getData", nbEvents, eventsRead3.length);
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead3[i].getTimestamp().getValue());
- }
}
// ------------------------------------------------------------------------
@@ -499,14 +438,13 @@ public class TmfCoalescedEventRequestTest extends TestCase {
requestedEvents1 = new Vector<TmfEvent>();
request1 = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+ int nbRead = 0;
@Override
- public void handleData() {
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
if (!isCompleted()) {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents1.add(e);
- }
- if (signal.forceCancel)
+ requestedEvents1.add(event);
+ if (++nbRead >= BLOCK_SIZE && signal.forceCancel)
cancel();
}
}
@@ -515,12 +453,10 @@ public class TmfCoalescedEventRequestTest extends TestCase {
requestedEvents2 = new Vector<TmfEvent>();
request2 = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
@Override
- public void handleData() {
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
if (!isCompleted()) {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents2.add(e);
- }
+ requestedEvents2.add(event);
}
}
};
@@ -528,12 +464,10 @@ public class TmfCoalescedEventRequestTest extends TestCase {
requestedEvents3 = new Vector<TmfEvent>();
request3 = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
@Override
- public void handleData() {
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
if (!isCompleted()) {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents3.add(e);
- }
+ requestedEvents3.add(event);
}
}
};
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfDataRequestTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfDataRequestTest.java
index 33c332598d..eb662dc83b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfDataRequestTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfDataRequestTest.java
@@ -15,10 +15,6 @@ package org.eclipse.linuxtools.tmf.tests.request;
import junit.framework.TestCase;
import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.event.TmfEventReference;
-import org.eclipse.linuxtools.tmf.event.TmfEventSource;
-import org.eclipse.linuxtools.tmf.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.request.TmfDataRequestStub;
@@ -107,7 +103,6 @@ public class TmfDataRequestTest extends TestCase {
assertEquals("getIndex", 0, request.getIndex());
assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -124,7 +119,6 @@ public class TmfDataRequestTest extends TestCase {
assertEquals("getIndex", 10, request.getIndex());
assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -141,7 +135,6 @@ public class TmfDataRequestTest extends TestCase {
assertEquals("getIndex", 10, request.getIndex());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -158,7 +151,6 @@ public class TmfDataRequestTest extends TestCase {
assertEquals("getIndex", 10, request.getIndex());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", 200, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -215,10 +207,10 @@ public class TmfDataRequestTest extends TestCase {
// ------------------------------------------------------------------------
public void testToString() {
- String expected1 = "[TmfDataRequest(0,TmfEvent,10,100,200)]";
- String expected2 = "[TmfDataRequest(1,TmfEvent,20,100,200)]";
- String expected3 = "[TmfDataRequest(2,TmfEvent,20,200,200)]";
- String expected4 = "[TmfDataRequest(3,TmfEvent,20,200,300)]";
+ String expected1 = "[TmfDataRequest(0,TmfEvent,10,100)]";
+ String expected2 = "[TmfDataRequest(1,TmfEvent,20,100)]";
+ String expected3 = "[TmfDataRequest(2,TmfEvent,20,200)]";
+ String expected4 = "[TmfDataRequest(3,TmfEvent,20,200)]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@@ -227,30 +219,6 @@ public class TmfDataRequestTest extends TestCase {
}
// ------------------------------------------------------------------------
- // setData/getData
- // ------------------------------------------------------------------------
-
- public void testSetData() {
- // Initialize the data
- int nbEvents = 10;
- TmfEvent[] events = new TmfEvent[nbEvents];
- for (int i = 0; i < nbEvents; i++) {
- events[i] = new TmfEvent(new TmfTimestamp(i), new TmfEventSource(),
- new TmfEventType(), new TmfEventReference());
- }
-
- fRequest1.setData(events);
- assertEquals("setData", nbEvents, fRequest1.getNbRead());
-
- TmfEvent[] eventsRead = fRequest1.getData();
- assertEquals("getData", nbEvents, eventsRead.length);
-
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead[i].getTimestamp().getValue());
- }
- }
-
- // ------------------------------------------------------------------------
// done
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfEventRequestTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfEventRequestTest.java
index 189bd32ad5..0761a6fbf1 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfEventRequestTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/request/TmfEventRequestTest.java
@@ -15,9 +15,6 @@ package org.eclipse.linuxtools.tmf.tests.request;
import junit.framework.TestCase;
import org.eclipse.linuxtools.tmf.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.event.TmfEventReference;
-import org.eclipse.linuxtools.tmf.event.TmfEventSource;
-import org.eclipse.linuxtools.tmf.event.TmfEventType;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.request.TmfDataRequest;
@@ -115,7 +112,6 @@ public class TmfEventRequestTest extends TestCase {
assertEquals("getIndex", 0, request.getIndex());
assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -136,7 +132,6 @@ public class TmfEventRequestTest extends TestCase {
assertEquals("getIndex", 0, request.getIndex());
assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -157,7 +152,6 @@ public class TmfEventRequestTest extends TestCase {
assertEquals("getIndex", 0, request.getIndex());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", TmfDataRequest.DEFAULT_BLOCK_SIZE, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -178,7 +172,6 @@ public class TmfEventRequestTest extends TestCase {
assertEquals("getIndex", 0, request.getIndex());
assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
- assertEquals("getBlockize", 200, request.getBlockize());
assertFalse("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
@@ -235,10 +228,10 @@ public class TmfEventRequestTest extends TestCase {
// ------------------------------------------------------------------------
public void testToString() {
- String expected1 = "[TmfEventRequest(0,TmfEvent," + range1 + ",100,200)]";
- String expected2 = "[TmfEventRequest(1,TmfEvent," + range2 + ",100,200)]";
- String expected3 = "[TmfEventRequest(2,TmfEvent," + range2 + ",200,200)]";
- String expected4 = "[TmfEventRequest(3,TmfEvent," + range2 + ",200,300)]";
+ String expected1 = "[TmfEventRequest(0,TmfEvent," + range1 + ",100)]";
+ String expected2 = "[TmfEventRequest(1,TmfEvent," + range2 + ",100)]";
+ String expected3 = "[TmfEventRequest(2,TmfEvent," + range2 + ",200)]";
+ String expected4 = "[TmfEventRequest(3,TmfEvent," + range2 + ",200)]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@@ -247,30 +240,6 @@ public class TmfEventRequestTest extends TestCase {
}
// ------------------------------------------------------------------------
- // setData/getData
- // ------------------------------------------------------------------------
-
- public void testSetData() {
- // Initialize the data
- int nbEvents = 10;
- TmfEvent[] events = new TmfEvent[nbEvents];
- for (int i = 0; i < nbEvents; i++) {
- events[i] = new TmfEvent(new TmfTimestamp(i), new TmfEventSource(),
- new TmfEventType(), new TmfEventReference());
- }
-
- fRequest1.setData(events);
- assertEquals("setData", nbEvents, fRequest1.getNbRead());
-
- TmfEvent[] eventsRead = fRequest1.getData();
- assertEquals("getData", nbEvents, eventsRead.length);
-
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("getData", i, eventsRead[i].getTimestamp().getValue());
- }
- }
-
- // ------------------------------------------------------------------------
// done
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfExperimentTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfExperimentTest.java
index 8359a4d03a..b6ae97ae2d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfExperimentTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfExperimentTest.java
@@ -517,13 +517,11 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -546,13 +544,11 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -576,13 +572,11 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
@@ -609,15 +603,14 @@ public class TmfExperimentTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- // Cancel request after the first chunk is received
- cancel();
- }
+ int nbRead = 0;
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ if (++nbRead == blockSize)
+ cancel();
+ }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfTraceTest.java b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfTraceTest.java
index 8f3ce4903c..f3cb23e8ae 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfTraceTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/src/org/eclipse/linuxtools/tmf/tests/trace/TmfTraceTest.java
@@ -69,7 +69,8 @@ public class TmfTraceTest extends TestCase {
// Dummy request to force the trace indexing
TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class) {
@Override
- public void handleData() {
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
}
};
fTrace.sendRequest(request);
@@ -705,13 +706,11 @@ public class TmfTraceTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request);
@@ -735,13 +734,11 @@ public class TmfTraceTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ }
};
ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request);
@@ -768,15 +765,14 @@ public class TmfTraceTest extends TestCase {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BigBang, TmfTimestamp.BigCrunch);
final TmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- for (TmfEvent e : events) {
- requestedEvents.add(e);
- }
- // Cancel request after the first chunk is received
- cancel();
- }
+ int nbRead = 0;
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ requestedEvents.add(event);
+ if (++nbRead == BLOCK_SIZE)
+ cancel();
+ }
};
ITmfDataProvider<TmfEvent>[] providers = (ITmfDataProvider<TmfEvent>[]) TmfProviderManager.getProviders(TmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request);
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/component/TmfSyntheticEventProviderStub.java b/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/component/TmfSyntheticEventProviderStub.java
index 6de6d76363..c5d6eb1a8a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/component/TmfSyntheticEventProviderStub.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/component/TmfSyntheticEventProviderStub.java
@@ -55,17 +55,14 @@ public class TmfSyntheticEventProviderStub extends TmfEventProvider<TmfSynthetic
TmfTimeRange range = eventRequest.getRange();
final TmfEventRequest<TmfEvent> subRequest =
new TmfEventRequest<TmfEvent>(TmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- if (events.length > 0) {
- for (TmfEvent e : events) {
- handleIncomingData(e);
- }
- } else {
- request.done();
- }
- }
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ if (event != null)
+ handleIncomingData(event);
+ else
+ request.done();
+ }
};
provider.sendRequest(subRequest);
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfDataRequestStub.java b/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfDataRequestStub.java
index f5630a4596..bdf585f760 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfDataRequestStub.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfDataRequestStub.java
@@ -53,8 +53,8 @@ public class TmfDataRequestStub<T extends TmfData> extends TmfDataRequest<T> {
}
@Override
- public void handleData() {
- // TODO Auto-generated method stub
+ public void handleData(T data) {
+ super.handleData(data);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfEventRequestStub.java b/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfEventRequestStub.java
index 4c7f74dae7..73991de92e 100644
--- a/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfEventRequestStub.java
+++ b/lttng/org.eclipse.linuxtools.tmf.tests/stubs/org/eclipse/linuxtools/tmf/request/TmfEventRequestStub.java
@@ -54,7 +54,7 @@ public class TmfEventRequestStub<T extends TmfEvent> extends TmfEventRequest<T>
}
@Override
- public void handleData() {
- // TODO Auto-generated method stub
+ public void handleData(T data) {
+ super.handleData(data);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/ChangeLog b/lttng/org.eclipse.linuxtools.tmf.ui/ChangeLog
index 937b57efe7..768e87d37c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/ChangeLog
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java: Small cleanup
+
+2010-10-13 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java: Fixed comments
+
+2010-09-17 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java: Adjusted to new handleData() API
+
+2010-09-12 francois <francois@sushi>
+
+ * src/org/eclipse/linuxtools/tmf/ui/widgets/TmfVirtualTable.java (handleTableKeyEvent): Fixed table scrolling issues
+
2010-07-28 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/tmf/ui/widgets/TMFTable.java: Removed.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
index e0d96324b5..4835fb6d68 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
@@ -46,8 +46,6 @@ import org.eclipse.swt.widgets.TableItem;
*/
public class TmfEventsTable extends TmfComponent {
-// private Shell fShell;
-
// ------------------------------------------------------------------------
// Table data
// ------------------------------------------------------------------------
@@ -144,17 +142,23 @@ public class TmfEventsTable extends TmfComponent {
return;
}
+ fCacheStartIndex = index;
+ fCacheEndIndex = index;
+
TmfDataRequest<TmfEvent> request = new TmfDataRequest<TmfEvent>(TmfEvent.class, index, fCacheSize) {
- @Override
- public void handleData() {
- TmfEvent[] tmpEvent = getData();
- if ((tmpEvent != null) && (tmpEvent.length > 0)) {
- fCache = tmpEvent;
- fCacheStartIndex = index;
- fCacheEndIndex = index + tmpEvent.length;
+ private int count = 0;
+
+ @Override
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ if (event != null) {
+ fCache[count++] = event.clone();
+ fCacheEndIndex++;
}
}
+
};
+
((ITmfDataProvider<TmfEvent>) fTrace).sendRequest(request);
try {
request.waitForCompletion();
@@ -265,7 +269,7 @@ public class TmfEventsTable extends TmfComponent {
@TmfSignalHandler
public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
- if (signal.getExperiment() != fTrace) return;
+ if ((signal.getExperiment() != fTrace) || fTable.isDisposed()) return;
// Perform the refresh on the UI thread
fTable.getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -279,7 +283,7 @@ public class TmfEventsTable extends TmfComponent {
@TmfSignalHandler
public void traceUpdated(TmfTraceUpdatedSignal signal) {
- if (signal.getTrace() != fTrace) return;
+ if ((signal.getTrace() != fTrace ) || fTable.isDisposed()) return;
// Perform the refresh on the UI thread
fTable.getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -295,7 +299,7 @@ public class TmfEventsTable extends TmfComponent {
private boolean fRefreshPending = false;
@TmfSignalHandler
public synchronized void rangeSynched(TmfRangeSynchSignal signal) {
- if (!fRefreshPending) {
+ if (!fRefreshPending && !fTable.isDisposed()) {
// Perform the refresh on the UI thread
fRefreshPending = true;
fTable.getDisplay().asyncExec(new Runnable() {
@@ -311,7 +315,7 @@ public class TmfEventsTable extends TmfComponent {
@TmfSignalHandler
public void currentTimeUpdated(final TmfTimeSynchSignal signal) {
- if (signal.getSource() != fTable && fTrace != null) {
+ if (signal.getSource() != fTable && fTrace != null && !fTable.isDisposed()) {
Job job = new Job("seeking...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -319,6 +323,9 @@ public class TmfEventsTable extends TmfComponent {
// Perform the updates on the UI thread
fTable.getDisplay().asyncExec(new Runnable() {
public void run() {
+ // Return if table is disposed
+ if (fTable.isDisposed()) return;
+
fTable.setSelection(index);
// The timestamp might not correspond to an actual event
// and the selection will point to the next experiment event.
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/TmfVirtualTable.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/TmfVirtualTable.java
index 24a5401d36..00cb203dfb 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/TmfVirtualTable.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/TmfVirtualTable.java
@@ -13,6 +13,9 @@
package org.eclipse.linuxtools.tmf.ui.widgets;
+import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.signal.TmfTimeSynchSignal;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
@@ -22,7 +25,6 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseWheelListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -48,18 +50,20 @@ import org.eclipse.swt.widgets.TableItem;
public class TmfVirtualTable extends Composite {
// The table
- private Table fTable;
- private int fFirstRowOffset = 0;
- private int fTableRow = 0;
- private int fEffectiveRow = 0;
+ private Table fTable;
+ private int fTableRows = 0; // Number of table rows
+ private boolean fPartialRowVisible = false; // Indicates that a row is partially displayed
+ private int fSelectedRow = 0; // Currently selected row in the table
- private TableItem fSelectedItems[] = null;
+ private int fTableTopEventRank = 0; // Global rank of the first entry displayed
+ private int fSelectedEventRank = 0; // Global rank of the selected event
+
+ private TableItem fSelectedItems[] = new TableItem[1];
private int fTableItemCount = 0;
- private int fRowsDisplayed;
private TableItem fTableItems[];
// The slider
- private Slider fSlider;
+ private Slider fSlider;
// ------------------------------------------------------------------------
// Constructor
@@ -73,15 +77,16 @@ public class TmfVirtualTable extends Composite {
super(parent, style | SWT.BORDER & (~SWT.H_SCROLL) & (~SWT.V_SCROLL));
// Create the controls
- createTable();
+ createTable(style);
createSlider();
// Set the layout
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridLayout.horizontalSpacing = 0;
- gridLayout.verticalSpacing = 0;
- gridLayout.marginWidth = 0;
+ gridLayout.verticalSpacing = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
setLayout(gridLayout);
GridData tableGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -91,17 +96,19 @@ public class TmfVirtualTable extends Composite {
fSlider.setLayoutData(sliderGridData);
// Add the listeners
- addMouseWheelListener(new MouseWheelListener() {
+ fTable.addMouseWheelListener(new MouseWheelListener() {
public void mouseScrolled(MouseEvent event) {
- fFirstRowOffset -= event.count;
- int lastFirstRowOffset = fTableItemCount - fRowsDisplayed - 1;
- if (fFirstRowOffset > lastFirstRowOffset) {
- fFirstRowOffset = lastFirstRowOffset;
- } else if (fFirstRowOffset < 0) {
- fFirstRowOffset = 0;
+ fTableTopEventRank -= event.count;
+ if (fTableTopEventRank < 0) {
+ fTableTopEventRank = 0;
+ }
+ int latestFirstRowOffset = fTableItemCount - fTableRows;
+ if (fTableTopEventRank > latestFirstRowOffset) {
+ fTableTopEventRank = latestFirstRowOffset;
}
- fSlider.setSelection(fFirstRowOffset);
- setSelection();
+
+ fSlider.setSelection(fTableTopEventRank);
+ refreshTable();
}
});
@@ -123,8 +130,9 @@ public class TmfVirtualTable extends Composite {
/**
* Create the table and add listeners
*/
- private void createTable() {
+ private void createTable(int style) {
+// int tableStyle = SWT.NO_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION;
int tableStyle = SWT.NO_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION;
fTable = new Table(this, tableStyle);
@@ -135,7 +143,7 @@ public class TmfVirtualTable extends Composite {
}
});
- fTable.addKeyListener(new KeyListener() {
+ fTable.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent event) {
handleTableKeyEvent(event);
}
@@ -148,128 +156,138 @@ public class TmfVirtualTable extends Composite {
* Update the rows and selected item
*/
private void handleTableSelection() {
- fTableRow = fTable.getSelectionIndices()[0];
- fEffectiveRow = fFirstRowOffset + fTableRow;
- fSelectedItems = new TableItem[1];
- fSelectedItems[0] = fTable.getSelection()[0];
+ fSelectedRow = fTable.getSelectionIndices()[0];
+ fSelectedEventRank = fTableTopEventRank + fSelectedRow;
+ fSelectedItems[0] = fTable.getSelection()[0];
}
/**
* Handle key-based navigation in table.
*
- * The key variables are:
- * - fFirstRowOffset: the absolute index (in the data set) of the first row displayed
- * - fTableRow: the index of the selected event in the table window
- * - fEffectiveRow: the absolute index of the selected event (in the data set)
- *
- * At all times, the following relation should hold true:
- * fEffectiveRow = fFirstRowOffset + fTableRow
- *
* @param event
*/
private void handleTableKeyEvent(KeyEvent event) {
- boolean needsUpdate = false;
- final int lastTableRow = fTableItemCount - 1;
- int lastRowDisplayed = ((fTableItemCount < fRowsDisplayed) ? fTableItemCount : fRowsDisplayed) - 1;
+ int lastEventRank = fTableItemCount - 1;
+ int lastPageTopEntryRank = fTableItemCount - fTableRows;
+
+ int lastRowIndex = ((fTableItemCount < fTableRows) ? fTableItemCount : fTableRows) - 1;
+ int numberOfFullyVisibleRows = fTableRows - ((fPartialRowVisible) ? 1 : 0);
+
+ boolean needsRefresh = false;
- // We are handling things
+ // We are handling things...
event.doit = false;
+ // In all case, perform the following steps:
+ // - Update the selected entry rank (within valid range)
+ // - Update the selected row
+ // - Update the page's top entry if necessary (which also adjusts the selected row)
+ // - If the top displayed entry was changed, table refresh is needed
switch (event.keyCode) {
case SWT.ARROW_DOWN: {
- if (fEffectiveRow < lastTableRow) {
- fEffectiveRow++;
- if (fTableRow < lastRowDisplayed) {
- fTableRow++;
- } else if (fTableRow < fEffectiveRow) {
- fFirstRowOffset++;
- needsUpdate = true;
+ if (fSelectedEventRank < lastEventRank) {
+ fSelectedEventRank++;
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ if (fSelectedRow > lastRowIndex) {
+ fTableTopEventRank++;
+ fSelectedRow = lastRowIndex;
+ needsRefresh = true;
}
}
break;
}
- case SWT.PAGE_DOWN: {
- if (fEffectiveRow < lastTableRow) {
- if ((lastTableRow - fEffectiveRow) >= fRowsDisplayed) {
- fEffectiveRow += fRowsDisplayed;
- fFirstRowOffset += fRowsDisplayed;
- } else {
- fEffectiveRow = lastTableRow;
- fTableRow = lastRowDisplayed;
+ case SWT.ARROW_UP: {
+ if (fSelectedEventRank > 0) {
+ fSelectedEventRank--;
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ if (fSelectedRow < 0) {
+ fTableTopEventRank--;
+ fSelectedRow = 0;
+ needsRefresh = true;
}
- needsUpdate = true;
}
break;
}
case SWT.END: {
- fEffectiveRow = lastTableRow;
- fTableRow = lastRowDisplayed;
- if (lastTableRow > lastRowDisplayed) {
- fFirstRowOffset = fTableItemCount - fRowsDisplayed;
- }
- needsUpdate = true;
+ fTableTopEventRank = lastPageTopEntryRank;
+ fSelectedEventRank = lastEventRank;
+ fSelectedRow = lastRowIndex;
+ needsRefresh = true;
break;
}
- case SWT.ARROW_UP: {
- if (fEffectiveRow > 0) {
- fEffectiveRow--;
- if (fTableRow > 0) {
- fTableRow--;
- } else {
- fFirstRowOffset--;
- needsUpdate = true;
- }
- }
+ case SWT.HOME: {
+ fSelectedEventRank = 0;
+ fSelectedRow = 0;
+ fTableTopEventRank = 0;
+ needsRefresh = true;
break;
}
- case SWT.PAGE_UP: {
- if (fEffectiveRow > 0) {
- if (fEffectiveRow > fRowsDisplayed - 1) {
- fEffectiveRow -= fRowsDisplayed;
- fFirstRowOffset -= fRowsDisplayed;
- } else {
- fEffectiveRow = 0;
- fTableRow = 0;
+ case SWT.PAGE_DOWN: {
+ if (fSelectedEventRank < lastEventRank) {
+ fSelectedEventRank += numberOfFullyVisibleRows;
+ if (fSelectedEventRank > lastEventRank) {
+ fSelectedEventRank = lastEventRank;
+ }
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ if (fSelectedRow > numberOfFullyVisibleRows - 1) {
+ fTableTopEventRank += numberOfFullyVisibleRows;
+ if (fTableTopEventRank > lastPageTopEntryRank) {
+ fTableTopEventRank = lastPageTopEntryRank;
+ }
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ needsRefresh = true;
}
- needsUpdate = true;
}
break;
}
- case SWT.HOME: {
- fEffectiveRow = 0;
- fTableRow = 0;
- fFirstRowOffset = 0;
- needsUpdate = true;
+ case SWT.PAGE_UP: {
+ if (fSelectedEventRank > 0) {
+ fSelectedEventRank -= numberOfFullyVisibleRows;
+ if (fSelectedEventRank < 0) {
+ fSelectedEventRank = 0;
+ }
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ if (fSelectedRow < 0) {
+ fSelectedRow = 0;
+ fTableTopEventRank -= numberOfFullyVisibleRows;
+ if (fTableTopEventRank < 0) {
+ fTableTopEventRank = 0;
+ }
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ needsRefresh = true;
+ }
+ }
break;
}
}
- if (needsUpdate) {
+ if (needsRefresh) {
for (int i = 0; i < fTableItems.length; i++) {
- setDataItem(fTableItems[i]);
+ setDataItem(i, fTableItems[i]);
}
}
- fTable.setSelection(fTableRow);
- fSlider.setSelection(fEffectiveRow);
+ fSlider.setSelection(fSelectedEventRank);
+ fTable.setSelection(fSelectedRow);
+ fTable.showSelection();
+ fSelectedItems[0] = fTable.getSelection()[0];
-// System.out.println("1st: " + fFirstRowOffset + ", TR: " + fTableRow + ", ER: " + fEffectiveRow +
-// ", Valid: " + ((fFirstRowOffset >= 0) && (fEffectiveRow == (fFirstRowOffset + fTableRow))));
+ TmfTimestamp ts = (TmfTimestamp) fSelectedItems[0].getData();
+ TmfSignalManager.dispatchSignal(new TmfTimeSynchSignal(this, ts));
}
- private void setDataItem(TableItem item) {
- int index = fTable.indexOf(item);
+ private void setDataItem(int index, TableItem item) {
if( index != -1) {
Event event = new Event();
event.item = item;
- event.index = index + fFirstRowOffset;
+ event.index = index + fTableTopEventRank;
event.doit = true;
notifyListeners(SWT.SetData, event);
}
@@ -284,13 +302,6 @@ public class TmfVirtualTable extends Composite {
fSlider.setMinimum(0);
fSlider.setMaximum(0);
- fSlider.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- setSelection();
- }
- });
-
fSlider.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
switch (event.detail) {
@@ -301,8 +312,8 @@ public class TmfVirtualTable extends Composite {
case SWT.HOME:
case SWT.PAGE_DOWN:
case SWT.PAGE_UP: {
- fFirstRowOffset = fSlider.getSelection();
- setSelection();
+ fTableTopEventRank = fSlider.getSelection();
+ refreshTable();
break;
}
}
@@ -344,7 +355,7 @@ public class TmfVirtualTable extends Composite {
}
public int getTopIndex() {
- return fFirstRowOffset;
+ return fTableTopEventRank;
}
public void setTopIndex(int i) {
@@ -362,16 +373,32 @@ public class TmfVirtualTable extends Composite {
private void resize() {
// Compute the numbers of rows that fit the new area
- Rectangle clientArea = getClientArea();
- int tableHeight = clientArea.height - fTable.getHeaderHeight();
- int itemHeight = fTable.getItemHeight();
- fRowsDisplayed = tableHeight / itemHeight + 1; // For partial rows
- if (fTableItemCount == 0) {
- fRowsDisplayed = 0;
+ int tableHeight = fTable.getClientArea().height - fTable.getHeaderHeight();
+
+ if (tableHeight < 0) tableHeight = 0;
+ int itemHeight = fTable.getItemHeight();
+ fTableRows = tableHeight / itemHeight;
+ fPartialRowVisible = false;
+ if (fTableRows * itemHeight < tableHeight) {
+ fTableRows++; // For partial rows
+ fPartialRowVisible = true;
}
-
+ if (fTableRows > fTableItemCount) {
+ fTableRows = fTableItemCount;
+ }
+
+ // If we are at the end, get elements before to populate
+ if (fTableTopEventRank + fTableRows >= fTableItemCount) {
+ fTableTopEventRank = fTableItemCount - fTableRows;
+ }
+
+ // Set the slider thumb size
+ if (fTableItemCount > 0) {
+ fSlider.setThumb(fTableRows);
+ }
+
// Re-size and re-create the virtual table if needed
- int delta = fTable.getItemCount() - fRowsDisplayed;
+ int delta = fTable.getItemCount() - fTableRows;
if (delta != 0) {
fTable.removeAll();
if (fTableItems != null) {
@@ -382,7 +409,7 @@ public class TmfVirtualTable extends Composite {
fTableItems[i] = null;
}
}
- fTableItems = new TableItem[fRowsDisplayed];
+ fTableItems = new TableItem[fTableRows];
for (int i = 0; i < fTableItems.length; i++) {
fTableItems[i] = new TableItem(fTable, i);
}
@@ -405,7 +432,7 @@ public class TmfVirtualTable extends Composite {
}
public void refresh() {
- setSelection();
+ refreshTable();
}
public void setColumnHeaders(ColumnData columnData[]) {
@@ -426,16 +453,17 @@ public class TmfVirtualTable extends Composite {
return 0;
}
- private void setSelection() {
- if ((fEffectiveRow >= fFirstRowOffset) && (fEffectiveRow < (fFirstRowOffset + fRowsDisplayed))) {
- fTableRow = fEffectiveRow - fFirstRowOffset;
- fTable.setSelection(fTableRow);
+ private void refreshTable() {
+ int lastRowOffset = fTableTopEventRank + fTableRows - 1;
+ if ((fSelectedEventRank >= fTableTopEventRank) && (fSelectedEventRank <= lastRowOffset)) {
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+ fTable.setSelection(fSelectedRow);
} else {
- fTable.deselect(fTableRow);
+ fTable.deselect(fSelectedRow);
}
- for (int i = 0; i < fRowsDisplayed; i++) {
- setDataItem(fTableItems[i]);
+ for (int i = 0; i < fTableRows; i++) {
+ setDataItem(i, fTableItems[i]);
}
}
@@ -444,7 +472,15 @@ public class TmfVirtualTable extends Composite {
i = Math.min(i, fTableItemCount);
i = Math.max(i, 0);
fSlider.setSelection(i);
- setSelection();
+
+ fSelectedEventRank = i;
+ fTableTopEventRank = i - (fTableRows / 2);
+ if (fTableTopEventRank < 0) {
+ fTableTopEventRank = 0;
+ }
+ fSelectedRow = fSelectedEventRank - fTableTopEventRank;
+
+ refreshTable();
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/ChangeLog b/lttng/org.eclipse.linuxtools.tmf/ChangeLog
index b3ccd84e6c..f0931c46fd 100644
--- a/lttng/org.eclipse.linuxtools.tmf/ChangeLog
+++ b/lttng/org.eclipse.linuxtools.tmf/ChangeLog
@@ -1,8 +1,62 @@
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/event/TmfEvent.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventField.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventType.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java (updateIndex): Fixed timestamp cloning
+ * src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java: Replaced lock.wait() by CountDownLatch
+ * src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java (updateIndex): Fixed timestamp cloning
+
+2010-10-13 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java: Added checks for disposed widget
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java: Fixed comments
+ * src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java: Added waitForStart() API
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java: Added setEvent()
+ * src/org/eclipse/linuxtools/tmf/event/TmfTimeRange.java: Added getIntersection()
+ * src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java: Improved timestamp comparison
+
+2010-09-17 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/event/TmfEvent.java: Support for single event
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java: Adjusted to new handleData() API
+ * src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java: Adjusted to new handleData() API
+
+2010-09-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java: Optimized TmfExperimentContext handling
+ * src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/trace/TmfContext.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java: ExecutionType update
+ * src/org/eclipse/linuxtools/tmf/Tracer.java: ExecutionType update
+
2010-07-28 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/tmf/trace/ITmfTrace.java: Added getRank() to API
* src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java: Provide a default implementation of getRank() + minor changes
+2010-09-09 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java: Fix in handleData()
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java: Made class extendable
+
2010-07-20 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java:
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/Tracer.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/Tracer.java
index 02e1623bbb..42613d2de0 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/Tracer.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/Tracer.java
@@ -147,7 +147,7 @@ public class Tracer {
public static void traceRequest(ITmfDataRequest<?> request, String msg) {
String message = ("[REQ] Thread=" + Thread.currentThread().getId() + " Req=" + request.getRequestId() +
- (request.getExecType() == ITmfDataRequest.ExecutionType.LONG ? "(long)" : "(short)") +
+ (request.getExecType() == ITmfDataRequest.ExecutionType.BACKGROUND ? "(BG)" : "(FG)") +
", Type=" + request.getClass().getName() +
", DataType=" + request.getDataType().getSimpleName() + " " + msg);
trace(message);
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java
index 48423b6439..1e93feba1f 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java
@@ -12,7 +12,6 @@
package org.eclipse.linuxtools.tmf.component;
-import java.lang.reflect.Array;
import java.util.Vector;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@@ -60,7 +59,9 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
final protected boolean fLogData;
final protected boolean fLogError;
+ public static final int DEFAULT_BLOCK_SIZE = 5000;
public static final int DEFAULT_QUEUE_SIZE = 1000;
+
protected final int fQueueSize;
protected final BlockingQueue<T> fDataQueue;
protected final TmfRequestExecutor fExecutor;
@@ -157,8 +158,8 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
protected void newCoalescedDataRequest(ITmfDataRequest<T> request) {
synchronized(fLock) {
- TmfCoalescedDataRequest<T> coalescedRequest =
- new TmfCoalescedDataRequest<T>(fType, request.getIndex(), request.getNbRequested(), request.getBlockize(), request.getExecType());
+ TmfCoalescedDataRequest<T> coalescedRequest = new TmfCoalescedDataRequest<T>(
+ fType, request.getIndex(), request.getNbRequested(),request.getExecType());
coalescedRequest.addRequest(request);
if (Tracer.isRequestTraced()) {
Tracer.traceRequest(request, "coalesced with " + coalescedRequest.getRequestId());
@@ -189,10 +190,10 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
// ------------------------------------------------------------------------
private void dispatchRequest(final ITmfDataRequest<T> request) {
- if (request.getExecType() == ExecutionType.SHORT)
+ if (request.getExecType() == ExecutionType.FOREGROUND)
queueRequest(request);
else
- queueLongRequest(request);
+ queueBackgroundRequest(request, DEFAULT_BLOCK_SIZE, true);
}
protected void queueRequest(final ITmfDataRequest<T> request) {
@@ -214,11 +215,7 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
// Extract the generic information
request.start();
- int blockSize = request.getBlockize();
int nbRequested = request.getNbRequested();
-
- // Create the result buffer
- Vector<T> result = new Vector<T>();
int nbRead = 0;
// Initialize the execution
@@ -236,21 +233,16 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
while (data != null && !isCompleted(request, data, nbRead))
{
if (fLogData) Tracer.traceEvent(provider, request, data);
- result.add(data);
- if (++nbRead % blockSize == 0) {
- pushData(request, result);
- }
+ request.handleData(data);
+
// To avoid an unnecessary read passed the last data requested
- if (nbRead < nbRequested) {
+ if (++nbRead < nbRequested) {
data = getNext(context);
if (Tracer.isRequestTraced() && (data == null || data.isNullRef())) {
Tracer.trace("Request #" + request.getRequestId() + " end of data");
}
}
}
- if (result.size() > 0) {
- pushData(request, result);
- }
request.done();
if (Tracer.isRequestTraced()) Tracer.traceRequest(request, "completed");
@@ -258,7 +250,6 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
catch (Exception e) {
if (Tracer.isRequestTraced()) Tracer.traceRequest(request, "exception (failed)");
request.fail();
-// e.printStackTrace();
}
}
};
@@ -268,32 +259,12 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
if (Tracer.isRequestTraced()) Tracer.traceRequest(request, "queued");
}
- // By default, same behavior as a short request
- protected void queueLongRequest(final ITmfDataRequest<T> request) {
+ // By default, same behavior as a foreground request
+ protected void queueBackgroundRequest(final ITmfDataRequest<T> request, final int blockSize, boolean indexing) {
queueRequest(request);
}
/**
- * Format the result data and forwards it to the requester.
- * Note: after handling, the data is *removed*.
- *
- * @param request
- * @param data
- */
- @SuppressWarnings("unchecked")
- protected void pushData(ITmfDataRequest<T> request, Vector<T> data) {
- synchronized(request) {
- if (!request.isCompleted()) {
- T[] result = (T[]) Array.newInstance(fType, data.size());
- data.toArray(result);
- request.setData(result);
- request.handleData();
- data.removeAllElements();
- }
- }
- }
-
- /**
* Initialize the provider based on the request. The context is
* provider specific and will be updated by getNext().
*
@@ -303,50 +274,6 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
public abstract ITmfContext armRequest(ITmfDataRequest<T> request);
public abstract T getNext(ITmfContext context);
-// public abstract void queueResult(T data);
-
- /**
- * Return the next piece of data based on the context supplied. The context
- * would typically be updated for the subsequent read.
- *
- * @param context
- * @return
- */
-// private static final int TIMEOUT = 10000;
-//// public abstract T getNext(ITmfContext context) throws InterruptedException;
-//// private int getLevel = 0;
-// public T getNext(ITmfContext context) throws InterruptedException {
-//// String name = Thread.currentThread().getName(); getLevel++;
-//// System.out.println("[" + System.currentTimeMillis() + "] " + name + " " + (getLevel) + " getNext() - entering");
-// T data = fDataQueue.poll(TIMEOUT, TimeUnit.MILLISECONDS);
-// if (data == null) {
-//// if (Tracer.isErrorTraced()) Tracer.traceError(getName() + ": Request timeout on read");
-// throw new InterruptedException();
-// }
-//// System.out.println("[" + System.currentTimeMillis() + "] " + name + " " + (getLevel) + " getNext() - leaving");
-//// getLevel--;
-// return data;
-// }
-//
-// /**
-// * Makes the generated result data available for getNext()
-// *
-// * @param data
-// */
-//// public abstract void queueResult(T data) throws InterruptedException;
-//// private int putLevel = 0;
-// public void queueResult(T data) throws InterruptedException {
-//// String name = Thread.currentThread().getName(); putLevel++;
-//// System.out.println("[" + System.currentTimeMillis() + "] " + name + " " + (putLevel) + " queueResult() - entering");
-// boolean ok = fDataQueue.offer(data, TIMEOUT, TimeUnit.MILLISECONDS);
-// if (!ok) {
-//// if (Tracer.isErrorTraced()) Tracer.traceError(getName() + ": Request timeout on write");
-// throw new InterruptedException();
-// }
-//// System.out.println("[" + System.currentTimeMillis() + "] " + name + " " + (putLevel) + " queueResult() - leaving");
-//// putLevel--;
-// }
-
/**
* Checks if the data meets the request completion criteria.
*
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java
index 6a14a5889e..420e7a803e 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java
@@ -40,12 +40,12 @@ public abstract class TmfEventProvider<T extends TmfEvent> extends TmfDataProvid
@Override
public boolean isCompleted(ITmfDataRequest<T> request, T data, int nbRead) {
- boolean dataRequestCompleted = super.isCompleted(request, data, nbRead);
- if (!dataRequestCompleted && request instanceof ITmfEventRequest<?> && !data.isNullRef()) {
+ boolean requestCompleted = super.isCompleted(request, data, nbRead);
+ if (!requestCompleted && request instanceof ITmfEventRequest<?> && !data.isNullRef()) {
TmfTimestamp endTime = ((ITmfEventRequest<?>) request).getRange().getEndTime();
return data.getTimestamp().compareTo(endTime, false) > 0;
}
- return dataRequestCompleted;
+ return requestCompleted;
}
@Override
@@ -53,7 +53,7 @@ public abstract class TmfEventProvider<T extends TmfEvent> extends TmfDataProvid
if (request instanceof ITmfEventRequest<?>) {
ITmfEventRequest<T> eventRequest = (ITmfEventRequest<T>) request;
TmfCoalescedEventRequest<T> coalescedRequest =
- new TmfCoalescedEventRequest<T>(fType, eventRequest.getRange(), eventRequest.getNbRequested(), eventRequest.getBlockize(), eventRequest.getExecType());
+ new TmfCoalescedEventRequest<T>(fType, eventRequest.getRange(), eventRequest.getNbRequested(), eventRequest.getExecType());
coalescedRequest.addRequest(eventRequest);
if (Tracer.isRequestTraced()) {
Tracer.traceRequest(request, "coalesced with " + coalescedRequest.getRequestId());
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEvent.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEvent.java
index ac2fafa548..d5b8be044a 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEvent.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEvent.java
@@ -29,7 +29,7 @@ package org.eclipse.linuxtools.tmf.event;
* Notice that for performance reasons TmfEvent is NOT immutable. If a copy
* of the event is needed, use the copy constructor.
*/
-public class TmfEvent extends TmfData {
+public class TmfEvent extends TmfData implements Cloneable {
// ------------------------------------------------------------------------
// Constants
@@ -190,4 +190,23 @@ public class TmfEvent extends TmfData {
return "[TmfEvent(" + fEffectiveTimestamp + "," + fSource + "," + fType + "," + fContent + ")]";
}
+ @Override
+ public TmfEvent clone() {
+ TmfEvent clone = null;
+ try {
+ clone = (TmfEvent) super.clone();
+ clone.fOriginalTimestamp = fOriginalTimestamp.clone();
+ clone.fEffectiveTimestamp = fEffectiveTimestamp.clone();
+ clone.fSource = fSource.clone();
+ clone.fType = fType.clone();
+ clone.fReference = fReference.clone();
+ clone.fContent = fContent.clone();
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+
+ return clone;
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java
index 662ad85fb8..19174a1a93 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java
@@ -12,13 +12,12 @@
package org.eclipse.linuxtools.tmf.event;
-
/**
* <b><u>TmfEventContent</u></b>
* <p>
* The event content.
*/
-public class TmfEventContent {
+public class TmfEventContent implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
@@ -125,6 +124,13 @@ public class TmfEventContent {
// ------------------------------------------------------------------------
/**
+ * @param event
+ */
+ public void setEvent(TmfEvent event) {
+ fParentEvent = event;
+ }
+
+ /**
* Parse the content into fields. By default, a single field (the raw
* content) is returned.
* Should be overridden.
@@ -166,4 +172,18 @@ public class TmfEventContent {
return result.toString();
}
+ @Override
+ public TmfEventContent clone() {
+ TmfEventContent clone = null;
+ try {
+ clone = (TmfEventContent) super.clone();
+ clone.fParentEvent = fParentEvent;
+ clone.fRawContent = null;
+ clone.fFields = null;
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventField.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventField.java
index e39180fe34..972491c738 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventField.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventField.java
@@ -19,15 +19,15 @@ package org.eclipse.linuxtools.tmf.event;
*
* TODO: Add support for field hierarchy.
*/
-public class TmfEventField {
+public class TmfEventField implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private final TmfEventContent fParent;
- private final String fFieldId;
- private Object fValue;
+ protected TmfEventContent fParent;
+ protected String fFieldId;
+ protected Object fValue;
// ------------------------------------------------------------------------
// Constructors
@@ -119,5 +119,19 @@ public class TmfEventField {
public String toString() {
return "[TmfEventField(" + fFieldId + ":" + fValue.toString() + ")]";
}
+ @Override
+ public TmfEventField clone() {
+ TmfEventField clone = null;
+ try {
+ clone = (TmfEventField) super.clone();
+ clone.fParent = fParent;
+ clone.fFieldId = new String(fFieldId);
+ clone.fValue = null;
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
+
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java
index 39b319e4dc..2b1fc97696 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java
@@ -17,7 +17,7 @@ package org.eclipse.linuxtools.tmf.event;
* <p>
* An application-defined event reference.
*/
-public class TmfEventReference {
+public class TmfEventReference implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
@@ -87,4 +87,16 @@ public class TmfEventReference {
return fReference.equals(o.fReference);
}
+ @Override
+ public TmfEventReference clone() {
+ TmfEventReference clone = null;
+ try {
+ clone = (TmfEventReference) super.clone();
+ clone.fReference = null;
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java
index 3a351fbc4f..c97805ae28 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java
@@ -17,7 +17,7 @@ package org.eclipse.linuxtools.tmf.event;
* <p>
* The event source.
*/
-public class TmfEventSource {
+public class TmfEventSource implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
@@ -87,4 +87,16 @@ public class TmfEventSource {
return "[TmfEventSource(" + ((fSourceId != null) ? fSourceId.toString() : "null") + ")]";
}
+ @Override
+ public TmfEventSource clone() {
+ TmfEventSource clone = null;
+ try {
+ clone = (TmfEventSource) super.clone();
+ clone.fSourceId = null;
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventType.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventType.java
index fa998eca2d..357dc9e2d9 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventType.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventType.java
@@ -13,14 +13,13 @@
package org.eclipse.linuxtools.tmf.event;
import java.util.HashMap;
-import java.util.Map;
/**
* <b><u>TmfEventType</u></b>
* <p>
* The event type.
*/
-public class TmfEventType {
+public class TmfEventType implements Cloneable {
// ------------------------------------------------------------------------
// Constants
@@ -33,10 +32,10 @@ public class TmfEventType {
// Attributes
// ------------------------------------------------------------------------
- private final String fTypeId;
- private final String[] fFieldLabels;
- private final int fNbFields;
- private final Map<String, Integer> fFieldMap;
+ private String fTypeId;
+ private String[] fFieldLabels;
+ private int fNbFields;
+ private HashMap<String, Integer> fFieldMap;
// ------------------------------------------------------------------------
// Constructors
@@ -144,4 +143,27 @@ public class TmfEventType {
return "[TmfEventType:" + fTypeId + "]";
}
+ @Override
+ public TmfEventType clone() {
+ TmfEventType clone = null;
+ try {
+ clone = (TmfEventType) super.clone();
+ clone.fTypeId = new String(fTypeId);
+ clone.fNbFields = fNbFields;
+ // Clone the field labels
+ clone.fFieldLabels = new String[fFieldLabels.length];
+ for (int i = 0; i < fFieldLabels.length; i++) {
+ clone.fFieldLabels[i] = new String(fFieldLabels[i]);
+ }
+ // Clone the fields
+ clone.fFieldMap = new HashMap<String, Integer>();
+ for (String key : fFieldMap.keySet()) {
+ clone.fFieldMap.put(new String(key), new Integer(fFieldMap.get(key)));
+ }
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimeRange.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimeRange.java
index a5a51f4bab..9f76b22e3a 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimeRange.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimeRange.java
@@ -100,6 +100,23 @@ public class TmfTimeRange {
}
/**
+ * Get intersection of two time ranges
+ *
+ * @param other
+ * the other time range
+ * @return the intersection time range, or null if no intersection exists
+ */
+ public TmfTimeRange getIntersection(TmfTimeRange other)
+ {
+ if (fStartTime.compareTo(other.fEndTime, true) > 0 || fEndTime.compareTo(other.fStartTime, true) < 0)
+ return null; // no intersection
+
+ return new TmfTimeRange(
+ fStartTime.compareTo(other.fStartTime, true) < 0 ? other.fStartTime : fStartTime,
+ fEndTime.compareTo(other.fEndTime, true) > 0 ? other.fEndTime : fEndTime);
+ }
+
+ /**
* Check if the time range is within the time range
*
* @param range
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java
index d3a0b76dce..786e643465 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java
@@ -8,11 +8,11 @@
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Thomas Gatterweh - Updated scaling / synchronization
*******************************************************************************/
package org.eclipse.linuxtools.tmf.event;
-
/**
* <b><u>TmfTimestamp</u></b>
* <p>
@@ -60,15 +60,6 @@ public class TmfTimestamp implements Cloneable {
public static final TmfTimestamp BigCrunch = new TmfTimestamp(Long.MAX_VALUE, Byte.MAX_VALUE, 0);
public static final TmfTimestamp Zero = new TmfTimestamp(0, (byte) 0, 0);
- /*
- * A java <code>long</code> has a maximum of 19 significant digits.
- * (-9,223,372,036,854,775,808 .. +9,223,372,036,854,775,807)
- *
- * It is therefore useless to try to synchronize 2 timestamps whose
- * difference in scale exceeds that value.
- */
- private int MAX_SCALING = 19;
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -167,21 +158,22 @@ public class TmfTimestamp implements Cloneable {
*/
public TmfTimestamp synchronize(long offset, byte newScale) throws ArithmeticException {
- long newValue = fValue;
+ long newValue = fValue;
long newPrecision = fPrecision;
+ // Handle the easy case
+ if (fScale == newScale && offset == 0)
+ return this;
+
// Determine the scaling factor
if (fScale != newScale) {
int scaleDiff = Math.abs(fScale - newScale);
// Let's try to be realistic...
- if (scaleDiff > MAX_SCALING) {
+ if (scaleDiff >= scalingFactors.length) {
throw new ArithmeticException("Scaling exception");
}
- // Not pretty...
- long scalingFactor = 1;
- for (int i = 0; i < scaleDiff; i++) {
- scalingFactor *= 10;
- }
+ // Adjust the timestamp
+ long scalingFactor = scalingFactors[scaleDiff];
if (newScale < fScale) {
newValue *= scalingFactor;
newPrecision *= scalingFactor;
@@ -191,9 +183,64 @@ public class TmfTimestamp implements Cloneable {
}
}
- return new TmfTimestamp(newValue + offset, newScale, newPrecision);
+ if (offset < 0) {
+ newValue = (newValue < Long.MIN_VALUE - offset) ? Long.MIN_VALUE : newValue + offset;
+ } else {
+ newValue = (newValue > Long.MAX_VALUE - offset) ? Long.MAX_VALUE : newValue + offset;
+ }
+
+ return new TmfTimestamp(newValue, newScale, newPrecision);
}
+ private static final long scalingFactors[] = new long[] {
+ 1L,
+ 10L,
+ 100L,
+ 1000L,
+ 10000L,
+ 100000L,
+ 1000000L,
+ 10000000L,
+ 100000000L,
+ 1000000000L,
+ 10000000000L,
+ 100000000000L,
+ 1000000000000L,
+ 10000000000000L,
+ 100000000000000L,
+ 1000000000000000L,
+ 10000000000000000L,
+ 100000000000000000L,
+ 1000000000000000000L,
+ };
+
+ private static final long scalingLimits[] = new long[] {
+ Long.MAX_VALUE / 1L,
+ Long.MAX_VALUE / 10L,
+ Long.MAX_VALUE / 100L,
+ Long.MAX_VALUE / 1000L,
+ Long.MAX_VALUE / 10000L,
+ Long.MAX_VALUE / 100000L,
+ Long.MAX_VALUE / 1000000L,
+ Long.MAX_VALUE / 10000000L,
+ Long.MAX_VALUE / 100000000L,
+ Long.MAX_VALUE / 1000000000L,
+ Long.MAX_VALUE / 10000000000L,
+ Long.MAX_VALUE / 100000000000L,
+ Long.MAX_VALUE / 1000000000000L,
+ Long.MAX_VALUE / 10000000000000L,
+ Long.MAX_VALUE / 100000000000000L,
+ Long.MAX_VALUE / 1000000000000000L,
+ Long.MAX_VALUE / 10000000000000000L,
+ Long.MAX_VALUE / 100000000000000000L,
+ Long.MAX_VALUE / 1000000000000000000L,
+ };
+
+ public static long getScalingFactor(byte scale)
+ {
+ return scalingFactors[scale];
+ }
+
/**
* Compute the adjustment, in the reference scale, needed to synchronize
* this timestamp with a reference timestamp.
@@ -220,48 +267,69 @@ public class TmfTimestamp implements Cloneable {
*/
public int compareTo(final TmfTimestamp other, boolean withinPrecision) {
- // If values have the same time scale, perform the comparison
- if (fScale == other.fScale) {
- if (withinPrecision) {
- if ((fValue + fPrecision) < (other.fValue - other.fPrecision))
- return -1;
- if ((fValue - fPrecision) > (other.fValue + other.fPrecision))
- return 1;
- return 0;
- }
- return (fValue == other.fValue) ? 0 : (fValue < other.fValue) ? -1 : 1;
- }
+ // If values have the same time scale, perform the comparison
+ if (fScale == other.fScale) {
+ if (withinPrecision)
+ return compareWithinPrecision(this.fValue, this.fPrecision, other.fValue, other.fPrecision);
+ else
+ return compareNoPrecision(this.fValue, other.fValue);
+ }
- // If values have different time scales, adjust to the finest one and
- // then compare. If the scaling difference is too large, revert to
- // some heuristics. Hopefully, nobody will try to compare galactic and
- // quantic clock events...
- if (Math.abs(fScale - other.fScale) > MAX_SCALING) {
- return simpleCompare(other);
- }
+ // If values have different time scales, adjust to the finest one and
+ // then compare. If the scaling difference is too large, revert to
+ // some heuristics. Hopefully, nobody will try to compare galactic and
+ // quantic clock events...
+ int scaleDiff = Math.abs(fScale - other.fScale);
+ long factor, limit;
+ if (scaleDiff < scalingFactors.length) {
+ factor = scalingFactors[scaleDiff];
+ limit = scalingLimits[scaleDiff];
+ } else {
+ factor = 0;
+ limit = 0; // !!! 0 can always be scaled!!!
+ }
- byte newScale = (fScale < other.fScale) ? fScale : other.fScale;
- try {
- TmfTimestamp ts1 = this.synchronize(0, newScale);
- TmfTimestamp ts2 = other.synchronize(0, newScale);
- return ts1.compareTo(ts2, withinPrecision);
- } catch (ArithmeticException e) {
- return simpleCompare(other);
- }
+ if (fScale < other.fScale) {
+ // this has finer scale, so other should be scaled
+ if (withinPrecision)
+ if (other.fValue > limit || other.fValue < -limit
+ || other.fPrecision > limit
+ || other.fPrecision < -limit)
+ return other.fValue > 0 ? -1 : +1; // other exceeds scaling limit
+ else
+ return compareWithinPrecision(this.fValue, this.fPrecision,
+ other.fValue * factor, other.fPrecision * factor);
+ else if (other.fValue > limit || other.fValue < -limit)
+ return other.fValue > 0 ? -1 : +1; // other exceeds scaling limit
+ else
+ return compareNoPrecision(this.fValue, other.fValue * factor);
+ } else {
+ // other has finer scale, so this should be scaled
+ if (withinPrecision)
+ if (this.fValue > limit || this.fValue < -limit
+ || this.fPrecision > limit || this.fPrecision < -limit)
+ return this.fValue > 0 ? +1 : -1; // we exceed scaling limit
+ else
+ return compareWithinPrecision(this.fValue * factor,
+ this.fPrecision * factor, other.fValue,
+ other.fPrecision);
+ else if (this.fValue > limit || this.fValue < -limit)
+ return this.fValue > 0 ? +1 : -1; // we exceed scaling limit
+ else
+ return compareNoPrecision(this.fValue * factor, other.fValue);
+ }
}
- private int simpleCompare(final TmfTimestamp other) {
- if ((fValue == 0) || (other.fValue == 0)) {
- return (fValue == other.fValue) ? 0
- : (fValue < other.fValue) ? -1 : 1;
- }
- if ((fValue > 0) && (other.fValue > 0)) {
- return (fScale < other.fScale) ? -1 : 1;
- }
- if ((fValue < 0) && (other.fValue < 0)) {
- return (fScale > other.fScale) ? -1 : 1;
- }
- return (fValue < 0) ? -1 : 1;
+ private static int compareNoPrecision(long thisValue, long otherValue) {
+ return (thisValue == otherValue) ? 0 : (thisValue < otherValue) ? -1 : 1;
+ }
+
+ private static int compareWithinPrecision(long thisValue, long thisPrecision, long otherValue, long otherPrecision) {
+ if ((thisValue + thisPrecision) < (otherValue - otherPrecision))
+ return -1;
+ if ((thisValue - thisPrecision) > (otherValue + otherPrecision))
+ return 1;
+ return 0;
}
// ------------------------------------------------------------------------
@@ -303,4 +371,4 @@ public class TmfTimestamp implements Cloneable {
return clone;
}
-} \ No newline at end of file
+}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java
index 75611dcff1..0ffccef26b 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java
@@ -49,24 +49,25 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// ------------------------------------------------------------------------
// The currently selected experiment
- private static TmfExperiment<?> fCurrentExperiment = null;
+ protected static TmfExperiment<?> fCurrentExperiment = null;
// The set of traces that constitute the experiment
- private ITmfTrace[] fTraces;
+ protected ITmfTrace[] fTraces;
// The total number of events
- private long fNbEvents;
+ protected long fNbEvents;
// The experiment time range
- private TmfTimeRange fTimeRange;
+ protected TmfTimeRange fTimeRange;
// The experiment reference timestamp (default: Zero)
- private TmfTimestamp fEpoch;
+ protected TmfTimestamp fEpoch;
// The experiment index
- private Vector<TmfCheckpoint> fCheckpoints = new Vector<TmfCheckpoint>();
+ protected Vector<TmfCheckpoint> fCheckpoints = new Vector<TmfCheckpoint>();
- private TmfExperimentContext fSavedContext;
+ // The current experiment context
+ protected TmfExperimentContext fExperimentContext;
// ------------------------------------------------------------------------
// Constructors
@@ -95,6 +96,10 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
updateTimeRange();
}
+ protected TmfExperiment(String id, Class<T> type) {
+ super(id, type);
+ }
+
/**
* @param type
* @param id
@@ -114,6 +119,10 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
this(type, id, traces, TmfTimestamp.Zero, indexPageSize);
}
+ /**
+ * Copy constructor
+ * @param other
+ */
public TmfExperiment(TmfExperiment<T> other) {
super(other.getName() + "(clone)", other.fType);
@@ -139,7 +148,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
* Clears the experiment
*/
@Override
- public void dispose() {
+ public synchronized void dispose() {
if (fTraces != null) {
for (ITmfTrace trace : fTraces) {
trace.dispose();
@@ -152,10 +161,6 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
super.dispose();
}
- private static void setCurrentExperiment(TmfExperiment<?> experiment) {
- fCurrentExperiment = experiment;
- }
-
// ------------------------------------------------------------------------
// ITmfTrace
// ------------------------------------------------------------------------
@@ -192,6 +197,10 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// Accessors
// ------------------------------------------------------------------------
+ private static void setCurrentExperiment(TmfExperiment<?> experiment) {
+ fCurrentExperiment = experiment;
+ }
+
public static TmfExperiment<?> getCurrentExperiment() {
return fCurrentExperiment;
}
@@ -321,7 +330,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// Set the trace location and read the corresponding event
expLocation.getLocation()[i] = context.getContexts()[i].getLocation();
- context.getEvents()[i] = fTraces[i].parseEvent(context.getContexts()[i]);
+ context.getEvents()[i] = fTraces[i].getNextEvent(context.getContexts()[i]);
}
// Tracer.trace("Ctx: SeekLocation - done");
@@ -331,7 +340,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
context.setLastTrace(TmfExperimentContext.NO_TRACE);
context.setRank(rank);
- fSavedContext = new TmfExperimentContext(context);
+ fExperimentContext = context;
return context;
}
@@ -375,25 +384,18 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
context.setRank((long) index * fIndexPageSize);
// And locate the event
- TmfExperimentContext nextEventContext = new TmfExperimentContext(context);
- TmfEvent event = parseEvent(nextEventContext);
+ TmfEvent event = parseEvent(context);
while (event != null && event.getTimestamp().compareTo(timestamp, false) < 0) {
- context = new TmfExperimentContext(nextEventContext);
- event = getNextEvent(nextEventContext);
+ getNextEvent(context);
+ event = parseEvent(context);
}
- if (event != null) {
- if (nextEventContext.getLastTrace() != TmfExperimentContext.NO_TRACE) {
- nextEventContext.setLastTrace(TmfExperimentContext.NO_TRACE);
- nextEventContext.updateRank(-1);
- }
- fSavedContext = new TmfExperimentContext(nextEventContext);
- }
- else {
- nextEventContext.setLocation(null);
- nextEventContext.setRank(ITmfContext.UNKNOWN_RANK);
+ if (event == null) {
+ context.setLocation(null);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
}
- return nextEventContext;
+
+ return context;
}
/* (non-Javadoc)
@@ -422,49 +424,19 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
context.setRank((long) index * fIndexPageSize);
// And locate the event
- TmfExperimentContext nextEventContext = new TmfExperimentContext(context);
- TmfEvent event = parseEvent(nextEventContext);
+ TmfEvent event = parseEvent(context);
long pos = context.getRank();
- while (event != null && pos++ <= rank) {
- context = new TmfExperimentContext(nextEventContext);
- event = getNextEvent(nextEventContext);
+ while (event != null && pos++ < rank) {
+ getNextEvent(context);
+ event = parseEvent(context);
}
- if (event != null) {
- if (nextEventContext.getLastTrace() != TmfExperimentContext.NO_TRACE) {
- nextEventContext.setLastTrace(TmfExperimentContext.NO_TRACE);
- nextEventContext.updateRank(-1);
- }
- fSavedContext = new TmfExperimentContext(nextEventContext);
+ if (event == null) {
+ context.setLocation(null);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
}
- else {
- nextEventContext.setLocation(null);
- nextEventContext.setRank(ITmfContext.UNKNOWN_RANK);
- }
- return nextEventContext;
-
-// // And locate the event
-// TmfExperimentContext nextEventContext = new TmfExperimentContext(context);
-// TmfEvent event = parseEvent(nextEventContext);
-// long pos = context.getRank();
-// while (event != null && pos < rank) {
-// event = getNextEvent(nextEventContext);
-// context = new TmfExperimentContext(nextEventContext);
-// pos++;
-// }
-//
-// if (event != null) {
-// if (context.getLastTrace() != TmfExperimentContext.NO_TRACE) {
-// context.setLastTrace(TmfExperimentContext.NO_TRACE);
-// context.updateRank(-1);
-// }
-// fSavedContext = new TmfExperimentContext(context);
-// }
-// else {
-// context.setLocation(null);
-// context.setRank(ITmfContext.UNKNOWN_RANK);
-// }
-// return context;
+
+ return context;
}
/**
@@ -499,7 +471,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
return null; // Throw an exception?
}
- if (!fSavedContext.equals(context)) {
+ if (!context.equals(fExperimentContext)) {
// Tracer.trace("Ctx: Restoring context");
seekLocation(context.getLocation());
}
@@ -513,12 +485,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
if (lastTrace != TmfExperimentContext.NO_TRACE) {
TmfContext traceContext = expContext.getContexts()[lastTrace];
expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].getNextEvent(traceContext);
- expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].parseEvent(traceContext);
-
- TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation();
- traceContext = expContext.getContexts()[lastTrace];
- expLocation.getLocation()[lastTrace] = traceContext.getLocation().clone();
- expLocation.getRanks()[lastTrace] = traceContext.getRank();
+ expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
}
// Scan the candidate events and identify the "next" trace to read from
@@ -537,8 +504,16 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// Update the experiment context and set the "next" event
TmfEvent event = null;
- if (trace >= 0) {
- updateIndex(expContext, timestamp);
+ if (trace != TmfExperimentContext.NO_TRACE) {
+ updateIndex(expContext, timestamp);
+
+ TmfContext traceContext = expContext.getContexts()[trace];
+ TmfExperimentLocation expLocation = (TmfExperimentLocation) expContext.getLocation();
+ expLocation.getLocation()[trace] = traceContext.getLocation().clone();
+
+// updateIndex(expContext, timestamp);
+
+ expLocation.getRanks()[trace] = traceContext.getRank();
expContext.setLastTrace(trace);
expContext.updateRank(1);
event = expContext.getEvents()[trace];
@@ -550,8 +525,6 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// Tracer.trace("Ctx: Event returned= " + event.getTimestamp().toString());
// }
- fSavedContext = new TmfExperimentContext(expContext);
-
return event;
}
@@ -564,7 +537,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// Add new entry at proper location (if empty)
if (fCheckpoints.size() == position) {
ITmfLocation<?> location = context.getLocation().clone();
- fCheckpoints.add(new TmfCheckpoint(timestamp, location));
+ fCheckpoints.add(new TmfCheckpoint(timestamp.clone(), location));
// System.out.println(this + "[" + (fCheckpoints.size() - 1) + "] " + timestamp + ", " + location.toString());
}
}
@@ -580,7 +553,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
return null; // Throw an exception?
}
- if (!fSavedContext.equals(context)) {
+ if (!context.equals(fExperimentContext)) {
// Tracer.trace("Ctx: Restoring context");
seekLocation(context.getLocation());
}
@@ -592,8 +565,8 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
if (lastTrace != TmfExperimentContext.NO_TRACE) {
TmfContext traceContext = expContext.getContexts()[lastTrace];
expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].getNextEvent(traceContext);
- expContext.getEvents()[lastTrace] = expContext.getTraces()[lastTrace].parseEvent(traceContext);
- fSavedContext = new TmfExperimentContext(expContext);
+ expContext.setLastTrace(TmfExperimentContext.NO_TRACE);
+ fExperimentContext = (TmfExperimentContext) context;
}
// Scan the candidate events and identify the "next" trace to read from
@@ -611,9 +584,10 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
}
TmfEvent event = null;
- if (trace >= 0) {
+ if (trace != TmfExperimentContext.NO_TRACE) {
event = expContext.getEvents()[trace];
}
+
return event;
}
@@ -641,7 +615,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// The index page size
private static final int DEFAULT_INDEX_PAGE_SIZE = 5000;
- private final int fIndexPageSize;
+ protected int fIndexPageSize;
// private static BufferedWriter fEventLog = null;
// private static BufferedWriter openLogFile(String filename) {
@@ -660,8 +634,10 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
fCheckpoints.clear();
// fEventLog = openLogFile("TraceEvent.log");
+// System.out.println(System.currentTimeMillis() + ": Experiment indexing started");
- ITmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, TmfTimeRange.Eternity, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.LONG) {
+ ITmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, TmfTimeRange.Eternity,
+ TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.BACKGROUND) {
// long indexingStart = System.nanoTime();
@@ -669,26 +645,15 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
TmfTimestamp lastTime = null;
@Override
- public void handleData() {
- TmfEvent[] events = getData();
- if (events.length > 0) {
-
-// try {
-// if (fEventLog != null) {
-// fEventLog.write(events[0].getTimestamp().toString());
-// fEventLog.newLine();
-// fEventLog.flush();
-// }
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-
- TmfTimestamp ts = events[0].getTimestamp();
+ public void handleData(TmfEvent event) {
+ super.handleData(event);
+ if (event != null) {
+ TmfTimestamp ts = event.getTimestamp();
if (startTime == null)
startTime = new TmfTimestamp(ts);
lastTime = new TmfTimestamp(ts);
- if ((fNbRead % DEFAULT_INDEX_PAGE_SIZE) == 0) {
+ if ((getNbRead() % DEFAULT_INDEX_PAGE_SIZE) == 0) {
updateExperiment();
}
}
@@ -696,14 +661,6 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
@Override
public void handleSuccess() {
-
-// try {
-// fEventLog.close();
-// fEventLog = null;
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-
// long indexingEnd = System.nanoTime();
updateExperiment();
@@ -712,17 +669,17 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// long average = (indexingEnd - indexingStart) / fNbEvents;
// System.out.println(getName() + ": start=" + startTime + ", end=" + lastTime + ", elapsed=" + (indexingEnd * 1.0 - indexingStart) / 1000000000);
// System.out.println(getName() + ": nbEvents=" + fNbEvents + " (" + (average / 1000) + "." + (average % 1000) + " us/evt)");
-
-// for (int i = 0; i < fCheckpoints.size(); i++) {
-// TmfCheckpoint checkpoint = fCheckpoints.get(i);
-// System.out.println("fCheckpoints[" + i + "] " + checkpoint.getTimestamp() + ", " + checkpoint.getLocation().toString());
-// }
}
private void updateExperiment() {
- fTimeRange = new TmfTimeRange(startTime, new TmfTimestamp(lastTime));
- fNbEvents = fNbRead;
- notifyListeners();
+ int nbRead = getNbRead();
+ if (nbRead != 0) {
+// updateTimeRange();
+// updateNbEvents();
+ fTimeRange = new TmfTimeRange(startTime, new TmfTimestamp(lastTime));
+ fNbEvents = nbRead;
+ notifyListeners();
+ }
}
};
@@ -769,26 +726,20 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
broadcast(new TmfExperimentUpdatedSignal(this, this)); // , signal.getTrace()));
}
-// @Override
-// public void queueResult(T data) {
-//// super.queueResult(data);
-// }
-
// ------------------------------------------------------------------------
// TmfDataProvider
// ------------------------------------------------------------------------
@Override
- protected void queueLongRequest(final ITmfDataRequest<T> request) {
+ protected void queueBackgroundRequest(final ITmfDataRequest<T> request, final int blockSize, final boolean indexing) {
// TODO: Handle the data requests also...
if (!(request instanceof ITmfEventRequest<?>)) {
super.queueRequest(request);
return;
}
+ final ITmfEventRequest<T> eventRequest = (ITmfEventRequest<T>) request;
- final TmfExperiment<T> experiment = this;
-
Thread thread = new Thread() {
@Override
public void run() {
@@ -796,53 +747,43 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// final long requestStart = System.nanoTime();
final Integer[] CHUNK_SIZE = new Integer[1];
- CHUNK_SIZE[0] = fIndexPageSize + 1;
-
- final ITmfEventRequest<T> req = (ITmfEventRequest<T>) request;
+ CHUNK_SIZE[0] = blockSize + ((indexing) ? 1 : 0);
final Integer[] nbRead = new Integer[1];
nbRead[0] = 0;
// final TmfTimestamp[] timestamp = new TmfTimestamp[1];
-// timestamp[0] = new TmfTimestamp(req.getRange().getStartTime());
-// final TmfTimestamp endTS = req.getRange().getEndTime();
+// timestamp[0] = new TmfTimestamp(eventRequest.getRange().getStartTime());
+// final TmfTimestamp endTS = eventRequest.getRange().getEndTime();
final Boolean[] isFinished = new Boolean[1];
isFinished[0] = Boolean.FALSE;
while (!isFinished[0]) {
-// TmfEventRequest<T> subRequest = new TmfEventRequest<T>(req.getDataType(), new TmfTimeRange(timestamp[0], endTS),
-// requestedSize, req.getBlockize(), ExecutionType.LONG)
- TmfDataRequest<T> subRequest = new TmfDataRequest<T>(req.getDataType(), nbRead[0], CHUNK_SIZE[0],
- req.getBlockize(), ExecutionType.LONG)
+// TmfEventRequest<T> subRequest = new TmfEventRequest<T>(eventRequest.getDataType(), new TmfTimeRange(timestamp[0], endTS), CHUNK_SIZE[0], eventRequest.getBlockize(), ExecutionType.BACKGROUND)
+// TmfDataRequest<T> subRequest = new TmfDataRequest<T>(eventRequest.getDataType(), nbRead[0], CHUNK_SIZE[0], eventRequest.getBlockize(), ExecutionType.BACKGROUND)
+ TmfDataRequest<T> subRequest = new TmfDataRequest<T>(eventRequest.getDataType(), nbRead[0], CHUNK_SIZE[0], ExecutionType.BACKGROUND)
{
-// int count = 0;
@Override
- public void handleData() {
- T[] data = getData();
-// if (count == 0) {
-// System.out.println("First event of the block: " + data[0].getTimestamp());
-// }
-// count++;
-// Tracer.trace("Ndx: " + ((TmfEvent) data[0]).getTimestamp());
- req.setData(data);
- req.handleData();
- if (fNbRead == CHUNK_SIZE[0]) {
- nbRead[0] += fNbRead;
-// System.out.println("fNbRead=" + fNbRead + ", count=" + count +", total=" + nbRead[0] + ", TS=" + data[0].getTimestamp());
+ public void handleData(T data) {
+ super.handleData(data);
+ eventRequest.handleData(data);
+ if (getNbRead() == CHUNK_SIZE[0]) {
+ nbRead[0] += getNbRead();
}
- if (fNbRead > CHUNK_SIZE[0]) {
+ if (getNbRead() > CHUNK_SIZE[0]) {
System.out.println("ERROR - Read too many events");
}
}
+
@Override
public void handleCompleted() {
// System.out.println("Request completed at: " + timestamp[0]);
- if (fNbRead < CHUNK_SIZE[0]) {
- req.done();
+ if (getNbRead() < CHUNK_SIZE[0]) {
+ eventRequest.done();
isFinished[0] = Boolean.TRUE;
- nbRead[0] += fNbRead;
+ nbRead[0] += getNbRead();
// System.out.println("fNbRead=" + fNbRead + ", count=" + count +", total=" + nbRead[0]);
}
super.handleCompleted();
@@ -850,7 +791,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
};
if (!isFinished[0]) {
- experiment.queueRequest(subRequest);
+ queueRequest(subRequest);
try {
subRequest.waitForCompletion();
@@ -861,7 +802,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// TmfTimestamp newTS = new TmfTimestamp(timestamp[0].getValue() + 1, timestamp[0].getScale(), timestamp[0].getPrecision());
// timestamp[0] = newTS;
- CHUNK_SIZE[0] = fIndexPageSize;
+ CHUNK_SIZE[0] = blockSize;
// System.out.println("New timestamp: " + timestamp[0]);
}
}
@@ -869,6 +810,7 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
// System.out.println("Background request completed. Elapsed= " + (requestEnded * 1.0 - requestStart) / 1000000000);
}
};
+
thread.start();
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java
index 84c1625354..7153383611 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/ITmfDataRequest.java
@@ -25,7 +25,7 @@ public interface ITmfDataRequest<T extends TmfData> {
// Constants
// ------------------------------------------------------------------------
- public enum ExecutionType { SHORT, LONG };
+ public enum ExecutionType { BACKGROUND, FOREGROUND };
// ------------------------------------------------------------------------
// Accessors
@@ -57,11 +57,6 @@ public interface ITmfDataRequest<T extends TmfData> {
public int getNbRequested();
/**
- * @return the block size
- */
- public int getBlockize();
-
- /**
* @return the number of events read so far
*/
public int getNbRead();
@@ -79,9 +74,7 @@ public interface ITmfDataRequest<T extends TmfData> {
// Data handling
// ------------------------------------------------------------------------
- public void setData(T[] data);
- public T[] getData();
- public void handleData();
+ public void handleData(T data);
// ------------------------------------------------------------------------
// Request handling
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java
index e698fa2726..38383c04b1 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedDataRequest.java
@@ -37,7 +37,7 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
* Default constructor
*/
public TmfCoalescedDataRequest(Class<T> dataType) {
- this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfCoalescedDataRequest(Class<T> dataType, ExecutionType execType) {
@@ -48,7 +48,7 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
* @param nbRequested
*/
public TmfCoalescedDataRequest(Class<T> dataType, int index) {
- this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfCoalescedDataRequest(Class<T> dataType, int index, ExecutionType execType) {
@@ -60,7 +60,7 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
* @param nbRequested
*/
public TmfCoalescedDataRequest(Class<T> dataType, int index, int nbRequested) {
- this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfCoalescedDataRequest(Class<T> dataType, int index, int nbRequested, ExecutionType execType) {
@@ -73,7 +73,7 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
* @param blockSize
*/
public TmfCoalescedDataRequest(Class<T> dataType, int index, int nbRequested, int blockSize) {
- super(dataType, index, nbRequested, blockSize, ExecutionType.SHORT);
+ super(dataType, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
}
public TmfCoalescedDataRequest(Class<T> dataType, int index, int nbRequested, int blockSize, ExecutionType execType) {
@@ -92,7 +92,6 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
boolean ok = request.getIndex() == getIndex();
ok &= request.getNbRequested() == getNbRequested();
- ok &= request.getBlockize() == getBlockize();
ok &= request.getExecType() == getExecType();
return ok;
@@ -103,14 +102,19 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
// ------------------------------------------------------------------------
@Override
- public void handleData() {
- for (ITmfDataRequest<T> request : fRequests) {
- request.setData(getData());
- request.handleData();
- }
+ public void handleData(T data) {
+ super.handleData(data);
+ // Don't call sub-requests handleData() unless this is a
+ // TmfCoalescedDataRequest; extended classes should call
+ // the sub-requests handleData().
+ if (getClass() == TmfCoalescedDataRequest.class) {
+ for (ITmfDataRequest<T> request : fRequests) {
+ request.handleData(data);
+ }
+ }
}
- @Override
+ @Override
public void done() {
for (ITmfDataRequest<T> request : fRequests) {
request.done();
@@ -159,7 +163,7 @@ public class TmfCoalescedDataRequest<T extends TmfData> extends TmfDataRequest<T
@Override
public String toString() {
return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName()
- + "," + getIndex() + "," + getNbRequested() + "," + getBlockize() + ")]";
+ + "," + getIndex() + "," + getNbRequested() + ")]";
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java
index 4868d10402..94c8e4c627 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfCoalescedEventRequest.java
@@ -37,7 +37,7 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
* @param range
*/
public TmfCoalescedEventRequest(Class<T> dataType) {
- this(dataType, TmfTimeRange.Eternity, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, TmfTimeRange.Eternity, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfCoalescedEventRequest(Class<T> dataType, ExecutionType execType) {
@@ -48,7 +48,7 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
* @param range
*/
public TmfCoalescedEventRequest(Class<T> dataType, TmfTimeRange range) {
- this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfCoalescedEventRequest(Class<T> dataType, TmfTimeRange range, ExecutionType execType) {
@@ -60,7 +60,7 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
* @param nbRequested
*/
public TmfCoalescedEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested) {
- this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfCoalescedEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, ExecutionType execType) {
@@ -73,7 +73,7 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
* @param blockSize Size of the largest blocks expected
*/
public TmfCoalescedEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
- super(dataType, 0, nbRequested, blockSize, ExecutionType.SHORT);
+ super(dataType, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
fRange = range;
}
@@ -90,7 +90,6 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
public boolean isCompatible(ITmfDataRequest<T> request) {
if (request instanceof ITmfEventRequest<?>) {
boolean ok = getNbRequested() == request.getNbRequested();
- ok &= getBlockize() == request.getBlockize();
ok &= getExecType() == request.getExecType();
if (ok) {
TmfTimestamp startTime = ((ITmfEventRequest<T>) request).getRange().getStartTime();
@@ -110,19 +109,23 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
// ------------------------------------------------------------------------
@Override
- public void handleData() {
+ public void handleData(T data) {
+ super.handleData(data);
for (ITmfDataRequest<T> request : fRequests) {
- if (request instanceof TmfEventRequest<?>) {
- TmfEventRequest<T> req = (TmfEventRequest<T>) request;
- T[] data = getData();
- TmfTimestamp ts = data[0].getTimestamp();
- if (data.length > 0 && req.getRange().contains(ts)) {
- req.setData(data);
- req.handleData();
- }
- }
- else {
- super.handleData();
+ if (data == null) {
+ request.handleData(null);
+ } else {
+ if (request instanceof TmfEventRequest<?>) {
+ TmfEventRequest<T> req = (TmfEventRequest<T>) request;
+ TmfTimestamp ts = data.getTimestamp();
+ if (req.getRange().contains(ts)) {
+ req.handleData(data);
+ }
+ }
+ else {
+ TmfDataRequest<T> req = (TmfDataRequest<T>) request;
+ req.handleData(data);
+ }
}
}
}
@@ -163,7 +166,7 @@ public class TmfCoalescedEventRequest<T extends TmfEvent> extends TmfCoalescedDa
@Override
public String toString() {
return "[TmfCoalescedEventRequest(" + getRequestId() + "," + getDataType().getSimpleName()
- + "," + getRange() + "," + getNbRequested() + "," + getBlockize() + ")]";
+ + "," + getRange() + "," + getNbRequested() + ")]";
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java
index d5d868da4c..aed62c1997 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java
@@ -12,6 +12,8 @@
package org.eclipse.linuxtools.tmf.request;
+import java.util.concurrent.CountDownLatch;
+
import org.eclipse.linuxtools.tmf.Tracer;
import org.eclipse.linuxtools.tmf.event.TmfData;
@@ -90,17 +92,15 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
private final int fRequestId; // A unique request ID
private final int fIndex; // The index (rank) of the requested event
private final int fNbRequested; // The number of requested events (ALL_DATA for all)
- private final int fBlockSize; // The maximum number of events per chunk
- protected int fNbRead; // The number of reads so far
+ private int fNbRead; // The number of reads so far
- private final Object lock;
+ private CountDownLatch startedLatch = new CountDownLatch(1);
+ private CountDownLatch completedLatch = new CountDownLatch(1);
private boolean fRequestRunning = false;
private boolean fRequestCompleted = false;
private boolean fRequestFailed = false;
private boolean fRequestCanceled = false;
- private T[] fData; // Data object
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -118,7 +118,7 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
* @param dataType the requested data type
*/
public TmfDataRequest(Class<T> dataType) {
- this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfDataRequest(Class<T> dataType, ExecutionType execType) {
@@ -130,7 +130,7 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
* @param nbRequested the number of data items requested
*/
public TmfDataRequest(Class<T> dataType, int index) {
- this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfDataRequest(Class<T> dataType, int index, ExecutionType execType) {
@@ -143,7 +143,7 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
* @param blockSize the number of data items per block
*/
public TmfDataRequest(Class<T> dataType, int index, int nbRequested) {
- this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfDataRequest(Class<T> dataType, int index, int nbRequested, ExecutionType execType) {
@@ -157,7 +157,7 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
* @param blockSize the number of data items per block
*/
public TmfDataRequest(Class<T> dataType, int index, int nbRequested, int blockSize) {
- this(dataType, index, nbRequested, blockSize, ExecutionType.SHORT);
+ this(dataType, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
}
public TmfDataRequest(Class<T> dataType, int index, int nbRequested, int blockSize, ExecutionType execType) {
@@ -165,10 +165,8 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
fDataType = dataType;
fIndex = index;
fNbRequested = nbRequested;
- fBlockSize = blockSize;
fExecType = execType;
fNbRead = 0;
- lock = new Object();
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "created");
}
@@ -213,13 +211,6 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
}
/**
- * @return the block size
- */
- public int getBlockize() {
- return fBlockSize;
- }
-
- /**
* @return the number of events read so far
*/
public synchronized int getNbRead() {
@@ -268,20 +259,9 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
/**
* Sets the data object to specified value. To be called by the
* asynchronous method implementor.
+ *
* @param data Data value to set.
*/
- public synchronized void setData(T[] data) {
- fNbRead += data.length;
- fData = data;
- }
-
- /**
- * Returns the data value, null if not set.
- */
- public synchronized T[] getData() {
- return fData;
- }
-
/**
* Handle a block of incoming data. This method is called every time
* a block of data becomes available.
@@ -295,9 +275,13 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
* (or a copy) if some persistence is needed between invocations.
* - When there is no more data, done() is called.
*
- * @param events - an array of events
+ * @param events - an events
*/
- public abstract void handleData();
+ public void handleData(T data) {
+ if (data != null) {
+ fNbRead++;
+ }
+ }
public void handleStarted() {
}
@@ -337,16 +321,27 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
}
/**
+ * To suspend the client thread until the request starts (or is
+ * canceled).
+ *
+ * @throws InterruptedException
+ */
+ public void waitForStart() throws InterruptedException {
+ while (!fRequestRunning) {
+ startedLatch.await();
+ }
+ }
+
+ /**
* To suspend the client thread until the request completes (or is
* canceled).
*
* @throws InterruptedException
*/
public void waitForCompletion() throws InterruptedException {
- synchronized (lock) {
- while (!fRequestCompleted)
- lock.wait();
- }
+ while (!fRequestCompleted) {
+ completedLatch.await();
+ }
}
/**
@@ -354,11 +349,11 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
*/
public void start() {
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "starting");
- synchronized(lock) {
+ synchronized(this) {
fRequestRunning = true;
- lock.notify();
}
handleStarted();
+ startedLatch.countDown();
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "started");
}
@@ -367,34 +362,30 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
*/
public void done() {
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "completing");
- synchronized(lock) {
+ synchronized(this) {
if (!fRequestCompleted) {
fRequestRunning = false;
fRequestCompleted = true;
}
- handleCompleted();
- lock.notify();
}
+ handleCompleted();
+ completedLatch.countDown();
}
/**
* Called by the request processor upon failure.
*/
- public void fail() {
- synchronized(lock) {
- fRequestFailed = true;
- done();
- }
+ public synchronized void fail() {
+ fRequestFailed = true;
+ done();
}
/**
* Called by the request processor upon cancellation.
*/
- public void cancel() {
- synchronized(lock) {
- fRequestCanceled = true;
- done();
- }
+ public synchronized void cancel() {
+ fRequestCanceled = true;
+ done();
}
// ------------------------------------------------------------------------
@@ -420,8 +411,7 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
@Override
public String toString() {
- return "[TmfDataRequest(" + fRequestId + "," + fDataType.getSimpleName()
- + "," + fIndex + "," + fNbRequested + "," + fBlockSize + ")]";
+ return "[TmfDataRequest(" + fRequestId + "," + fDataType.getSimpleName() +
+ "," + fIndex + "," + fNbRequested + ")]";
}
-
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java
index 0838fffc70..05f75c8e0f 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfEventRequest.java
@@ -36,7 +36,7 @@ public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest
* @param range
*/
public TmfEventRequest(Class<T> dataType) {
- this(dataType, TmfTimeRange.Eternity, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, TmfTimeRange.Eternity, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfEventRequest(Class<T> dataType, ExecutionType execType) {
@@ -47,7 +47,7 @@ public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest
* @param range
*/
public TmfEventRequest(Class<T> dataType, TmfTimeRange range) {
- this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfEventRequest(Class<T> dataType, TmfTimeRange range, ExecutionType execType) {
@@ -59,7 +59,7 @@ public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest
* @param nbRequested
*/
public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested) {
- this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.SHORT);
+ this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
}
public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, ExecutionType execType) {
@@ -72,7 +72,7 @@ public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest
* @param blockSize Size of the largest blocks expected
*/
public TmfEventRequest(Class<T> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
- super(dataType, 0, nbRequested, blockSize, ExecutionType.SHORT);
+ super(dataType, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
fRange = range;
}
@@ -114,7 +114,7 @@ public abstract class TmfEventRequest<T extends TmfEvent> extends TmfDataRequest
@Override
public String toString() {
return "[TmfEventRequest(" + getRequestId() + "," + getDataType().getSimpleName()
- + "," + getRange() + "," + getNbRequested() + "," + getBlockize() + ")]";
+ + "," + getRange() + "," + getNbRequested() + ")]";
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java
index 26c3416cd6..91a9318f04 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java
@@ -35,7 +35,7 @@ public class TmfRequestExecutor implements Executor {
public int compare(TmfThread o1, TmfThread o2) {
if (o1.getExecType() == o2.getExecType())
return 0;
- if (o1.getExecType() == ExecutionType.SHORT)
+ if (o1.getExecType() == ExecutionType.BACKGROUND)
return 1;
return -1;
}
@@ -67,7 +67,7 @@ public class TmfRequestExecutor implements Executor {
/**
* @return the shutdown state (i.e. if it is accepting new requests)
*/
- public boolean isShutdown() {
+ public synchronized boolean isShutdown() {
return fExecutor.isShutdown();
}
@@ -115,7 +115,8 @@ public class TmfRequestExecutor implements Executor {
*/
protected synchronized void scheduleNext() {
if ((fCurrentRequest = fRequestQueue.poll()) != null) {
- fExecutor.execute(fCurrentRequest);
+ if (!fExecutor.isShutdown())
+ fExecutor.execute(fCurrentRequest);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/ITmfContext.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/ITmfContext.java
index 66fa11a93e..d0fd3e5ad8 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/ITmfContext.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/ITmfContext.java
@@ -19,6 +19,7 @@ package org.eclipse.linuxtools.tmf.trace;
*/
public interface ITmfContext {
+ public long INITIAL_RANK = -1L;
public long UNKNOWN_RANK = -2L;
public void setLocation(ITmfLocation<?> location);
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfContext.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfContext.java
index 042c1ef35f..2dfc2de0dd 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfContext.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfContext.java
@@ -89,6 +89,9 @@ public class TmfContext implements ITmfContext, Cloneable {
@Override
public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
if (!(other instanceof TmfContext)) {
return false;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java
index 13c552ace6..dde6360114 100644
--- a/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java
+++ b/lttng/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java
@@ -22,11 +22,7 @@ import org.eclipse.linuxtools.tmf.event.TmfEvent;
import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
import org.eclipse.linuxtools.tmf.request.ITmfDataRequest;
-import org.eclipse.linuxtools.tmf.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.request.TmfDataRequest;
-import org.eclipse.linuxtools.tmf.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.signal.TmfTraceUpdatedSignal;
/**
* <b><u>TmfTrace</u></b>
@@ -338,7 +334,7 @@ public abstract class TmfTrace<T extends TmfEvent> extends TmfEventProvider<T> i
// Add new entry at proper location (if empty)
if (fCheckpoints.size() == position) {
ITmfLocation<?> location = context.getLocation().clone();
- fCheckpoints.add(new TmfCheckpoint(timestamp, location));
+ fCheckpoints.add(new TmfCheckpoint(timestamp.clone(), location));
// System.out.println(getName() + "[" + (fCheckpoints.size() - 1) + "] " + timestamp + ", " + location.toString());
}
}
@@ -378,162 +374,73 @@ public abstract class TmfTrace<T extends TmfEvent> extends TmfEventProvider<T> i
// Indexing
// ------------------------------------------------------------------------
- /*
- * The purpose of the index is to keep the information needed to rapidly
- * restore the traces contexts at regular intervals (every INDEX_PAGE_SIZE
- * event).
- */
-
- @SuppressWarnings({ "unchecked", "unused" })
- private void indexTrace(boolean waitForCompletion) {
-
- fCheckpoints.clear();
-
- ITmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, TmfTimeRange.Eternity, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.LONG) {
-
- TmfTimestamp startTime = null;
- TmfTimestamp lastTime = null;
-
- @Override
- public void handleData() {
- TmfEvent[] events = getData();
- if (events.length > 0) {
- TmfTimestamp ts = events[0].getTimestamp();
- if (startTime == null) {
- startTime = new TmfTimestamp(ts);
- fStartTime = startTime;
- }
- lastTime = new TmfTimestamp(ts);
-
- if ((fNbRead % DEFAULT_INDEX_PAGE_SIZE) == 0) {
- updateTraceData();
- }
- }
- }
-
- @Override
- public void handleSuccess() {
- updateTraceData();
- }
-
- private void updateTraceData() {
- if (fNbRead != 0) {
- fEndTime = new TmfTimestamp(lastTime);
- fNbEvents = fNbRead;
- notifyListeners();
- }
- }
- };
-
- sendRequest((ITmfDataRequest<T>) request);
- if (waitForCompletion)
- try {
- request.waitForCompletion();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
+// /*
+// * The purpose of the index is to keep the information needed to rapidly
+// * restore the traces contexts at regular intervals (every INDEX_PAGE_SIZE
+// * event).
+// */
+//
+// @SuppressWarnings({ "unchecked", "unused" })
+// private void indexTrace(boolean waitForCompletion) {
+//
+// fCheckpoints.clear();
+//
+// ITmfEventRequest<TmfEvent> request = new TmfEventRequest<TmfEvent>(TmfEvent.class, TmfTimeRange.Eternity, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.BACKGROUND) {
+//
+// TmfTimestamp startTime = null;
+// TmfTimestamp lastTime = null;
+//
+// @Override
+// public void handleData() {
+// TmfEvent[] events = getData();
+// if (events.length > 0) {
+// TmfTimestamp ts = events[0].getTimestamp();
+// if (startTime == null) {
+// startTime = new TmfTimestamp(ts);
+// fStartTime = startTime;
+// }
+// lastTime = new TmfTimestamp(ts);
+//
+// if ((fNbRead % DEFAULT_INDEX_PAGE_SIZE) == 0) {
+// updateTraceData();
+// }
+// }
+// }
+//
+// @Override
+// public void handleSuccess() {
+// updateTraceData();
+// }
+//
+// private void updateTraceData() {
+// if (fNbRead != 0) {
+// fEndTime = new TmfTimestamp(lastTime);
+// fNbEvents = fNbRead;
+// notifyListeners();
+// }
+// }
+// };
+//
+// sendRequest((ITmfDataRequest<T>) request);
+// if (waitForCompletion)
+// try {
+// request.waitForCompletion();
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+// }
- protected void notifyListeners() {
- broadcast(new TmfTraceUpdatedSignal(this, this, new TmfTimeRange(fStartTime, fEndTime)));
- }
+// protected void notifyListeners() {
+// broadcast(new TmfTraceUpdatedSignal(this, this, new TmfTimeRange(fStartTime, fEndTime)));
+// }
// ------------------------------------------------------------------------
// TmfDataProvider
// ------------------------------------------------------------------------
- @Override
- protected void queueLongRequest(final ITmfDataRequest<T> request) {
-
- // TODO: Handle the data requests also...
- if (!(request instanceof ITmfEventRequest<?>)) {
- super.queueRequest(request);
- return;
- }
-
- final TmfTrace<T> trace = this;
-
- Thread thread = new Thread() {
- @Override
- public void run() {
-
-// final long requestStart = System.nanoTime();
-
- final Integer[] CHUNK_SIZE = new Integer[1];
- CHUNK_SIZE[0] = fIndexPageSize + 1;
-
- final ITmfEventRequest<T> req = (ITmfEventRequest<T>) request;
-
- final Integer[] nbRead = new Integer[1];
- nbRead[0] = 0;
-
-// final TmfTimestamp[] timestamp = new TmfTimestamp[1];
-// timestamp[0] = new TmfTimestamp(req.getRange().getStartTime());
-// final TmfTimestamp endTS = req.getRange().getEndTime();
-
- final Boolean[] isFinished = new Boolean[1];
- isFinished[0] = Boolean.FALSE;
-
- while (!isFinished[0]) {
-
-// TmfEventRequest<T> subRequest = new TmfEventRequest<T>(req.getDataType(), new TmfTimeRange(timestamp[0], endTS),
-// requestedSize, req.getBlockize(), ExecutionType.LONG)
- TmfDataRequest<T> subRequest = new TmfDataRequest<T>(req.getDataType(), nbRead[0], CHUNK_SIZE[0],
- req.getBlockize(), ExecutionType.LONG)
- {
-// int count = 0;
- @Override
- public void handleData() {
- T[] data = getData();
-// if (count == 0) {
-// System.out.println("First event of the block: " + data[0].getTimestamp());
-// }
-// count++;
-// Tracer.trace("Ndx: " + ((TmfEvent) data[0]).getTimestamp());
- req.setData(data);
- req.handleData();
- if (fNbRead == CHUNK_SIZE[0]) {
- nbRead[0] += fNbRead;
-// System.out.println("fNbRead=" + fNbRead + ", count=" + count +", total=" + nbRead[0] + ", TS=" + data[0].getTimestamp());
- }
- if (fNbRead > CHUNK_SIZE[0]) {
- System.out.println("ERROR - Read too many events");
- }
- }
- @Override
- public void handleCompleted() {
-// System.out.println("Request completed at: " + timestamp[0]);
- if (fNbRead < CHUNK_SIZE[0]) {
- req.done();
- isFinished[0] = Boolean.TRUE;
- nbRead[0] += fNbRead;
-// System.out.println("fNbRead=" + fNbRead + ", count=" + count +", total=" + nbRead[0]);
- }
- super.handleCompleted();
- }
- };
-
- if (!isFinished[0]) {
- trace.queueRequest(subRequest);
-
- try {
- subRequest.waitForCompletion();
-// System.out.println("Finished at " + timestamp[0]);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
-// TmfTimestamp newTS = new TmfTimestamp(timestamp[0].getValue() + 1, timestamp[0].getScale(), timestamp[0].getPrecision());
-// timestamp[0] = newTS;
- CHUNK_SIZE[0] = fIndexPageSize;
-// System.out.println("New timestamp: " + timestamp[0]);
- }
- }
-// final long requestEnded = System.nanoTime();
-// System.out.println("Background request completed. Elapsed= " + (requestEnded * 1.0 - requestStart) / 1000000000);
- }
- };
- thread.start();
- }
+// @Override
+// protected void queueBackgroundRequest(final ITmfDataRequest<T> request, final int blockSize, final boolean adjust) {
+// super.queueBackgroundRequest(request, fIndexPageSize, true);
+// }
}

Back to the top