2010-10-15 Francois Chouinard <fchouinard@gmail.com> Fix for Bug327910
authorFrancois Chouinard <fchouinard@gmail.com>
Fri, 15 Oct 2010 16:12:07 +0000 (16:12 +0000)
committerFrancois Chouinard <fchouinard@gmail.com>
Fri, 15 Oct 2010 16:12:07 +0000 (16:12 +0000)
* 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
* 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
* 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
* src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java: Small cleanup
* src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java (fStartTime): Fixed unit test for updated start time

30 files changed:
org.eclipse.linuxtools.lttng.tests/ChangeLog
org.eclipse.linuxtools.lttng.tests/src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java
org.eclipse.linuxtools.lttng.ui/ChangeLog
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java
org.eclipse.linuxtools.lttng/ChangeLog
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEvent.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventField.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngEventType.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java
org.eclipse.linuxtools.tmf.ui/ChangeLog
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
org.eclipse.linuxtools.tmf/ChangeLog
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEvent.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventField.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfEventType.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java

index 2687be57033e035642de1a23bea90b8dd3f910d7..cf70f030cca6029ccd8919583ce6fca814a11bf8 100644 (file)
@@ -1,3 +1,6 @@
+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
index 2de5d6b7f1c92d0e8068db7daa3326bb2e97d086..4704b0d4e905ee5dcb01d7ef6baf8c978d140f3d 100644 (file)
@@ -42,7 +42,7 @@ public class LTTngExperimentTest extends TestCase {
     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(13589692331524L, (byte) -9);
+    private static final TmfTimestamp  fStartTime = new TmfTimestamp(13589759412128L, (byte) -9);
     private static final TmfTimestamp  fEndTime   = new TmfTimestamp(13589907059242L, (byte) -9);
 
     private static ITmfTrace[] fTraces;
index d3641d4997752fd898a7f35d5ea2ab2d409a3db3..4e66e97dd79beaba747155a454ebd82cf700c889 100644 (file)
@@ -1,3 +1,10 @@
+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/controlflow/ControlFlowView.java: Added checks for disposed widget  
index 69922cd69e030ff53ecaaee35b9e75ee0fc29134..b6ce7c33955fb7912cb71dfa441c3eee3cf1ff4a 100644 (file)
@@ -416,7 +416,7 @@ class AsyncCanvasRedrawer {
        }
        
        /**
-        * 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.
         * 
index e811eaf8b3ed56a7454d14896658179c00a8c2f5..8851268ba8354904c1ae84f78c0663cf94a8050c 100644 (file)
@@ -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();
        }
        
        /**
index 80c6f270b4457d109d388d589506fa1dc0cc578e..952871e80e47b2ed203ca291f9bae55132fc9cb5 100644 (file)
@@ -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 {
@@ -143,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);
@@ -181,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());
                        
 /*                     
@@ -229,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);
                
                
                /////////////////////////////////////////////////////////////////////////////////////
@@ -276,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);
@@ -409,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);
                
 /*
@@ -518,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.
@@ -715,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.FOREGROUND);
+                       selectedWindowRequest = performRequest(experiment, selectedWindowCanvas, tmpRange, intervalTime, ExecutionType.FOREGROUND);
                selectedWindowCanvas.redrawAsynchronously();
        }
        
@@ -801,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();
                }
                
@@ -893,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();
@@ -904,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();
@@ -978,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
@@ -1040,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 ) {
@@ -1052,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();
        }
        
        /**
@@ -1061,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);
@@ -1072,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();
index b2d8fefb88070eb99d336c640f3387408e54fc59..23c8d07f08a007e68b06aa21b90e9e5cd77a9fc6 100644 (file)
@@ -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,17 +436,15 @@ class AsyncTimeTextGroupRedrawer {
         * 
         * @param newTime       The new time to set
         */
-       public void asynchronousSetValue(long newTime) {
+       public void asynchronousSetValue(final long newTime) {
                // Ignore setting of value if widget is disposed
                if (parentTimeTextGroup.getParent().isDisposed()) return;
                
-               final long tmpTime = newTime;
-               
                Display display =  parentTimeTextGroup.getParent().getDisplay();
                display.asyncExec(new Runnable() {
                        public void run() {
                                if (!parentTimeTextGroup.getParent().isDisposed()) {
-                                       parentTimeTextGroup.setValue(tmpTime);
+                                       parentTimeTextGroup.setValue(newTime);
                                }
                        }
                });
index a131a8f5d19b01fddef28a791c0e681e39ed2bbb..d53da2fba2a346b1628fcac38bf3704b684c9348 100644 (file)
@@ -1,3 +1,18 @@
+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
index 037ba1eaaaf0e595f1d74367e3c6eaf707ca935a..dbb15b98806fb8a884ff70742e94ed739a8c743f 100644 (file)
@@ -182,6 +182,11 @@ public class LttngEvent extends TmfEvent {
     
     @Override
        public LttngEvent clone() {
-       return new LttngEvent(this);
+       LttngEvent clone = (LttngEvent) super.clone();
+       clone.getContent().setEvent(clone);
+               clone.parentTrace = parentTrace;
+               clone.jniEventReference = jniEventReference;
+       return clone;
     }
+
 }
index c8b6d454082c79711811b4c684d3766a419da3a4..e6f8edeebc9ee5f3fe5d4eac5e058857ddf5acc2 100644 (file)
@@ -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
index 31b15bb2e002d1d6ef051a2e5eefbb863bd1f218..ac67c760de6ae716e8920c30e917e72889cc2dfa 100644 (file)
@@ -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;
        }
        
 }
index 9ed06528543ea7cbcde4eecfa41d3ec305a7422b..d6f8b124deaf0d039d96725edcb2ebcd039e3630 100644 (file)
@@ -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;
+       }
 }
