[219097] LTTng updates
authorFrancois Chouinard <fchouinard@gmail.com>
Thu, 8 Oct 2009 14:13:06 +0000 (14:13 +0000)
committerFrancois Chouinard <fchouinard@gmail.com>
Thu, 8 Oct 2009 14:13:06 +0000 (14:13 +0000)
31 files changed:
org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/DataRequestState.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeAfterUpdateHandlers.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeBeforeUpdateHandlers.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/TraceDropTarget.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteExperimentActionDelegate.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteTraceActionDelegate.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesTRangeBeforeUpdateHandlers.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java
org.eclipse.linuxtools.lttng/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateManager.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateStrings.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateProcessing.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java
org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java
org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui/build.properties
org.eclipse.linuxtools.tmf/META-INF/MANIFEST.MF

index bd241d02a6a320d0a3ad02bb3c5adb47249112c3..e73faadbe11b5e3b78a2d97cb02b6055943ef320 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: LTTng UI
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng.ui;singleton:=true
-Bundle-Version: 0.0.1
+Bundle-Version: 0.1.0.qualifier
 Bundle-Activator: org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin
 Bundle-Vendor: Eclipse
 Require-Bundle: org.eclipse.ui,
index 428d9070c05f89a876813581df4998ba9deed40f..9bd391cf7c07db590b6f558c3d86cdd755b4066c 100644 (file)
@@ -52,24 +52,29 @@ ITmfTimeAnalysisEntry {
        protected String className = "";
        protected CompositeType contType = CompositeType.UNKNOWN;
        protected long next_good_time = -1;
+       /*Time of first event which trigger the creation of this local resource */
+       protected long insertionTime = -1; 
 
        // ========================================================================
        // Constructors
        // =======================================================================
-       public TimeRangeComposite(Integer id, Long stime, Long etime, String name, CompositeType type) {
+       public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
+                       CompositeType type, long insertionTime) {
                super(stime, etime, null);
                this.id = id;
                this.name = name;
                contType = type;
-               next_good_time = stime;
+               this.insertionTime = insertionTime;
+               // Adjust the first good drawing position to the event time creating this resource
+               next_good_time = insertionTime;
        }
 
-       public TimeRangeComposite(Integer id, Long stime, Long etime, String name, String groupName, String className, CompositeType type) {
-               this(id, stime, etime, name, type);
-
-        this.groupName = groupName;
-        this.className = className;
-
+       public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
+                       String groupName, String className, CompositeType type,
+                       long insertionTime) {
+               this(id, stime, etime, name, type, insertionTime);
+               this.groupName = groupName;
+               this.className = className;
     }
        
        // ========================================================================
@@ -186,6 +191,15 @@ ITmfTimeAnalysisEntry {
        public void reset() {
                getChildEventComposites().clear();
                getTraceEvents().clear();
-               next_good_time = startTime;
+               next_good_time = insertionTime;
+       }
+
+       /**
+        * Event Time reflecting the creation of this local resource e.g. at Reception of Fork, etc.
+        * 
+        * @return
+        */
+       public long getInsertionTime() {
+               return insertionTime;
        }
 }
index c2604b891ee84143f9b291bfe7bc418d72985553..66dab7927e3777d7a30f77bfc97903c2b831c3d8 100644 (file)
@@ -40,9 +40,11 @@ public class TimeRangeEventProcess extends TimeRangeComposite implements
         * @param className\r
         */\r
        public TimeRangeEventProcess(int id, String name, long startTime,\r
-                       long stopTime, String groupName, String className, Long cpu) {\r
+                       long stopTime, String groupName, String className, Long cpu,\r
+                       long insertionTime) {\r
 \r
-               super(id, startTime, stopTime, name, CompositeType.PROCESS);\r
+               super(id, startTime, stopTime, name, CompositeType.PROCESS,\r
+                               insertionTime);\r
                this.cpu = cpu;\r
        }\r
 \r
index 04102f5a30a0efe620420ee5898127a849b7fdd6..b7a417ae9a1aa9c76790d4c85a18006e00dbe97b 100644 (file)
@@ -49,10 +49,11 @@ public abstract class TimeRangeEventResource extends TimeRangeComposite
         */\r
        public TimeRangeEventResource(int newId, long newStartTime,\r
                        long newStopTime, String newName, String newGroupName,\r
-                       String newClassName, ResourceTypes newType, Long newResourceId) {\r
+                       String newClassName, ResourceTypes newType, Long newResourceId,\r
+                       long insertionTime) {\r
 \r
                super(newId, newStartTime, newStopTime, newName, newGroupName,\r
-                               newClassName, CompositeType.RESOURCE);\r
+                               newClassName, CompositeType.RESOURCE, insertionTime);\r
 \r
                type = newType;\r
                resourceId = newResourceId;\r
index abf1d7cffd09bca85b6808f863da23303239163c..6c95c518c4d8f8518a6c578a22cf710cb720e7be 100644 (file)
@@ -51,37 +51,37 @@ public class TimeRangeResourceFactory {
        // ========================================================================
        // Public methods
        // =======================================================================
-       public TimeRangeEventResource createResource(int newId,
-                       long newStartTime,
+       public TimeRangeEventResource createResource(int newId, long newStartTime,
                        long newStopTime, String newName, String newGroupName,
-                       String newClassName, ResourceTypes type, Long newResourceId) {
+                       String newClassName, ResourceTypes type, Long newResourceId,
+                       long insertionTime) {
 
                TimeRangeEventResource resource = null;
                switch (type) {
                case CPU:
                        resource = createCpuResource(newId, newStartTime, newStopTime,
-                                       newName,
-                                       newGroupName, newClassName, type, newResourceId);
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
                        break;
                case IRQ:
                        resource = createIrqResource(newId, newStartTime, newStopTime,
-                                       newName,
-                                       newGroupName, newClassName, type, newResourceId);
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
                        break;
                case SOFT_IRQ:
                        resource = createSoftIrqResource(newId, newStartTime, newStopTime,
-                                       newName,
-                                       newGroupName, newClassName, type, newResourceId);
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
                        break;
                case TRAP:
                        resource = createTrapResource(newId, newStartTime, newStopTime,
-                                       newName,
-                                       newGroupName, newClassName, type, newResourceId);
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
                        break;
                case BDEV:
                        resource = createBdevResource(newId, newStartTime, newStopTime,
-                                       newName,
-                                       newGroupName, newClassName, type, newResourceId);
+                                       newName, newGroupName, newClassName, type, newResourceId,
+                                       insertionTime);
                        break;
                default:
                        break;
@@ -96,11 +96,11 @@ public class TimeRangeResourceFactory {
        private TimeRangeEventResource createIrqResource(int newId,
                        long newStartTime, long newStopTime, String newName,
                        String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId) {
+                       Long newResourceId, long insertionTime) {
 
                TimeRangeEventResource resource = new TimeRangeEventResource(newId,
-                               newStartTime, newStopTime,
-                               newName, newGroupName, newClassName, newType, newResourceId) {
+                               newStartTime, newStopTime, newName, newGroupName, newClassName,
+                               newType, newResourceId, insertionTime) {
 
                        @Override
                        public String getStateMode(LttngTraceState traceSt) {
@@ -121,11 +121,11 @@ public class TimeRangeResourceFactory {
        private TimeRangeEventResource createTrapResource(int newId,
                        long newStartTime, long newStopTime, String newName,
                        String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId) {
+                       Long newResourceId, long insertionTime) {
 
                TimeRangeEventResource resource = new TimeRangeEventResource(newId,
                                newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId) {
+                               newType, newResourceId, insertionTime) {
 
                        @Override
                        public String getStateMode(LttngTraceState traceSt) {
@@ -151,11 +151,11 @@ public class TimeRangeResourceFactory {
        private TimeRangeEventResource createSoftIrqResource(int newId,
                        long newStartTime, long newStopTime, String newName,
                        String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId) {
+                       Long newResourceId, long insertionTime) {
 
                TimeRangeEventResource resource = new TimeRangeEventResource(newId,
                                newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId) {
+                               newType, newResourceId, insertionTime) {
 
                        @Override
                        public String getStateMode(LttngTraceState traceSt) {
@@ -190,11 +190,11 @@ public class TimeRangeResourceFactory {
        private TimeRangeEventResource createBdevResource(int newId,
                        long newStartTime, long newStopTime, String newName,
                        String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId) {
+                       Long newResourceId, long insertionTime) {
 
                TimeRangeEventResource resource = new TimeRangeEventResource(newId,
                                newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId) {
+                               newType, newResourceId, insertionTime) {
 
                        @Override
                        public String getStateMode(LttngTraceState traceSt) {
@@ -213,11 +213,11 @@ public class TimeRangeResourceFactory {
        private TimeRangeEventResource createCpuResource(int newId,
                        long newStartTime, long newStopTime, String newName,
                        String newGroupName, String newClassName, ResourceTypes newType,
-                       Long newResourceId) {
+                       Long newResourceId, long insertionTime) {
 
                TimeRangeEventResource resource = new TimeRangeEventResource(newId,
                                newStartTime, newStopTime, newName, newGroupName, newClassName,
-                               newType, newResourceId) {
+                               newType, newResourceId, insertionTime) {
 
                        @Override
                        public String getStateMode(LttngTraceState traceSt) {
index 01a2ecd70ec152b9b30d3c7a3665d69053aae3dd..c0716278d7400e49a039120dc1e3e4b8a03db6d5 100644 (file)
@@ -22,8 +22,8 @@ import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus;
 import org.eclipse.linuxtools.lttng.state.StateStrings.SoftIRQMode;\r
 import org.eclipse.linuxtools.lttng.state.StateStrings.TrapMode;\r
 import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider;\r
-import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
 import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent;\r
+import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;\r
 \r
 public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider {\r
        // ========================================================================\r
@@ -103,11 +103,16 @@ public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider {
        @Override\r
        public Map<String, String> getEventHoverToolTipInfo(ITimeEvent revent) {\r
                Map<String, String> toolTipEventMsgs = new HashMap<String, String>();\r
-               // No need for additional tooltip info\r
-               // if (revent instanceof TimeRangeEvent) {\r
-                       // toolTipEventMsgs.put("Test Tip1", "Test Value tip1");\r
-                       // toolTipEventMsgs.put("Test Tip2", "Test Value tip2");\r
-               // }\r
+               //if the selected resource is a Process, add the Process type to the tool tip\r
+               if (revent instanceof TimeRangeComponent) {\r
+                       ITimeRangeComponent parent = ((TimeRangeComponent) revent)\r
+                                       .getEventParent();\r
+                       if (parent != null && parent instanceof TimeRangeEventProcess) {\r
+                               TimeRangeEventProcess localProcess = (TimeRangeEventProcess) parent;\r
+                               toolTipEventMsgs.put("Process Type", localProcess\r
+                                               .getProcessType());\r
+                       }\r
+               }\r
 \r
                return toolTipEventMsgs;\r
        }\r
@@ -197,7 +202,7 @@ public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider {
                procStateToColor.put(ProcessStatus.LTTV_STATE_DEAD.getInName(),\r
                                StateColor.BLACK);\r
                procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_FORK.getInName(),\r
-                               StateColor.GREEN);\r
+                               StateColor.DARK_GREEN);\r
                procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_CPU.getInName(),\r
                                StateColor.DARK_YELLOW);\r
                procStateToColor.put(ProcessStatus.LTTV_STATE_EXIT.getInName(),\r
index efbc02fdbef80c9059179e233e8965e998f473cb..f1757bedfd199db6ba33f9148f8f758368a6c5ec 100644 (file)
  *******************************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.common;
 
-import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.event.LttngEventContent;
-import org.eclipse.linuxtools.lttng.event.LttngEventField;
-import org.eclipse.linuxtools.lttng.state.StateStrings.Fields;
 import org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing;
+import org.eclipse.linuxtools.lttng.state.evProcessor.state.AbsStateProcessing;
 import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
-import org.eclipse.linuxtools.lttng.ui.TraceDebug;
-import org.eclipse.linuxtools.tmf.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
 
-public abstract class AbsTRangeUpdate implements IEventProcessing {
+public abstract class AbsTRangeUpdate extends AbsStateProcessing implements
+               IEventProcessing {
 
     private static final long MINORBITS = 20;
     
@@ -62,189 +58,6 @@ public abstract class AbsTRangeUpdate implements IEventProcessing {
             }
         }
         return pixPerNs;
-    }
-    
-    /**
-        * protected method used when only one Field is expected with Type "Long" if
-        * the number of fields is greater, the first field is returned and a
-        * tracing message is sent Null is returned if the value could not be
-        * extracted.
-        * 
-        * @param trcEvent
-        * @param traceSt
-        * @param expectedNumFields
-        * @return
-        */
-       protected Long getDField(LttngEvent trcEvent, LttngTraceState traceSt,
-                       Fields expectedField) {
-               Long fieldVal = null;
-               TmfEventField[] fields = trcEvent.getContent().getFields();
-               String[] fieldLabels = trcEvent.getContent().getFormat().getLabels();
-
-               // Only one field expected
-               if (fields.length != 1 || fieldLabels.length != 1) {
-                       StringBuilder sb = new StringBuilder(
-                                       "Unexpected number of fields received: " + fields.length
-                                                       + " for Event: " + trcEvent.getMarkerName()
-                                                       + "\n\t\tFields: ");
-
-                       for (TmfEventField field : fields) {
-                               sb.append(((LttngEventField) field).getName() + " ");
-                       }
-
-                       TraceDebug.debug(sb.toString());
-                       if (fields.length == 0) {
-                               return null;
-                       }
-               }
-
-               LttngEventField field = (LttngEventField) fields[0];
-               String fieldname = field.getName();
-               String expectedFieldName = expectedField.getInName();
-               if (fieldname.equals(expectedFieldName)) {
-                       Object fieldObj = field.getValue();
-                       if (fieldObj instanceof Long) {
-                               // Expected value found
-                               fieldVal = (Long) field.getValue();
-                       } else {
-                               if (TraceDebug.isDEBUG()) {
-                                       TraceDebug
-                                                       .debug("Unexpected field Type. Expected: Long, Received: "
-                                                                       + fieldObj.getClass().getSimpleName());
-                               }
-                               return null;
-                       }
-               } else {
-                       TraceDebug.debug("Unexpected field received: " + fieldname
-                                       + " Expected: " + expectedFieldName);
-                       return null;
-               }
-
-               return fieldVal;
-       }
-
-       /**
-        * protected method used when a Field is requested among several available
-        * fields and the expected type is Long
-        * 
-        * @param trcEvent
-        * @param traceSt
-        * @param expectedNumFields
-        * @return
-        */
-       protected Long getAFieldLong(LttngEvent trcEvent, LttngTraceState traceSt,
-                       Fields expectedField) {
-               Long fieldVal = null;
-               TmfEventField[] fields = ((LttngEventContent) trcEvent.getContent())
-                               .getFields(trcEvent);
-
-               // At least one field expected
-               if (fields.length == 0) {
-                       TraceDebug.debug("Unexpected number of fields received: "
-                                       + fields.length);
-                       return null;
-               }
-
-               LttngEventField field;
-               String fieldname;
-               String expectedFieldName = expectedField.getInName();
-               for (int i = 0; i < fields.length; i++) {
-                       field = (LttngEventField) fields[i];
-                       fieldname = field.getName();
-                       if (fieldname.equals(expectedFieldName)) {
-                               Object fieldObj = field.getValue();
-                               if (fieldObj instanceof Long) {
-                                       // Expected value found
-                                       fieldVal = (Long) field.getValue();
-                                       // if (expectedField == Fields.LTT_FIELD_TYPE) {
-                                       // TraceDebug.debug("Field Type value is: " + fieldVal);
-                                       // }
-                                       break;
-                               } else {
-                                       if (TraceDebug.isDEBUG()) {
-                                               TraceDebug
-                                                               .debug("Unexpected field Type. Expected: Long, Received: "
-                                                                               + fieldObj.getClass().getSimpleName());
-                                       }
-                                       return null;
-                               }
-                       }
-               }
-
-               if (fieldVal == null) {
-                       if (TraceDebug.isDEBUG()) {
-                               sendNoFieldFoundMsg(fields, expectedFieldName);
-                       }
-               }
-               return fieldVal;
-       }
-
-       /**
-        * protected method used when a Field is requested among several available
-        * fields and the expected type is String
-        * 
-        * @param trcEvent
-        * @param traceSt
-        * @param expectedNumFields
-        * @return
-        */
-       protected String getAFieldString(LttngEvent trcEvent,
-                       LttngTraceState traceSt, Fields expectedField) {
-               String fieldVal = null;
-
-               TmfEventField[] fields = ((LttngEventContent) trcEvent.getContent())
-                               .getFields(trcEvent);
-
-               // Only one field expected
-               if (fields.length == 0) {
-                       TraceDebug.debug("Unexpected number of fields received: "
-                                       + fields.length);
-                       return null;
-               }
-
-               LttngEventField field;
-               String fieldname;
-               String expectedFieldName = expectedField.getInName();
-               for (int i = 0; i < fields.length; i++) {
-                       field = (LttngEventField) fields[i];
-                       fieldname = field.getName();
-                       if (fieldname.equals(expectedFieldName)) {
-                               Object fieldObj = field.getValue();
-                               if (fieldObj instanceof String) {
-                                       // Expected value found
-                                       fieldVal = (String) field.getValue();
-                                       break;
-                               } else {
-                                       if (TraceDebug.isDEBUG()) {
-                                               TraceDebug
-                                                               .debug("Unexpected field Type. Expected: String, Received: "
-                                                                               + fieldObj.getClass().getSimpleName());
-                                       }
-                                       return null;
-                               }
-                       }
-               }
-
-               if (fieldVal == null) {
-                       if (TraceDebug.isDEBUG()) {
-                               sendNoFieldFoundMsg(fields, expectedFieldName);
-                       }
-               }
-               return fieldVal;
        }
 
-       protected void sendNoFieldFoundMsg(TmfEventField[] fields,
-                       String expectedFieldName) {
-               LttngEventField field;
-               StringBuilder sb = new StringBuilder("Field not found, requested: "
-                               + expectedFieldName);
-               sb.append(" number of fields: " + fields.length + "Fields: ");
-               for (int i = 0; i < fields.length; i++) {
-                       field = (LttngEventField) fields[i];
-                       sb.append(field.getName() + " ");
-               }
-
-               TraceDebug.debug(sb.toString(), 5);
-       }
-       
 }
\ No newline at end of file
index 5d0bdec3a2df27daefe955c90c86ba838b5211fa..6d0ff65c2b8ac2468c8d8bc7189fe884c8200109 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.linuxtools.lttng.state.experiment.StateManagerFactory;
 import org.eclipse.linuxtools.lttng.ui.TraceDebug;
 import org.eclipse.linuxtools.lttng.ui.views.common.DataRequestState.RequestState;
 import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.signal.TmfSignalHandler;
 import org.eclipse.linuxtools.tmf.ui.views.TmfView;
 
@@ -98,15 +99,13 @@ public abstract class AbsTimeUpdateView extends TmfView implements
         * processingCompleted(org.eclipse.linuxtools.lttng.state.StateDataRequest)
         */
        @TmfSignalHandler
-       public void processingCompleted(RequestCompletedSignal signal) {
+       public synchronized void processingCompleted(RequestCompletedSignal signal) {
                StateDataRequest request = signal.getRequest();
 
                if (request == null) {
                        return;
                } else {
-                       synchronized (this) {
-                               reqState.setCurrentRequest(null);
-                       }
+                       reqState.setCurrentRequest(null);
 
                }
 
@@ -152,11 +151,19 @@ public abstract class AbsTimeUpdateView extends TmfView implements
                                currentRequest = reqState.getCurrentRequest();
                                if (currentRequest != null) {
                                        currentRequest.cancel();
+                               } else {
+                                       TraceDebug
+                                                       .debug("Exception : State busy but current request is null");
                                }
                        } else {
                                // Set the state to busy
                                reqState.setState(DataRequestState.RequestState.BUSY);
                                waitCursor(true);
+                               if (TraceDebug.isDEBUG()) {
+                                       TraceDebug
+                                                       .debug("Requesting data: " + trange.getStartTime()
+                                                                       + "-" + trange.getEndTime());
+                               }
                                // no request is ongoing, proceed with request
                                StateManagerFactory.getExperimentManager()
                                                .readExperimentTimeWindow(trange, viewID, this);
@@ -174,10 +181,18 @@ public abstract class AbsTimeUpdateView extends TmfView implements
                TmfTimeRange queuedRequest = reqState.popQueued();
                if (queuedRequest != null) {
                        // Trigger the pending request
+                       if (TraceDebug.isDEBUG()) {
+                               TmfTimestamp start = queuedRequest.getStartTime();
+                               TmfTimestamp end = queuedRequest.getEndTime();
+                               TraceDebug.debug("New request about to start: " + start + "-"
+                                               + end);
+                       }
+
                        StateManagerFactory.getExperimentManager()
                                        .readExperimentTimeWindow(queuedRequest, viewID, this);
                } else {
                        // All requests cancelled and no more pending requests
+                       TraceDebug.debug("No requests pending in the queue");
                        reqState.setState(RequestState.IDLE);
                        waitCursor(false);
                }
index 0d5e5cdfa87cfe78eabbc2ee3ca83d7601c900c6..6a1fee4855d2b6581e80b9e7e7ac15584acd24eb 100644 (file)
@@ -72,7 +72,8 @@ public class DataRequestState {
                        if (this.queued != null) {
                                StringBuilder sb = new StringBuilder(
                                                "Queued request replaced from: "
-                                                               + queued.getStartTime() + "-"
+
+                                               + queued.getStartTime() + "-"
                                                                + queued.getEndTime() + "\n\t\t to: "
                                                                + nqueued.getStartTime() + "-"
                                                                + nqueued.getEndTime());
index 46f0d49db77d29a5c63b696a3709a90761879a96..e176d30db805ffa86848df2969687f81447fc820 100644 (file)
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.lttng.ui.views.common;
 import org.eclipse.linuxtools.lttng.event.LttngTimestamp;
 import org.eclipse.linuxtools.lttng.ui.TraceDebug;
 import org.eclipse.linuxtools.tmf.event.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
 import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeScaleSelectionEvent;
 
 /**
@@ -115,16 +116,18 @@ public class ParamsUpdater {
                        width = dwidth;
 
                        pixelsPerNs = (double) width / (double) (endTime - startTime);
-                       trange = new TmfTimeRange(new LttngTimestamp(startTime),
-                                       new LttngTimestamp(endTime));
+
+                       TmfTimestamp fTimeStart = new LttngTimestamp(startTime);
+                       TmfTimestamp fTimeEnd = new LttngTimestamp(endTime);
+                       trange = new TmfTimeRange(fTimeStart, fTimeEnd);
 
                        // update succeeded
                        updated = true;
 
                        TraceDebug.debug("Configuration updated to: StartTime: " /* */
-                                       + startTime /* */
-                                       + " endTime: " /* */
-                                       + endTime /* */
+                                       + fTimeStart /* */
+                                       + "-" /* */
+                                       + fTimeEnd /* */
                                        + " width: " /* */
                                        + width + " k: " + pixelsPerNs); /* */
                } else {
index e280578fdc3fe91ea2fc90da9fe2b6eb5ca8ddb5..86aadb32e23c6510267d87a6d4de4925b5a02ed0 100644 (file)
@@ -1205,7 +1205,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements
                                                        + discardedOutofOrder);
 
                        sb.append("\n\t\tRequested Time Range: " + range.getStartTime()
-                                       + " - " + range.getEndTime());
+                                       + "-" + range.getEndTime());
                        TraceDebug.debug(sb.toString());
                }
        }
index 39c87745f4abeaeb1dd8fe739f19db7db9f325f9..eeec2ee04390725813c9879f94ddea51f8966e62 100644 (file)
@@ -10,7 +10,6 @@
  *******************************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;
 
-import java.util.List;
 import java.util.Vector;
 
 import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus;
@@ -41,10 +40,12 @@ public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements IEv
        // Methods
        // =======================================================================
        protected TimeRangeEventProcess addLocalProcess(LttngProcessState stateProcess, long traceStartTime, long traceEndTime, String traceId) {
-               // TimeRangeEventProcess localProcess = new TimeRangeEventProcess(id, name, startTime, stopTime, groupName, className);
-               TimeRangeEventProcess localProcess = new TimeRangeEventProcess(procContainer.bookProcId(), stateProcess.getName(),traceStartTime, 
-                                                                              traceEndTime, "", stateProcess.getType().getInName(), stateProcess.getCpu()
-                                                                             );
+               // TimeRangeEventProcess localProcess = new TimeRangeEventProcess(id, name, startTime, stopTime, groupName, className)
+               TimeRangeEventProcess localProcess = new TimeRangeEventProcess(
+                               procContainer.bookProcId(), stateProcess.getName(),
+                               traceStartTime, traceEndTime, "", stateProcess.getType()
+                                               .getInName(), stateProcess.getCpu(), stateProcess
+                                               .getInsertion_time().getValue());
                localProcess.setCreationTime(stateProcess.getCreation_time().getValue());
                localProcess.setPid(stateProcess.getPid());
                localProcess.setTgid(stateProcess.getTgid());
@@ -88,39 +89,6 @@ public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements IEv
 
                return false;
        }
-       
-       /**
-        * Find the process matching the given pid and cpu
-        * 
-        * If cpu is 0, the cpu value is not matched and the selection is based on
-        * pid value only
-        * 
-        * @param ts
-        * @param cpu
-        * @param pid
-        * @return
-        */
-       protected LttngProcessState lttv_state_find_process(LttngTraceState ts,
-                       Long cpu, Long pid) {
-               // Define the return value
-               LttngProcessState process = null;
-
-               // Obtain the list of available processes
-               List<LttngProcessState> processList = ts.getProcesses();
-
-               // find the process matching pid and cpu,
-               // TODO: This may need to be improved since the pid may be re-used and
-               // the creation time may need to be considered
-               for (LttngProcessState dprocess : processList) {
-                       if (dprocess.getPid().equals(pid)) {
-                               if (dprocess.getCpu().equals(cpu) || cpu.longValue() == 0L) {
-                                       return dprocess;
-                               }
-                       }
-               }
-
-               return process;
-       }
 
        /**
         * @param traceSt
index 9b9fe9af1f6f957366b3e9a634aacc353644e356..514f7a7c9360e7828894013d732c08da2c22e41d 100644 (file)
@@ -55,10 +55,6 @@ class FlowTRangeAfterUpdateHandlers {
                                //Long pid_out = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_PREV_PID);
                                Long pid_in = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_NEXT_PID);
                                
-                               // *** VERIFY ***
-                               // LTTV modify tracefile context with pid_in... should we do something with that?
-                               // tfc->target_pid = pid_in;
-                               
                                if ( !(pid_in.equals(process_in.getPid())) ) {
                                    TraceDebug.debug("pid_in != PID!  (getSchedChangeHandler)");
                 }
@@ -72,16 +68,19 @@ class FlowTRangeAfterUpdateHandlers {
                            localProcess = addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
                                        }
                                        else {
-                                           TraceDebug.debug("pid_in is 0 or pid_in != PPID!  (getSchedChangeHandler)");
+                                               TraceDebug
+                                                               .debug("pid_in is not 0 or pid_in == PPID!  (getSchedChangeHandler)");
                                        }
                                }
-                               
-                               // *** VERIFY ***
-                               // We doesn't seem to be doing anything about this C call... should we?
-                               //process_list->current_hash_data[trace_num][process_in->cpu] = hashed_process_data_in;
-                               
-                               // *** VERIFY ***
-                               // There doesn't seem to be any drawing done by the below C code ??
+
+                               // There is no drawing done by the C code below, only refreshing
+                               // the references to the current hash data to make it ready for
+                               // next event
+
+                               // This current implementation does not support the use of
+                               // current hashed data
+                               // although an equivalent would be good in order to improve the
+                               // time to find the currently running process per cpu.
                                /*
                                if(ltt_time_compare(hashed_process_data_in->next_good_time, evtime) <= 0)
                                {
@@ -144,62 +143,22 @@ class FlowTRangeAfterUpdateHandlers {
                                
                                if ( localProcess == null ) {
                                    if ( (child_pid == 0) || (child_pid != process_child.getPpid()) ) {            
-                                       // *** VERIFY ***
-                                       // What am I supposed to do with that?
-                                       //   Drawing_t *drawing = control_flow_data->drawing;
-                                       //   ProcessInfo *process_info;
-                                       //   gtk_widget_set_size_request(drawing->drawing_area, -1, pl_height);
-                                       //   gtk_widget_queue_draw(drawing->drawing_area);
                                        TmfTimeRange timeRange = traceSt.getInputDataRef().getTraceTimeWindow();
                             localProcess = addLocalProcess(process_child, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
                                    }
                                    else {
                                        TraceDebug.debug("localProcess is null with child_pid not 0 or child_pid equals PPID (getProcessForkHandler)");
                                    }
-                               }
-                               else {
-                                   // If we found the process, the Ppid and the Tgid might be missing, let's add them
-                                   localProcess.setPpid(process_child.getPpid());
-                                   localProcess.setTgid(process_child.getTgid());
-                                   
+                                       } else {
+                                               // If we found the process, the Ppid and the Tgid might
+                                               // be missing, let's add them
+                                               localProcess.setPpid(process_child.getPpid());
+                                               localProcess.setTgid(process_child.getTgid());
                                }
                            }
                            else {
                                TraceDebug.debug("process_child is null! (getProcessForkHandler)");
                            }
-                
-                           // *** VERIFY ***
-                           // We don't need any of those, do we?
-                           //
-                           //if(likely(ltt_time_compare(hashed_process_data_child->next_good_time,evtime) <= 0))
-                   //  {
-                   //    TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab);
-                           //
-                   //    #ifdef EXTRA_CHECK
-                   //    if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1)
-                   //       return FALSE;
-                   //    #endif //EXTRA_CHECK
-                   //    
-                   //    Drawing_t *drawing = control_flow_data->drawing;
-                   //    guint width = drawing->width;
-                   //    guint new_x;
-                   //    convert_time_to_pixels(time_window,evtime,width,&new_x);
-                           //
-                   //    if(likely(hashed_process_data_child->x.over != new_x)) {
-                   //      hashed_process_data_child->x.over = new_x;
-                   //      hashed_process_data_child->x.over_used = FALSE;
-                   //      hashed_process_data_child->x.over_marked = FALSE;
-                   //    }
-                   //    if(likely(hashed_process_data_child->x.middle != new_x)) {
-                   //      hashed_process_data_child->x.middle = new_x;
-                   //      hashed_process_data_child->x.middle_used = FALSE;
-                   //      hashed_process_data_child->x.middle_marked = FALSE;
-                   //    }
-                   //    if(likely(hashed_process_data_child->x.under != new_x)) {
-                   //      hashed_process_data_child->x.under = new_x;
-                   //      hashed_process_data_child->x.under_used = FALSE;
-                   //      hashed_process_data_child->x.under_marked = FALSE;
-                   //    }
                      
                                return false;
                        }
@@ -234,6 +193,7 @@ class FlowTRangeAfterUpdateHandlers {
                                
                                        // *** TODO: ***
                                        // We shall look into a way to find the current process
+                                       // faster, see the c library
                                        // (current_hash) in order to speed up the find. see c-code
                                //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
                            //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
@@ -248,51 +208,12 @@ class FlowTRangeAfterUpdateHandlers {
                                    else {
                                        TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExitHandler)");
                                    }
-                               }
-                               else {
-                                   // *** FIXME ***
-                        // I feel like we are missing something here... what are we suppose to do with that?
-                        //   process_list->current_hash_data[trace_num][process->cpu] = hashed_process_data;
-                               }
-                        
+                                       }
                            }
                            else {
                                TraceDebug.debug("process is null! (getProcessExitHandler)");
                            }                       
                            
-                           // *** VERIFY ***
-                // We don't need any of those, do we?
-                //
-                //if(likely(ltt_time_compare(hashed_process_data_child->next_good_time,evtime) <= 0))
-                //  {
-                //    TimeWindow time_window = lttvwindow_get_time_window(control_flow_data->tab);
-                //
-                //    #ifdef EXTRA_CHECK
-                //    if(ltt_time_compare(evtime, time_window.start_time) == -1 || ltt_time_compare(evtime, time_window.end_time) == 1)
-                //       return FALSE;
-                //    #endif //EXTRA_CHECK
-                //    
-                //    Drawing_t *drawing = control_flow_data->drawing;
-                //    guint width = drawing->width;
-                //    guint new_x;
-                //    convert_time_to_pixels(time_window,evtime,width,&new_x);
-                //
-                //    if(likely(hashed_process_data_child->x.over != new_x)) {
-                //      hashed_process_data_child->x.over = new_x;
-                //      hashed_process_data_child->x.over_used = FALSE;
-                //      hashed_process_data_child->x.over_marked = FALSE;
-                //    }
-                //    if(likely(hashed_process_data_child->x.middle != new_x)) {
-                //      hashed_process_data_child->x.middle = new_x;
-                //      hashed_process_data_child->x.middle_used = FALSE;
-                //      hashed_process_data_child->x.middle_marked = FALSE;
-                //    }
-                //    if(likely(hashed_process_data_child->x.under != new_x)) {
-                //      hashed_process_data_child->x.under = new_x;
-                //      hashed_process_data_child->x.under_used = FALSE;
-                //      hashed_process_data_child->x.under_marked = FALSE;
-                //    }
-                           
                                return false;
                        }
 
@@ -325,22 +246,10 @@ class FlowTRangeAfterUpdateHandlers {
 
                 if ( process != null ) {
                     
-                    // *** VERIFY ***
-                    // This make no sense in our java implementation and should be ignored, right?
-                    //
-                    //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
-                    //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
-                    //   }
                     TimeRangeEventProcess localProcess = procContainer.findProcess(process.getPid(), process.getCreation_time().getValue(), traceSt.getTraceId());
                     
                     if ( localProcess == null ) {
                         if ( (process.getPid() == 0) || (process.getPid() != process.getPpid()) ) {
-                            // *** VERIFY ***
-                            // What am I supposed to do with that?
-                            //   Drawing_t *drawing = control_flow_data->drawing;
-                            //   ProcessInfo *process_info;
-                            //   gtk_widget_set_size_request(drawing->drawing_area, -1, pl_height);
-                            //   gtk_widget_queue_draw(drawing->drawing_area);
                             TmfTimeRange timeRange = traceSt.getInputDataRef().getTraceTimeWindow();
                             localProcess = addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
                         }
@@ -351,10 +260,6 @@ class FlowTRangeAfterUpdateHandlers {
                     else {
                         // If we found the process, the name might be missing. Let's add it here.
                         localProcess.setName(process.getName());
-                        
-                        // *** FIXME ***
-                        // I feel like we are missing something here... what are we suppose to do with that?
-                        //   process_list->current_hash_data[trace_num][process->cpu] = hashed_process_data;
                     }
                 }
                 else {
@@ -392,9 +297,8 @@ class FlowTRangeAfterUpdateHandlers {
 
                 if ( process != null ) {
                     
-                    // *** VERIFY ***
-                    // This make no sense in our java implementation and should be ignored, right?
-                    //
+                                       // Similar to above comments, implement a faster way to find
+                                       // the local process
                     //   if(likely(process_list->current_hash_data[trace_num][cpu] != NULL) ){
                     //        hashed_process_data = process_list->current_hash_data[trace_num][cpu];
                     //   }
@@ -402,12 +306,6 @@ class FlowTRangeAfterUpdateHandlers {
                     
                     if ( localProcess == null ) {
                         if ( (process.getPid() == 0) || (process.getPid() != process.getPpid()) ) {                         
-                            // *** VERIFY ***
-                            // What am I supposed to do with that?
-                            //   Drawing_t *drawing = control_flow_data->drawing;
-                            //   ProcessInfo *process_info;
-                            //   gtk_widget_set_size_request(drawing->drawing_area, -1, pl_height);
-                            //   gtk_widget_queue_draw(drawing->drawing_area);
                             TmfTimeRange timeRange = traceSt.getInputDataRef().getTraceTimeWindow();
                             localProcess = addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
                         }
@@ -416,12 +314,9 @@ class FlowTRangeAfterUpdateHandlers {
                         }
                     }
                     else {
-                        // If we foubd the process, the brand might be missing on it, add it.
+                                               // If we found the process, the brand might be missing
+                                               // on it, add it.
                         localProcess.setBrand(process.getBrand());
-                        
-                        // *** FIXME ***
-                        // I feel like we are missing something here... what are we suppose to do with that?
-                        //   process_list->current_hash_data[trace_num][process->cpu] = hashed_process_data;
                     }
                 }
                 else {
@@ -440,17 +335,21 @@ class FlowTRangeAfterUpdateHandlers {
                return handler;
        }
 
-
        /**
         * <p>
         * LTT_EVENT_PROCESS_STATE
         * </p>
         * Replace C function "after_event_enum_process_hook" in eventhooks.c
         * <p>
-        * * <p>
-     * Fields: LTT_FIELD_NEXT_PID
-     * </p>
-     * 
+        * <p>
+        * Creates the processlist entry for the child process. Put the last
+        * position in x at the current time value.
+        * </p>
+        * 
+        * <p>
+        * Fields: LTT_FIELD_PID
+        * </p>
+        * 
         * @return
         */
        final IEventProcessing getEnumProcessStateHandler() {
@@ -464,9 +363,8 @@ class FlowTRangeAfterUpdateHandlers {
                                int first_cpu;
                                int nb_cpus;
                            
-                           // *** VERIFY ***
-                           // We want the pid_in... we assume the pid_in is the next pid, as we get on the CPU, right?
-                           Long pid_in = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_NEXT_PID);
+                               Long pid_in = getAFieldLong(trcEvent, traceSt,
+                                               Fields.LTT_FIELD_PID);
                            
                 // Lttv assume that pid_in will NEVER be null or incoherent
                 // What if ... ?    (let's add some debug)
@@ -488,11 +386,6 @@ class FlowTRangeAfterUpdateHandlers {
                            
                                    if (localProcess == null) {
                                            if ( (process_in.getPid() == 0) || (process_in.getPid() != process_in.getPpid()) ) {
-                                    // *** VERIFY ***
-                                    // What am I supposed to do with that?
-                                       //    Drawing_t *drawing = control_flow_data->drawing;
-                                       //    gtk_widget_set_size_request(drawing->drawing_area,-1,pl_height);
-                                       //    gtk_widget_queue_draw(drawing->drawing_area);
                                     TmfTimeRange timeRange = traceSt.getInputDataRef().getTraceTimeWindow();
                                     localProcess = addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId());
                                 }
index f94b93986e83eca9523d8f1faad9f4afe5415c1a..c381ea6006e0c5abebe6d5fdde2ce032de44cd2c 100644 (file)
@@ -11,6 +11,8 @@
  *******************************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;
 
+import java.util.List;
+
 import org.eclipse.linuxtools.lttng.event.LttngEvent;
 import org.eclipse.linuxtools.lttng.state.StateStrings.Events;
 import org.eclipse.linuxtools.lttng.state.StateStrings.Fields;
@@ -79,7 +81,7 @@ class FlowTRangeBeforeUpdateHandlers {
                                                        stateProcess, localProcess, params);
                                } else {
                                        TraceDebug
-                                                       .debug("Running process is null! (getStateModesHandler)");
+                                                       .debug("Running state process is null! (getStateModesHandler)");
                                }
 
                                return false;
@@ -137,8 +139,10 @@ class FlowTRangeBeforeUpdateHandlers {
                                        }
 
                                        if (process != null) {
-                                               // ***VERIFY***
-                                               // Is this call really replace these two C lines ??
+                                               // TODO: Implement something similar to current hash in
+                                               // order to keep track of the current process and speed
+                                               // up finding the local resource.
+
                                                // HashedProcessData *hashed_process_data = NULL;
                                                // hashed_process_data =
                                                // processlist_get_process_data(process_list,pid_out,process->cpu,&birth,trace_num);
@@ -169,12 +173,11 @@ class FlowTRangeBeforeUpdateHandlers {
                                                // TraceDebug.debug("Process is null for pid_out! (getBeforeSchedChangeHandler)");
                                        }
 
+                                       // PID_IN section
                                        process = lttv_state_find_process(traceSt, trcEvent
                                                        .getCpuId(), pid_in);
 
                                        if (process != null) {
-                                               // ***VERIFY***
-                                               // Is this call really replace these two C lines ??
                                                // HashedProcessData *hashed_process_data = NULL;
                                                // hashed_process_data =
                                                // processlist_get_process_data(process_list, pid_in,
@@ -247,15 +250,10 @@ class FlowTRangeBeforeUpdateHandlers {
                                                trcEvent.getCpuId());
 
                                if (process != null) {
-                                       // *** FIXME ***
-                                       // This C call does not seem to be possible, as we have no
-                                       // "current_process" in LttngTraceState
-                                       // hashed_process_data =
-                                       // process_list->current_hash_data[trace_num][cpu];
+                                       // TODO: Implement a similar method to track the current
+                                       // local process in order to speed up finding the local
+                                       // resource
 
-                                       // ***VERIFY***
-                                       // Is this call really replace these two C lines ??
-                                       // HashedProcessData *hashed_process_data = NULL;
                                        // hashed_process_data =
                                        // processlist_get_process_data(process_list, pid,
                                        // process->cpu, &birth,trace_num);
@@ -271,22 +269,17 @@ class FlowTRangeBeforeUpdateHandlers {
                                        // trace_num, process->name, process->brand,&pl_height,
                                        // &process_info, &hashed_process_data);
                                        if (localProcess == null) {
-                                               if ((process.getPid() == 0)
-                                                               || (process.getPid() != process.getPpid())) {
-                                                       TmfTimeRange timeRange = traceSt.getInputDataRef()
-                                                                       .getTraceTimeWindow();
-                                                       localProcess = addLocalProcess(process, timeRange
-                                                                       .getStartTime().getValue(), timeRange
-                                                                       .getEndTime().getValue(), traceSt
-                                                                       .getTraceId());
-                                                       // Call the function that does the actual drawing
-                                                       makeDraw(traceSt, trcEvent.getTimestamp()
-                                                                       .getValue(), process, localProcess, params);
-                                               } else {
-                                                       TraceDebug
-                                                                       .debug("Pid is null or Pid == PPID!  (getProcessExitHandler)");
-                                               }
+                                               TmfTimeRange timeRange = traceSt.getInputDataRef()
+                                                               .getTraceTimeWindow();
+                                               localProcess = addLocalProcess(process, timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId());
                                        }
+
+                                       // Call the function that does the actual drawing
+                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                       process, localProcess, params);
+
                                } else {
                                        TraceDebug
                                                        .debug("Running process is null! (getProcessExitHandler)");
@@ -391,37 +384,38 @@ class FlowTRangeBeforeUpdateHandlers {
                                //
                                // And the draw is always the same then...
 
-                               LttngProcessState process = null;
-                               for (int proc_id = 0; proc_id < traceSt.getProcesses().size(); proc_id++) {
-                                       process = lttv_state_find_process(traceSt, traceSt
-                                                       .getProcesses().get(proc_id).getCpu(), traceSt
-                                                       .getProcesses().get(proc_id).getPid());
+                               // The c-library loops through the local processes, search for
+                               // the local processes in the state provider and then draws
+                               // If it's present is the local processes why shuldn't they be
+                               // present in the state provider?
+                               // This seems more direct. and makes sure all processes are
+                               // reflected in the control flow view.
+                               List<LttngProcessState> processes = traceSt.getProcesses();
+                               for (LttngProcessState process : processes) {
+                                       // Replace the C call :
+                                       // hashed_process_data =
+                                       // processlist_get_process_data(process_list,pid,process->cpu,&birth,trace_num);
+                                       TimeRangeEventProcess localProcess = procContainer
+                                                       .findProcess(process.getPid(), process
+                                                                       .getCreation_time().getValue(), traceSt
+                                                                       .getTraceId());
 
-                                       if (process != null) {
-                                               // Replace the C call :
-                                               // hashed_process_data =
-                                               // processlist_get_process_data(process_list,pid,process->cpu,&birth,trace_num);
-                                               TimeRangeEventProcess localProcess = procContainer
-                                                               .findProcess(process.getPid(), process
-                                                                               .getCreation_time().getValue(), traceSt
-                                                                               .getTraceId());
-                                               if (localProcess != null) {
-                                                       // Call the function that will does the actual
-                                                       // drawing
-                                                       makeDraw(traceSt, trcEvent.getTimestamp()
-                                                                       .getValue(), process, localProcess, params);
-                                               } else {
-                                                       TraceDebug
-                                                                       .debug("localProcess is null! (getStateDumpEndHandler)");
-                                               }
-                                       } else {
-                                               TraceDebug
-                                                               .debug("Process is null! (getStateDumpEndHandler)");
+                                       // Add process to process list if not present
+                                       if (localProcess == null) {
+                                               TmfTimeRange timeRange = traceSt.getInputDataRef()
+                                                               .getTraceTimeWindow();
+                                               localProcess = addLocalProcess(process, timeRange
+                                                               .getStartTime().getValue(), timeRange
+                                                               .getEndTime().getValue(), traceSt.getTraceId());
                                        }
+
+                                       // Call the function that will does the actual
+                                       // drawing
+                                       makeDraw(traceSt, trcEvent.getTimestamp().getValue(),
+                                                       process, localProcess, params);
                                }
 
                                return false;
-
                        }
 
                        // @Override
index b3ec0f2e1aba524f1df268498e1511ca8cd64c24..18573f77a23adfe09e832dbf5d8bb68fdc2824ac 100644 (file)
@@ -110,6 +110,9 @@ public class FlowProcessContainer {
                        String traceID) {
                TimeRangeEventProcess rprocess = null;
 
+               // TODO: This needs a more efficient way to find, e.g. use class with
+               // hash code base on the keys trace, pid and creation time the class
+               // should also override the equals to valid the search via the hashcode
                for (TimeRangeEventProcess process : processes) {
                        if (process.getPid().equals(pid)) {
                                if (process.getCreationTime().equals(creationtime)) {
index d2fcc7eeab539255b1342fa45f23357fd5a1a613..198016a34293e17437e563eb2167bacc5689e4c0 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.swt.dnd.DropTargetAdapter;
  */
 public class TraceDropTarget extends DropTargetAdapter {
 
+       @SuppressWarnings("unused")
        private final TreeViewer fViewer;
 
        /**
index 663e752227bffba63306950bbacf269cb8a1cec5..46a84c82268b84ed7c8e51174f524b50a1cdc9bb 100644 (file)
@@ -35,6 +35,7 @@ public class DeleteExperimentActionDelegate implements IWorkbenchWindowActionDel
        @SuppressWarnings("unused")
        private IWorkbenchWindow fWindow;
        private IStructuredSelection fSelection;
+       @SuppressWarnings("unused")
        private LTTngExperimentEntry fEntry;
 
        /**
index 02f6d6b27977a7065fb676982edf377870ee4f6c..192a91cb549aee3ec426b0f325632c36f4fc1846 100644 (file)
@@ -35,6 +35,7 @@ public class DeleteTraceActionDelegate implements IWorkbenchWindowActionDelegate
        @SuppressWarnings("unused")
        private IWorkbenchWindow fWindow;
        private IStructuredSelection fSelection;
+       @SuppressWarnings("unused")
        private LTTngTraceEntry fEntry;
 
        /**
index 77fd5cf144c70f0633da6eb6a2f24685cb407c3d..e0110d9a3c26fba3f458abfe053a75bce52d39c2 100644 (file)
  *******************************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
 
-import java.util.List;
 import java.util.Vector;
 
 import org.eclipse.linuxtools.lttng.event.LttngEvent;
 import org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing;
-import org.eclipse.linuxtools.lttng.state.model.LttngProcessState;
 import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
 import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent;
 import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent;
@@ -45,16 +43,16 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
        // Methods
        // =======================================================================
        protected TimeRangeEventResource addLocalResource(long traceStartTime,
-                       long traceEndTime, String traceId, ResourceTypes type, Long resId) {
+                       long traceEndTime, String traceId, ResourceTypes type, Long resId,
+                       long insertionTime) {
 
                String resourceName = type.toString() + " " + resId.toString();
                // Note : the "traceid" here is assigned to the "groupname" as we group
                // by trace in the UI
                TimeRangeEventResource localRessource = TimeRangeResourceFactory
-                               .getInstance()
-                               .createResource(
-                               resContainer.getUniqueId(), traceStartTime, traceEndTime,
-                               resourceName, traceId, "", type, resId);
+                               .getInstance().createResource(resContainer.getUniqueId(),
+                                               traceStartTime, traceEndTime, resourceName, traceId,
+                                               "", type, resId, insertionTime);
                resContainer.addResource(localRessource);
                return localRessource;
        }
@@ -91,29 +89,6 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
                return false;
        }
 
-       public LttngProcessState lttv_state_find_process(
-                       LttngTraceState traceState, Long cpu, Long pid) {
-               // Define the return value
-               LttngProcessState returnedProcess = null;
-
-               // Obtain the list of available processes
-               List<LttngProcessState> processList = traceState.getProcesses();
-
-               int pos = 0;
-               while ((pos < processList.size()) && (returnedProcess == null)) {
-                       if (processList.get(pos).getPid().equals(pid)) {
-                               if ((processList.get(pos).getCpu().equals(cpu))
-                                               || (cpu.longValue() == 0L)) {
-                                       returnedProcess = processList.get(pos);
-                               }
-                       }
-
-                       pos++;
-               }
-
-               return returnedProcess;
-       }
-
        public TimeRangeEventResource resourcelist_obtain_bdev(
                        LttngTraceState traceState, Long resourceId) {
                return resourcelist_obtain_generic(resourceId, ResourceTypes.BDEV,
@@ -176,14 +151,14 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
                                        .getTraceTimeWindow();
                        localResource = addLocalResource(timeRange.getStartTime()
                                        .getValue(), timeRange.getEndTime().getValue(), traceSt
-                                       .getTraceId(), ResourceTypes.CPU, cpu);
+                                       .getTraceId(), ResourceTypes.CPU, cpu, trcEvent
+                                       .getTimestamp().getValue());
                }
 
                // get the start time
                long stime = localResource.getNext_good_time();
                // Get the resource state mode
-               String cpuStateMode = traceSt.getCpu_states().get(cpu)
-                               .peekFromCpuStack().getInName();
+               String cpuStateMode = localResource.getStateMode(traceSt);
                // Call the makeDraw function
                makeDraw(traceSt, stime, trcEvent.getTimestamp().getValue(),
                                localResource, params, cpuStateMode);
@@ -191,11 +166,15 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
                return false;
        }
 
-       // *** FIXME ***
-       // "stateMode" should NOT be a string, it is very confusing to use (can we
-       // use any string? what kind of string? can it be null??)
-       // It should be a "ProcessStatus" or "ExecutionMode". However this mean
-       // refactoring this part.
+       /**
+        * @param traceSt
+        * @param startTime
+        * @param endTime
+        * @param localResource
+        * @param params
+        * @param stateMode
+        * @return
+        */
        protected boolean makeDraw(LttngTraceState traceSt, long startTime,
                        long endTime, TimeRangeEventResource localResource,
                        ParamsUpdater params, String stateMode) {
@@ -269,11 +248,6 @@ public abstract class AbsResourcesTRangeUpdate extends AbsTRangeUpdate
 
                Type eventType = getEventType(localResource);
                if (eventType != null) {
-                       // Create the time-range event
-                       // *** VERIFY ***
-                       // This should replace this C call, right?
-                       // TimeWindow time_window =
-                       // lttvwindow_get_time_window(control_flow_data->tab);
                        TimeRangeEvent time_window = new TimeRangeEvent(stime, etime,
                                        localResource, eventType, stateMode);
 
index 3998f8d985e68081cc2f4f4cbc09e181d5aa09a7..3ac29a5bd525dedab6683096f7668b6802c7db42 100644 (file)
@@ -12,7 +12,6 @@
 package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
 
 import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.state.StateStrings;
 import org.eclipse.linuxtools.lttng.state.StateStrings.Channels;
 import org.eclipse.linuxtools.lttng.state.StateStrings.Events;
 import org.eclipse.linuxtools.lttng.state.StateStrings.Fields;
@@ -118,15 +117,15 @@ public class ResourcesTRangeBeforeUpdateHandlers {
                                                localResource = addLocalResource(timeRange
                                                                .getStartTime().getValue(), timeRange
                                                                .getEndTime().getValue(), traceSt.getTraceId(),
-                                                               ResourceTypes.IRQ, irqId);
+                                                               ResourceTypes.IRQ, irqId, trcEvent
+                                                                               .getTimestamp().getValue());
                                        }
 
                                        // get the start time
                                        long stime = localResource.getNext_good_time();
 
                                        // Get the resource state mode
-                                       String irqStateMode = traceSt.getIrq_states().get(irqId)
-                                                       .peekFromIrqStack().getInName();
+                                       String irqStateMode = localResource.getStateMode(traceSt);
 
                                        // Call the makeDraw function
                                        makeDraw(traceSt, stime,
@@ -210,28 +209,16 @@ public class ResourcesTRangeBeforeUpdateHandlers {
                                                localResource = addLocalResource(timeRange
                                                                .getStartTime().getValue(), timeRange
                                                                .getEndTime().getValue(), traceSt.getTraceId(),
-                                                               ResourceTypes.SOFT_IRQ, softIrqId);
+                                                               ResourceTypes.SOFT_IRQ, softIrqId, trcEvent
+                                                                               .getTimestamp().getValue());
                                        }
 
                                        // get the start time
                                        long stime = localResource.getNext_good_time();
+
                                        // Get the resource state mode
-                                       long running = traceSt.getSoft_irq_states().get(softIrqId)
-                                                       .getRunning().longValue();
-                                       long pending = traceSt.getSoft_irq_states().get(softIrqId)
-                                                       .getPending().longValue();
-
-                                       String softIrqStateMode;
-                                       if (running > 0) {
-                                               softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_BUSY
-                                                               .getInName();
-                                       } else if (pending > 0) {
-                                               softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_PENDING
-                                                               .getInName();
-                                       } else {
-                                               softIrqStateMode = StateStrings.SoftIRQMode.LTTV_SOFT_IRQ_IDLE
-                                                               .getInName();
-                                       }
+                                       String softIrqStateMode = localResource
+                                                       .getStateMode(traceSt);
 
                                        // Call the makeDraw function
                                        makeDraw(traceSt, stime,
@@ -330,20 +317,12 @@ public class ResourcesTRangeBeforeUpdateHandlers {
                                                localResource = addLocalResource(timeRange
                                                                .getStartTime().getValue(), timeRange
                                                                .getEndTime().getValue(), traceSt.getTraceId(),
-                                                               ResourceTypes.TRAP, trapId);
+                                                               ResourceTypes.TRAP, trapId, trcEvent
+                                                                               .getTimestamp().getValue());
                                        }
 
                                        // Determine the trap state.
-                                       long trapState = traceSt.getTrap_states().get(trapId)
-                                                       .getRunning().longValue();
-                                       String trapStateMode;
-                                       if (trapState == 0) {
-                                               trapStateMode = StateStrings.TrapMode.LTTV_TRAP_IDLE
-                                                               .getInName();
-                                       } else {
-                                               trapStateMode = StateStrings.TrapMode.LTTV_TRAP_BUSY
-                                                               .getInName();
-                                       }
+                                       String trapStateMode = localResource.getStateMode(traceSt);
 
                                        long stime = localResource.getNext_good_time();
                                        makeDraw(traceSt, stime,
@@ -409,14 +388,14 @@ public class ResourcesTRangeBeforeUpdateHandlers {
                                                        .getTraceTimeWindow();
                                        localResource = addLocalResource(timeRange.getStartTime()
                                                        .getValue(), timeRange.getEndTime().getValue(),
-                                                       traceSt.getTraceId(), ResourceTypes.BDEV, bdevId);
+                                                       traceSt.getTraceId(), ResourceTypes.BDEV, bdevId,
+                                                       trcEvent.getTimestamp().getValue());
                                }
 
                                // get the start time
                                long stime = localResource.getNext_good_time();
                                // Get the resource state mode
-                               String bdevStateMode = traceSt.getBdev_states().get(bdevId)
-                                               .peekFromBdevStack().getInName();
+                               String bdevStateMode = localResource.getStateMode(traceSt);
                                // Call the makeDraw function
                                makeDraw(traceSt, stime, trcEvent.getTimestamp().getValue(),
                                                localResource, params, bdevStateMode);
index 5e938907e20d3bb908ac3ceb3d4aa3b4c27c7ccc..16e105253541dd4031a19787df339276b8f65d1d 100644 (file)
@@ -210,12 +210,10 @@ public class ResourceContainer {
          newMap.clear();
                TimeRangeResourceFactory rfactory = TimeRangeResourceFactory
                                .getInstance();
-               TimeRangeEventResource tmpRes1 = rfactory
-                               .createResource(0, 0, 0, "name1", "trace1", "classname1",
-                                               ResourceTypes.CPU, 0L);
-               TimeRangeEventResource tmpRes2 = rfactory
-                               .createResource(0, 0, 0, "name2", "trace1", "classname2",
-                                               ResourceTypes.CPU, 0L);
+               TimeRangeEventResource tmpRes1 = rfactory.createResource(0, 0, 0,
+                               "name1", "trace1", "classname1", ResourceTypes.CPU, 0L, 0l);
+               TimeRangeEventResource tmpRes2 = rfactory.createResource(0, 0, 0,
+                               "name2", "trace1", "classname2", ResourceTypes.CPU, 0L, 0l);
          
          ResourceKey test3 = new ResourceKey(tmpRes1);
          ResourceKey test4 = new ResourceKey(tmpRes2);
index e87134ea8b2452530bb223a0ee47d9adb60cc2ef..7fd773cd73738582a6a3e7531765c53236c8d2e5 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: LTTng
 Bundle-SymbolicName: org.eclipse.linuxtools.lttng
-Bundle-Version: 0.0.1
+Bundle-Version: 0.1.0.qualifier
 Bundle-Activator: org.eclipse.linuxtools.lttng.LTTngCorePlugin
 Bundle-Vendor: Eclipse
 Require-Bundle: org.eclipse.core.runtime,
index cca485cc88510488e5e96c9eeda44dffaa8c90d6..62b93d6dbc2eda6e59d445c8a078ac5f7e547fed 100644 (file)
@@ -191,16 +191,17 @@ public class StateManager extends Observable {
                // Process request to that point
                StateDataRequest request = getDataRequestByTimeRange(trange, listener);
                // don't wait for completion i.e. allow cancellations
-               request.startRequestInd(fExperiment, false, true);
+               request.startRequestInd(fExperiment, false, false);
 
                if (TraceDebug.isDEBUG()) {
                        List<LttngProcessState> processes = stateIn.getTraceStateModel()
                                        .getProcesses();
-                       TraceDebug.debug(" Time Window requested: "
-                                       + trange.getStartTime().getValue() + "-"
-                                       + trange.getEndTime().getValue()
+                       TraceDebug
+                                       .debug(" Time Window requested, (start adjusted to checkpoint): "
+                                                       + trange.getStartTime()
+                                       + "-" + trange.getEndTime()
                                        + " Total number of processes in the State provider: "
-                                       + processes.size());
+                                       + processes.size() + " Completed");
                }
        }
 
index 1d8b11f44c9ea5bb6065f17ffc42654ad5a9acf6..f0c803e374d6b152b462772aec5df173c3b0c49d 100644 (file)
@@ -515,7 +515,7 @@ public class StateStrings {
        }
 
        public enum ProcessStatus {
-               LTTV_STATE_UNNAMED(""), LTTV_STATE_WAIT_FORK("WAIT_FORK"), /* */
+               LTTV_STATE_UNNAMED("UNNAMED"), LTTV_STATE_WAIT_FORK("WAIT_FORK"), /* */
                LTTV_STATE_WAIT_CPU("WAIT_CPU"), /* */
                LTTV_STATE_EXIT("EXIT"), /* */
                LTTV_STATE_ZOMBIE("ZOMBIE"), /* */
@@ -644,7 +644,7 @@ public class StateStrings {
        }
 
        /**
-        * @return the maping from int to softirq name
+        * @return the mapping from int to softirq name
         */
        public String[] getSoftIrqNames() {
                return soft_irq_names;
index 6126b9b24c2c58d755e760c9c743737af8454f86..30b66d65ac486ace5b35a18662fa2f96e9e62c3c 100644 (file)
@@ -3,6 +3,8 @@
  */
 package org.eclipse.linuxtools.lttng.state.evProcessor.state;
 
+import java.util.List;
+
 import org.eclipse.linuxtools.lttng.TraceDebug;
 import org.eclipse.linuxtools.lttng.event.LttngEvent;
 import org.eclipse.linuxtools.lttng.event.LttngEventContent;
@@ -30,29 +32,9 @@ public abstract class AbsStateProcessing {
         * @param expectedNumFields
         * @return
         */
-       protected Long getAFieldLong(LttngEvent trcEvent, LttngTraceState traceSt, Fields expectedField) {
-               Long fieldVal = 0L;
-               
-        String fieldname = expectedField.getInName();
-               LttngEventField field = ((LttngEventContent) trcEvent.getContent()).getField(fieldname);
-               
-               if ( field == null ) {
-                       TraceDebug.debug("***************** CONTENT : " + ((LttngEventContent) trcEvent.getContent()).toString());
-               }
-               else {
-            Object fieldObj = field.getValue();
-            if ( (fieldObj instanceof Long) || (fieldObj instanceof Integer) ) {
-                // Expected numeric value found
-                fieldVal = (Long) field.getValue();
-            } 
-            else {
-                if (TraceDebug.isDEBUG()) {
-                    TraceDebug.debug("Unexpected field Type. Expected: Long, Received: "+ fieldObj.getClass().getSimpleName());
-                }
-            }
-               }
-               
-               /*
+       protected Long getAFieldLong(LttngEvent trcEvent, LttngTraceState traceSt,
+                       Fields expectedField) {
+               Long fieldVal = null;
                // TmfEventField[] fields = trcEvent.getContent().getFields();
                TmfEventField[] fields = ((LttngEventContent) trcEvent.getContent())
                                .getFields(trcEvent);
@@ -89,13 +71,12 @@ public abstract class AbsStateProcessing {
                                }
                        }
                }
-               */
        
-//             if (fieldVal == null) {
-//                     if (TraceDebug.isDEBUG()) {
-//                             sendNoFieldFoundMsg(((LttngEventContent) trcEvent.getContent()).getFields(), fieldname);
-//                     }
-//             }
+               if (fieldVal == null) {
+                       if (TraceDebug.isDEBUG()) {
+                               sendNoFieldFoundMsg(fields, expectedFieldName);
+                       }
+               }
                return fieldVal;
        }
 
@@ -110,28 +91,7 @@ public abstract class AbsStateProcessing {
         */
        protected String getAFieldString(LttngEvent trcEvent,
                        LttngTraceState traceSt, Fields expectedField) {
-               String fieldVal = "";
-               
-               String fieldname = expectedField.getInName();
-        LttngEventField field = ((LttngEventContent) trcEvent.getContent()).getField(fieldname);
-        
-               if ( field == null ) {
-                       TraceDebug.debug("***************** CONTENT : " + ((LttngEventContent) trcEvent.getContent()).toString());
-               }
-               else {
-               Object fieldObj = field.getValue();
-               if (fieldObj instanceof String) {
-                   // Expected numeric value found
-                   fieldVal = (String) field.getValue();
-               } 
-               else {
-                   if (TraceDebug.isDEBUG()) {
-                       TraceDebug.debug("Unexpected field Type. Expected: String, Received: "+ fieldObj.getClass().getSimpleName());
-                   }
-               }
-               }
-               
-               /*
+               String fieldVal = null;
                // TmfEventField[] fields = trcEvent.getContent().getFields();
                TmfEventField[] fields = ((LttngEventContent) trcEvent.getContent())
                                .getFields(trcEvent);
@@ -165,13 +125,12 @@ public abstract class AbsStateProcessing {
                                }
                        }
                }
-           */
-           
-//        if (fieldVal == null) {
-//            if (TraceDebug.isDEBUG()) {
-//                sendNoFieldFoundMsg(((LttngEventContent) trcEvent.getContent()).getFields(), fieldname);
-//            }
-//        }
+       
+               if (fieldVal == null) {
+                       if (TraceDebug.isDEBUG()) {
+                               sendNoFieldFoundMsg(fields, expectedFieldName);
+                       }
+               }
                return fieldVal;
        }
 
@@ -187,9 +146,29 @@ public abstract class AbsStateProcessing {
         * @return
         */
        protected LttngProcessState lttv_state_find_process(
-                                                       LttngTraceState traceState, Long cpu, Long pid) {
+                       LttngTraceState traceState, Long cpu, Long pid) {
+               // Define the return value
+               LttngProcessState returnedProcess = null;
+
+               // Obtain the list of available processes
+               List<LttngProcessState> processList = traceState.getProcesses();
+
+               // FIXME: This needs be more efficient e.g. introduce a class with a
+               // overriden hash and equals to consider the key values pid, cpu and
+               // traceid and iterate over a collection of this new type.
+               int pos = 0;
+               while ((pos < processList.size()) && (returnedProcess == null)) {
+                       if (processList.get(pos).getPid().equals(pid)) {
+                               if ((processList.get(pos).getCpu().equals(cpu))
+                                               || (cpu.longValue() == 0L)) {
+                                       returnedProcess = processList.get(pos);
+                               }
+                       }
+
+                       pos++;
+               }
 
-               return traceState.findProcessState(pid, cpu, traceState.getTraceId());
+               return returnedProcess;
        }
 
        protected void sendNoFieldFoundMsg(TmfEventField[] fields,
@@ -200,7 +179,7 @@ public abstract class AbsStateProcessing {
                sb.append(" number of fields: " + fields.length + "Fields: ");
                for (int i = 0; i < fields.length; i++) {
                        field = (LttngEventField) fields[i];
-                       sb.append(field.getId() + " ");
+                       sb.append(field.getName() + " ");
                }
        
                TraceDebug.debug(sb.toString(), 5);
index cd7f12dcfde130434663deb60f847507311a5d79..2a7eb8695bb33fd57a653e3b695424e5511247d3 100644 (file)
  *******************************************************************************/
 package org.eclipse.linuxtools.lttng.state.evProcessor.state;
 
-import java.util.List;
 
 import org.eclipse.linuxtools.lttng.TraceDebug;
 import org.eclipse.linuxtools.lttng.event.LttngEvent;
-import org.eclipse.linuxtools.lttng.event.LttngEventField;
 import org.eclipse.linuxtools.lttng.state.StateStrings;
-import org.eclipse.linuxtools.lttng.state.StateStrings.Fields;
+import org.eclipse.linuxtools.lttng.state.StateStrings.ExecutionMode;
 import org.eclipse.linuxtools.lttng.state.StateStrings.IRQMode;
 import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus;
 import org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing;
@@ -27,10 +25,10 @@ import org.eclipse.linuxtools.lttng.state.model.LttngExecutionState;
 import org.eclipse.linuxtools.lttng.state.model.LttngIRQState;
 import org.eclipse.linuxtools.lttng.state.model.LttngProcessState;
 import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
-import org.eclipse.linuxtools.tmf.event.TmfEventField;
 import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
 
-public abstract class AbsStateUpdate implements IEventProcessing {
+public abstract class AbsStateUpdate extends AbsStateProcessing implements
+               IEventProcessing {
 
        // ========================================================================
        // Data
@@ -51,7 +49,6 @@ public abstract class AbsStateUpdate implements IEventProcessing {
                exe_state.setChange_Time(eventTime);
                exe_state.setCum_cpu_time(0L);
                exe_state.setProc_status(process.getState().getProc_status());
-               process.setState(exe_state);
                process.pushToExecutionStack(exe_state);
        }
 
@@ -69,8 +66,8 @@ public abstract class AbsStateUpdate implements IEventProcessing {
                        return;
                }
 
+               //The process state is updated within the pop method
                process.popFromExecutionStack();
-               process.setState(process.peekFromExecutionStack());
                process.getState().setChange_Time(eventTime);
        }
 
@@ -158,185 +155,6 @@ public abstract class AbsStateUpdate implements IEventProcessing {
        // ========================================================================
        // General methods
        // =======================================================================
-       /**
-        * protected method used when only one Field is expected with Type "Long" if
-        * the number of fields is greater, the first field is returned and a
-        * tracing message is sent Null is returned if the value could not be
-        * extracted.
-        * 
-        * @param trcEvent
-        * @param traceSt
-        * @param expectedNumFields
-        * @return
-        */
-       protected Long getDField(LttngEvent trcEvent, LttngTraceState traceSt,
-                       Fields expectedField) {
-               Long fieldVal = null;
-               TmfEventField[] fields = trcEvent.getContent().getFields();
-               String[] fieldLabels = trcEvent.getContent().getFormat().getLabels();
-
-               // Only one field expected
-               if (fields.length != 1 || fieldLabels.length != 1) {
-                       StringBuilder sb = new StringBuilder(
-                                       "Unexpected number of fields received: " + fields.length
-                                                       + " for Event: " + trcEvent.getMarkerName() + "\n\t\tFields: ");
-
-                       for (TmfEventField field : fields) {
-                               sb.append(((LttngEventField)field).getName() + " ");                            
-                       }
-
-                       TraceDebug.debug(sb.toString());
-                       if (fields.length == 0) {
-                               return null;
-                       }
-               }
-
-               LttngEventField field = (LttngEventField) fields[0];
-               String fieldname = field.getName();
-               String expectedFieldName = expectedField.getInName();
-               if (fieldname.equals(expectedFieldName)) {
-                       Object fieldObj = field.getValue();
-                       if (fieldObj instanceof Long) {
-                               // Expected value found
-                               fieldVal = (Long) field.getValue();
-                       } else {
-                               if (TraceDebug.isDEBUG()) {
-                                       TraceDebug
-                                                       .debug("Unexpected field Type. Expected: Long, Received: "
-                                                                       + fieldObj.getClass().getSimpleName());
-                               }
-                               return null;
-                       }
-               } else {
-                       TraceDebug.debug("Unexpected field received: " + fieldname
-                                       + " Expected: " + expectedFieldName);
-                       return null;
-               }
-
-               return fieldVal;
-       }
-
-       /**
-        * protected method used when a Field is requested among several available
-        * fields and the expected type is Long
-        * 
-        * @param trcEvent
-        * @param traceSt
-        * @param expectedNumFields
-        * @return
-        */
-       protected Long getAFieldLong(LttngEvent trcEvent, LttngTraceState traceSt,
-                       Fields expectedField) {
-               Long fieldVal = null;
-               TmfEventField[] fields = trcEvent.getContent().getFields();
-
-               // At least one field expected
-               if (fields.length == 0) {
-                       TraceDebug.debug("Unexpected number of fields received: "
-                                       + fields.length);
-                       return null;
-               }
-
-               LttngEventField field;
-               String fieldname;
-               String expectedFieldName = expectedField.getInName();
-               for (int i = 0; i < fields.length; i++) {
-                       field = (LttngEventField) fields[i];
-                       fieldname = field.getName();
-                       if (fieldname.equals(expectedFieldName)) {
-                               Object fieldObj = field.getValue();
-                               if (fieldObj instanceof Long) {
-                                       // Expected value found
-                                       fieldVal = (Long) field.getValue();
-                                       // if (expectedField == Fields.LTT_FIELD_TYPE) {
-                                       // TraceDebug.debug("Field Type value is: " + fieldVal);
-                                       // }
-                                       break;
-                               } else {
-                                       if (TraceDebug.isDEBUG()) {
-                                               TraceDebug
-                                                               .debug("Unexpected field Type. Expected: Long, Received: "
-                                                                               + fieldObj.getClass().getSimpleName());
-                                       }
-                                       return null;
-                               }
-                       }
-               }
-
-               if (fieldVal == null) {
-                       if (TraceDebug.isDEBUG()) {
-                               sendNoFieldFoundMsg(fields, expectedFieldName);
-                       }
-               }
-               return fieldVal;
-       }
-
-       /**
-        * protected method used when a Field is requested among several available
-        * fields and the expected type is String
-        * 
-        * @param trcEvent
-        * @param traceSt
-        * @param expectedNumFields
-        * @return
-        */
-       protected String getAFieldString(LttngEvent trcEvent,
-                       LttngTraceState traceSt, Fields expectedField) {
-               String fieldVal = null;
-               TmfEventField[] fields = trcEvent.getContent().getFields();
-
-               // Only one field expected
-               if (fields.length == 0) {
-                       TraceDebug.debug("Unexpected number of fields received: "
-                                       + fields.length);
-                       return null;
-               }
-
-               LttngEventField field;
-               String fieldname;
-               String expectedFieldName = expectedField.getInName();
-               for (int i = 0; i < fields.length; i++) {
-                       field = (LttngEventField) fields[i];
-                       fieldname = field.getName();
-                       if (fieldname.equals(expectedFieldName)) {
-                               Object fieldObj = field.getValue();
-                               if (fieldObj instanceof String) {
-                                       // Expected value found
-                                       fieldVal = (String) field.getValue();
-                                       break;
-                               } else {
-                                       if (TraceDebug.isDEBUG()) {
-                                               TraceDebug
-                                                               .debug("Unexpected field Type. Expected: String, Received: "
-                                                                               + fieldObj.getClass().getSimpleName());
-                                       }
-                                       return null;
-                               }
-                       }
-               }
-
-               if (fieldVal == null) {
-                       if (TraceDebug.isDEBUG()) {
-                               sendNoFieldFoundMsg(fields, expectedFieldName);
-                       }
-               }
-               return fieldVal;
-       }
-
-       protected void sendNoFieldFoundMsg(TmfEventField[] fields,
-                       String expectedFieldName) {
-               LttngEventField field;
-               StringBuilder sb = new StringBuilder("Field not found, requested: "
-                               + expectedFieldName);
-               sb.append(" number of fields: " + fields.length + "Fields: ");
-               for (int i = 0; i < fields.length; i++) {
-                       field = (LttngEventField) fields[i];
-                       sb.append(field.getName() + " ");
-               }
-
-               TraceDebug.debug(sb.toString(), 5);
-       }
-
        // Adaption from MKDEV macro
        protected Long mkdev(Long major, Long minor) {
                Long result = null;
@@ -349,7 +167,7 @@ public abstract class AbsStateUpdate implements IEventProcessing {
        /*
         * FIXME : this function should be called when we receive an event telling
         * that release_task has been called in the kernel. In happens generally
-        * when the parent waits for its child terminaison, but may also happen in
+        * when the parent waits for its child termination, but may also happen in
         * special cases in the child's exit : when the parent ignores its children
         * SIGCCHLD or has the flag SA_NOCLDWAIT. It can also happen when the child
         * is part of a killed thread group, but isn't the leader.
@@ -371,59 +189,6 @@ public abstract class AbsStateUpdate implements IEventProcessing {
                return true;
        }
 
-       /**
-        * Find the process matching the given pid and cpu
-        * 
-        * If cpu is 0, the cpu value is not matched and the selection is based on
-        * pid value only
-        * 
-        * @param ts
-        * @param cpu
-        * @param pid
-        * @return
-        */
-       protected LttngProcessState lttv_state_find_process(LttngTraceState ts,
-                       Long cpu, Long pid) {
-               // Define the return value
-               LttngProcessState process = null;
-
-               // Obtain the list of available processes
-               List<LttngProcessState> processList = ts.getProcesses();
-
-               // find the process matching pid and cpu,
-               // TODO: This may need to be improved since the pid may be re-used and
-               // the creation time may need to be considered.
-               // NOTE: A hash search shall be used
-               for (LttngProcessState dprocess : processList) {
-                       if (dprocess.getPid().equals(pid)) {
-                               if (dprocess.getCpu().equals(cpu) || cpu.longValue() == 0L) {
-                                       return dprocess;
-                               }
-                       }
-               }
-
-               return process;
-       }
-
-       /**
-        * @param ts
-        * @param cpu
-        * @param pid
-        * @param timestamp
-        *            , Used when a new process is needed
-        * @return
-        */
-       protected LttngProcessState lttv_state_find_process_or_create(
-                       LttngTraceState ts, Long cpu, Long pid, final TmfTimestamp timestamp) {
-
-               LttngProcessState process = lttv_state_find_process(ts, cpu, pid);
-               /* Put ltt_time_zero creation time for unexisting processes */
-               if (process == null) {
-                       process = create_process(ts, cpu, pid, 0L, timestamp);
-               }
-               return process;
-       }
-
        /**
         * @param traceSt
         * @param cpu
@@ -457,4 +222,29 @@ public abstract class AbsStateUpdate implements IEventProcessing {
                return process;
        }
 
+       /**
+        * @param ts
+        * @param cpu
+        * @param pid
+        * @param timestamp
+        *            , Used when a new process is needed
+        * @return
+        */
+       protected LttngProcessState lttv_state_find_process_or_create(
+                       LttngTraceState ts, Long cpu, Long pid, final TmfTimestamp timestamp) {
+       
+               LttngProcessState process = lttv_state_find_process(ts, cpu, pid);
+               /* Put ltt_time_zero creation time for non existing processes */
+               if (process == null) {
+                       process = create_process(ts, cpu, pid, 0L, timestamp);
+                       // leave only one entry in the execution stack
+                       process.popFromExecutionStack();
+                       LttngExecutionState es = process.getState();
+                       es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN);
+                       es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED);
+               }
+       
+               return process;
+       }
+
 }
\ No newline at end of file
index 8b649b8ccce9fbd42949d1b66b8ac6ab5c39f84b..b36af501c6e8b0bc7126745290d019bc4cad65ed 100644 (file)
@@ -500,14 +500,14 @@ class StateUpdateHandlers {
                                Long irq = getAFieldLong(trcEvent, traceSt,
                                                Fields.LTT_FIELD_IRQ_ID);
 
-                               if (action != null) {
+                               if (action == null) {
                                        TraceDebug.debug("Field Action not found in event "
                                                        + eventType.getInName() + " time: "
                                                        + trcEvent.getTimestamp());
                                        return true;
                                }
 
-                               if (irq != null) {
+                               if (irq == null) {
                                        TraceDebug.debug("Field irq_id not found in event "
                                                        + eventType.getInName() + " time: "
                                                        + trcEvent.getTimestamp());
@@ -1166,9 +1166,6 @@ class StateUpdateHandlers {
                                        exState.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL);
                                        process.clearExecutionStack();
                                        process.pushToExecutionStack(exState);
-
-                                       // update the process state to the only one in the stack
-                                       process.setState(exState);
                                }
 
                                process.setType(ProcessType.LTTV_STATE_KERNEL_THREAD);
@@ -1501,7 +1498,7 @@ class StateUpdateHandlers {
                                                        es.setEntry_Time(timestamp);
                                                        es.setChange_Time(timestamp);
                                                        es.setCum_cpu_time(0L);
-                                                       es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED);
+                                                       es.setProc_status(ProcessStatus.LTTV_STATE_WAIT);
 
                                                        // Push the new state to the stack
                                                        process.pushToExecutionStack(es);
@@ -1558,10 +1555,10 @@ class StateUpdateHandlers {
 
                                Long typeVal = getAFieldLong(trcEvent, traceSt,
                                                Fields.LTT_FIELD_TYPE);
+
+                               type = ProcessType.LTTV_STATE_KERNEL_THREAD.getInName();
                                if ((typeVal != null) && (typeVal.longValue() == 0L)) {
                                        type = ProcessType.LTTV_STATE_USER_THREAD.getInName();
-                               } else {
-                                       type = ProcessType.LTTV_STATE_KERNEL_THREAD.getInName();
                                }
 
                                // /* mode */
@@ -1631,69 +1628,14 @@ class StateUpdateHandlers {
                                                         * cause expected interrupt when being syscall.
                                                         * (only before end of statedump event)
                                                         */
+                                                       // process type is USER_THREAD by default.
                                                        process
                                                                        .setType(ProcessType.LTTV_STATE_KERNEL_THREAD);
 
-                                                       // #if 0
-                                                       // es->t = LTTV_STATE_SYSCALL;
-                                                       // es->s = status;
-                                                       // es->n = submode;
-                                                       // #endif //0
-                                               } else {
-                                                       /*
-                                                        * User space process : bottom : user mode either
-                                                        * currently running or scheduled out. can be
-                                                        * scheduled out because interrupted in (user mode
-                                                        * or in syscall) or because of an explicit call to
-                                                        * the scheduler in syscall. Note that the scheduler
-                                                        * call comes after the irq_exit, so never in
-                                                        * interrupt context.
-                                                        */
-                                                       // temp workaround : set size to 1 : only have user
-                                                       // mode
-                                                       // bottom of stack.
-                                                       // will cause g_info message of expected syscall
-                                                       // mode when
-                                                       // in fact being
-                                                       // in user mode. Can also cause expected trap when
-                                                       // in fact
-                                                       // being user
-                                                       // mode in the event of a page fault reenabling
-                                                       // interrupts
-                                                       // in the handler.
-                                                       // Expected syscall and trap can also happen after
-                                                       // the end
-                                                       // of statedump
-                                                       // This will cause a
-                                                       // "popping last state on stack, ignoring it."
-
-                                                       // process->execution_stack =
-                                                       // g_array_set_size(process->execution_stack, 1);
-                                                       // es = process->state =
-                                                       // &g_array_index(process->execution_stack,
-                                                       // LttvExecutionState, 0);
-                                                       // a new process must have only one state in the
-                                                       // stack and
-                                                       // be the same as the current state
-                                                       // es = process.getState();
-                                                       // es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN);
-                                                       // es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED);
-                                                       // es
-                                                       // .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN
-                                                       // .getInName());
-
-                                                       // #if 0
-                                                       // es->t = LTTV_STATE_USER_MODE;
-                                                       // es->s = status;
-                                                       // es->n = submode;
-                                                       // #endif //0
                                                }
-                                               // TODO: clean up comments above: Moved repeated code
-                                               // from both
-                                               // if / else blocks above,
-                                               // comments left temporarily for easier visualization
-                                               // and
-                                               // comparision with c code
+                                               
+                                               //Only one entry needed in the execution stack
+                                               process.popFromExecutionStack();
                                                es = process.getState();
                                                es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN);
                                                es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED);
index 8f8e067ad6df212f5e2ca1a44127af1a0cfdf0e6..3081ef892f5f2487e256e61aeb7d2f8b432e5380 100644 (file)
@@ -84,26 +84,27 @@ public class LttngProcessState implements Cloneable {
                setCreation_time(new TmfTimestamp());
                this.free_events = 0L;
 
-               // Initialize stack
+               // Initialise stack
                LttngExecutionState es = new LttngExecutionState();
-               es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN);
+               es.setExec_mode(ExecutionMode.LTTV_STATE_USER_MODE);
                es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName());
                es.setEntry_Time(this.insertion_time);
                es.setChange_Time(this.insertion_time);
                es.setCum_cpu_time(0L);
                es.setProc_status(ProcessStatus.LTTV_STATE_RUN);
                this.execution_stack.push(es);
-               
-               //TODO: This initialisation is present in C, however an entry in waiting fork may
-               //display incorrect states, there is a need for deeper compare of the initialisation phase
-               // es = new LttngExecutionState();
-               // es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL);
-               // es.setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE.getInName());
-               // es.setEntry_Time(this.insertion_time);
-               // es.setChange_Time(this.insertion_time);
-               // es.setCum_cpu_time(0L);
-               // es.setProc_status(ProcessStatus.LTTV_STATE_WAIT_FORK);
-               // this.execution_stack.push(es);
+
+               //This second entry is needed when processes are created via a Fork event.
+               es = new LttngExecutionState();
+               es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL);
+               es
+                               .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE
+                                               .getInName());
+               es.setEntry_Time(this.insertion_time);
+               es.setChange_Time(this.insertion_time);
+               es.setCum_cpu_time(0L);
+               es.setProc_status(ProcessStatus.LTTV_STATE_WAIT_FORK);
+               this.execution_stack.push(es);
                
                // point state to the top of the stack
                this.state = es;
@@ -462,6 +463,7 @@ public class LttngProcessState implements Cloneable {
     
     public void pushToExecutionStack(LttngExecutionState newState) {
         execution_stack.push(newState);
+               setState(newState);
     }
     
     public LttngExecutionState popFromExecutionStack() {
@@ -470,7 +472,10 @@ public class LttngProcessState implements Cloneable {
             return null;
         }
         else {
-           return execution_stack.pop();
+                       LttngExecutionState popedState = execution_stack.pop();
+                       // adjust current state to the new top
+                       setState(peekFromExecutionStack());
+                       return popedState;
        }
     }
     
index 395534a17ef65393463ee20be0576c4bc75dc1f4..816655bde57c1243f5401d6d540aacc9d9a7d51e 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: TMF UI
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ui
-Bundle-Version: 0.0.1
+Bundle-Version: 0.1.0.qualifier
 Bundle-Activator: org.eclipse.linuxtools.tmf.ui.TmfUiPlugin
 Bundle-Vendor: Eclipse
 Require-Bundle: org.eclipse.ui,
index 34d2e4d2dad529ceaeb953bfcdb63c51d69ffed2..c6baffa001e48a64ffe2d54d92beb7378b70f108 100644 (file)
@@ -1,4 +1,5 @@
 source.. = src/
 output.. = bin/
 bin.includes = META-INF/,\
-               .
+               .,\
+               icons/
index e186545c8a781eca25dafd8f327ce315210a522f..b3ff2c9d7c530d089437c86b4e55a611d8ecb3d9 100644 (file)
@@ -2,12 +2,11 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: TMF
 Bundle-SymbolicName: org.eclipse.linuxtools.tmf
-Bundle-Version: 0.0.1
+Bundle-Version: 0.1.0.qualifier
 Bundle-Activator: org.eclipse.linuxtools.tmf.TmfCorePlugin
 Bundle-Vendor: Eclipse
 Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.junit4
+ org.eclipse.core.runtime
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy
 Import-Package: org.junit.runner
This page took 0.062905 seconds and 5 git commands to generate.