index 861c03bb383adac1eafd85ff8ab5c4a69cddba59..68d9c61237e40bd3e02d02a71f1207be22e2bc46 100644 (file)
@@ -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;
+       }
 }
index 156cd4e8f4bafec03c581933950622c2c71ffe84..82505e532e483718bac4261a7b9fdfa0f4dd3b48 100644 (file)
@@ -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;
+    }
+
 }
index df1da9e42a003d3680f72051f329da0724e912bf..c282a554f03d61f8a1af83a7e7594f59bed34284 100644 (file)
@@ -158,4 +158,10 @@ public class LttngTimestamp extends TmfTimestamp {
 
         return result;
     }
+
+    @Override
+    public LttngTimestamp clone() {
+       return (LttngTimestamp) super.clone();
+    }
+
 }
index 706088f85b3f233f8458c91bd8587a8bd2549741..2c73665e0a078fa44cf0d920ab4d4c492dae328a 100644 (file)
@@ -53,6 +53,7 @@ public class StateExperimentManager extends LTTngTreeNode implements
         * building
         */
        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;
 
@@ -62,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);
        }
 
 
@@ -280,6 +280,7 @@ public class StateExperimentManager extends LTTngTreeNode implements
                LTTngTreeNode[] traceNodes = experimentNode.getChildren();
                synchronized (this) {
                        ftraceToManagerMap.clear();
+                       ftraceEventsReadMap.clear();
                }
                
                ITmfTrace trace;
@@ -300,6 +301,7 @@ public class StateExperimentManager extends LTTngTreeNode implements
                        trace = traceManager.getTrace();
                        synchronized (this) {
                                ftraceToManagerMap.put(trace, traceManager);
+                               ftraceEventsReadMap.put(trace, new Long(0));
                        }
                }
                
@@ -314,8 +316,8 @@ public class StateExperimentManager extends LTTngTreeNode implements
                                LttngEvent.class, TmfTimeRange.Eternity,
                                TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.BACKGROUND) {
                
-                       Long nbEvents = 0L;
-               
+                       long nbEventsHandled = 0;
+                       
                        /*
                         * (non-Javadoc)
                         * 
@@ -327,12 +329,14 @@ public class StateExperimentManager extends LTTngTreeNode implements
                                super.handleData(event);
                                if (event != null) {
 //                                     Tracer.trace("Chk: " + event.getTimestamp());
+                                       nbEventsHandled++;
                                        ITmfTrace trace = event.getParentTrace();
                                        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 {
@@ -381,7 +385,7 @@ public class StateExperimentManager extends LTTngTreeNode implements
                         */
                        private void printCompletedMessage() {
                                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");
index 8fed5cb6911c2cf1c012638d88a2c824494dca11..589759f139ac92de04619a9d9350711a0543130a 100644 (file)
@@ -56,7 +56,7 @@ class LTTngTraceException extends LttngException {
 public class LTTngTrace extends TmfTrace<LttngEvent> {
        
        public static boolean printDebug  = false;
-       public static boolean uniqueEvent = false;
+       public static boolean uniqueEvent = true;
        
     private final static boolean SHOW_LTT_DEBUG_DEFAULT    = false;
        private final static boolean IS_PARSING_NEEDED_DEFAULT = !uniqueEvent;
@@ -77,7 +77,6 @@ public class LTTngTrace extends TmfTrace<LttngEvent> {
     LttngEventContent               eventContent     = null;
     LttngEventReference             eventReference   = null;
     
-    
     // The actual event
     LttngEvent                      currentLttngEvent = null;             
     
@@ -165,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));
 
     }
     
index c2c18c9e7bf2ee83144ec566daec2486c2cea044..be59a87c714f0f6148566127473559a6880c78d9 100644 (file)
@@ -1,3 +1,7 @@
+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/views/project/ProjectView.java: Added checks for disposed widget 
index db784b70a8f25d5b9a8b6fa65157906992a91182..f31e0120081b65824bf5b5dee6c308ccde7156dd 100644 (file)
@@ -46,8 +46,6 @@ import org.eclipse.swt.widgets.TableItem;
  */\r
 public class TmfEventsTable extends TmfComponent {\r
 \r
-//    private Shell fShell;\r
-    \r
     // ------------------------------------------------------------------------\r
     // Table data\r
     // ------------------------------------------------------------------------\r
index 1074d89d9cb07eb0d999945f615f72418e487964..32d85476126457ba391667d540a7906fa64c8112 100644 (file)
@@ -1,3 +1,16 @@
+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/request/TmfRequestExecutor.java: Added checks for disposed widget 
index 78f682ebf518efcb6c89c6545ddcd91e2e71c931..d5b8be044a503831055706b494229d8b380fdb56 100644 (file)
@@ -192,7 +192,21 @@ public class TmfEvent extends TmfData implements Cloneable {
 
        @Override
        public TmfEvent clone() {
-               return new TmfEvent(this);
+               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;
        }
 
 }
index 50a0b09d6dea7f8c72c3a80e2290e4ecb4cfe15e..19174a1a93a18dd8057954a5af11289d2e1407f0 100644 (file)
 
 package org.eclipse.linuxtools.tmf.event;
 
-
 /**
  * <b><u>TmfEventContent</u></b>
  * <p>
  * The event content.
  */
-public class TmfEventContent {
+public class TmfEventContent implements Cloneable {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -173,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;
+       }
 }
index e39180fe344932e040fcad1f5273c5b1c4d9e1e1..972491c738702efe9338e215fc31e2b65f60a513 100644 (file)
@@ -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
index 39b319e4dcf321cd504df74f3f8a68fcc96a2b64..2b1fc97696d7504689a5c027444835b89e208d07 100644 (file)
@@ -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;
+       }
 }
index 3a351fbc4f0d6656a7fb2f239702a65da76935ca..c97805ae28fab858ebe16f70ad487787394ec530 100644 (file)
@@ -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;
+       }
 }
index fa998eca2d61b8ce9b56144595cd83708b5e3049..357dc9e2d9ecd8e934367afe5f38ecaea761c8d3 100644 (file)
 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
index a9407ed113f80a255f6e0dfdac711d9c5faf8f61..786e64346564ebc22938cf08f6b604ec444cb496 100644 (file)
@@ -13,7 +13,6 @@
 
 package org.eclipse.linuxtools.tmf.event;
 
-
 /**
  * <b><u>TmfTimestamp</u></b>
  * <p>
index d9dff18c31e2d498a3d9ffd3f0134f3b93ce0485..0ffccef26bd6959d227a1e6e64b0b5f92eb32f65 100644 (file)
@@ -537,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());
                        }
                }
index ce093c350bbf2c60e77ddb74e18994e3316e3a0e..aed62c19971763de6a3ac6f3fa730388406fbeaa 100644 (file)
@@ -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;
 
@@ -92,7 +94,8 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
     private final int                  fNbRequested;   // The number of requested events (ALL_DATA for all)
     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;
@@ -164,7 +167,6 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
        fNbRequested = nbRequested;
        fExecType    = execType;
        fNbRead      = 0;
-        lock         = new Object();
         if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "created");
     }
 
@@ -325,11 +327,9 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
      * @throws InterruptedException 
      */
     public void waitForStart() throws InterruptedException {
-        synchronized (lock) {
-            while (!fRequestRunning) {
-               lock.wait();
-            }
-        }
+               while (!fRequestRunning) {
+                       startedLatch.await();
+               }
     }
 
     /**
@@ -339,11 +339,9 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
      * @throws InterruptedException 
      */
     public void waitForCompletion() throws InterruptedException {
-        synchronized (lock) {
-            while (!fRequestCompleted) {
-               lock.wait();
-            }
-        }
+               while (!fRequestCompleted) {
+                       completedLatch.await();
+               }
     }
 
     /**
@@ -351,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.notifyAll();
         }
         handleStarted();
+        startedLatch.countDown();
         if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "started");
     }
 
@@ -364,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.notifyAll();
         }
+               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();
     }
 
     // ------------------------------------------------------------------------
@@ -417,7 +411,7 @@ public abstract class TmfDataRequest<T extends TmfData> implements ITmfDataReque
 
     @Override
     public String toString() {
-               return "[TmfDataRequest(" + fRequestId + "," + fDataType.getSimpleName() 
-                       "," + fIndex + "," + fNbRequested + ")]";
+               return "[TmfDataRequest(" + fRequestId + "," + fDataType.getSimpleName() 
+                       "," + fIndex + "," + fNbRequested + ")]";
     }
 }
index 5788325e48d93b96159cab851d5c1a0b6572f792..dde63601149dafcd75aa68336e79591aaea37059 100644 (file)
@@ -334,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());
                                }
                        }
This page took 0.050777 seconds and 5 git commands to generate.