From: Francois Chouinard Date: Thu, 8 Oct 2009 14:13:06 +0000 (+0000) Subject: [219097] LTTng updates X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=63eecb47906c2d10c8348fba21209b7aeddc04eb;p=deliverable%2Ftracecompass.git [219097] LTTng updates --- diff --git a/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF index bd241d02a6..e73faadbe1 100644 --- a/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF @@ -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, diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java index 428d9070c0..9bd391cf7c 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeComposite.java @@ -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; } } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java index c2604b891e..66dab7927e 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java @@ -40,9 +40,11 @@ public class TimeRangeEventProcess extends TimeRangeComposite implements * @param className */ public TimeRangeEventProcess(int id, String name, long startTime, - long stopTime, String groupName, String className, Long cpu) { + long stopTime, String groupName, String className, Long cpu, + long insertionTime) { - super(id, startTime, stopTime, name, CompositeType.PROCESS); + super(id, startTime, stopTime, name, CompositeType.PROCESS, + insertionTime); this.cpu = cpu; } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java index 04102f5a30..b7a417ae9a 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventResource.java @@ -49,10 +49,11 @@ public abstract class TimeRangeEventResource extends TimeRangeComposite */ public TimeRangeEventResource(int newId, long newStartTime, long newStopTime, String newName, String newGroupName, - String newClassName, ResourceTypes newType, Long newResourceId) { + String newClassName, ResourceTypes newType, Long newResourceId, + long insertionTime) { super(newId, newStartTime, newStopTime, newName, newGroupName, - newClassName, CompositeType.RESOURCE); + newClassName, CompositeType.RESOURCE, insertionTime); type = newType; resourceId = newResourceId; diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java index abf1d7cffd..6c95c518c4 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeResourceFactory.java @@ -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) { diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java index 01a2ecd70e..c0716278d7 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java @@ -22,8 +22,8 @@ import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus; import org.eclipse.linuxtools.lttng.state.StateStrings.SoftIRQMode; import org.eclipse.linuxtools.lttng.state.StateStrings.TrapMode; import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.TmfTimeAnalysisProvider; -import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry; import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent; +import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry; public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider { // ======================================================================== @@ -103,11 +103,16 @@ public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider { @Override public Map getEventHoverToolTipInfo(ITimeEvent revent) { Map toolTipEventMsgs = new HashMap(); - // No need for additional tooltip info - // if (revent instanceof TimeRangeEvent) { - // toolTipEventMsgs.put("Test Tip1", "Test Value tip1"); - // toolTipEventMsgs.put("Test Tip2", "Test Value tip2"); - // } + //if the selected resource is a Process, add the Process type to the tool tip + if (revent instanceof TimeRangeComponent) { + ITimeRangeComponent parent = ((TimeRangeComponent) revent) + .getEventParent(); + if (parent != null && parent instanceof TimeRangeEventProcess) { + TimeRangeEventProcess localProcess = (TimeRangeEventProcess) parent; + toolTipEventMsgs.put("Process Type", localProcess + .getProcessType()); + } + } return toolTipEventMsgs; } @@ -197,7 +202,7 @@ public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider { procStateToColor.put(ProcessStatus.LTTV_STATE_DEAD.getInName(), StateColor.BLACK); procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_FORK.getInName(), - StateColor.GREEN); + StateColor.DARK_GREEN); procStateToColor.put(ProcessStatus.LTTV_STATE_WAIT_CPU.getInName(), StateColor.DARK_YELLOW); procStateToColor.put(ProcessStatus.LTTV_STATE_EXIT.getInName(), diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java index efbc02fdbe..f1757bedfd 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTRangeUpdate.java @@ -10,17 +10,13 @@ *******************************************************************************/ 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 diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java index 5d0bdec3a2..6d0ff65c2b 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java @@ -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); } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/DataRequestState.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/DataRequestState.java index 0d5e5cdfa8..6a1fee4855 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/DataRequestState.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/DataRequestState.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java index 46f0d49db7..e176d30db8 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java @@ -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 { diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java index e280578fdc..86aadb32e2 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java @@ -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()); } } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java index 39c87745f4..eeec2ee043 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/AbsFlowTRangeUpdate.java @@ -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 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 diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeAfterUpdateHandlers.java index 9b9fe9af1f..514f7a7c93 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeAfterUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeAfterUpdateHandlers.java @@ -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; } - /** *

* LTT_EVENT_PROCESS_STATE *

* Replace C function "after_event_enum_process_hook" in eventhooks.c *

- * *

- * Fields: LTT_FIELD_NEXT_PID - *

- * + *

+ * Creates the processlist entry for the child process. Put the last + * position in x at the current time value. + *

+ * + *

+ * Fields: LTT_FIELD_PID + *

+ * * @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()); } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeBeforeUpdateHandlers.java index f94b93986e..c381ea6006 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeBeforeUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowTRangeBeforeUpdateHandlers.java @@ -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 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 diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java index b3ec0f2e1a..18573f77a2 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/model/FlowProcessContainer.java @@ -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)) { diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/TraceDropTarget.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/TraceDropTarget.java index d2fcc7eeab..198016a342 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/TraceDropTarget.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/TraceDropTarget.java @@ -22,6 +22,7 @@ import org.eclipse.swt.dnd.DropTargetAdapter; */ public class TraceDropTarget extends DropTargetAdapter { + @SuppressWarnings("unused") private final TreeViewer fViewer; /** diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteExperimentActionDelegate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteExperimentActionDelegate.java index 663e752227..46a84c8226 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteExperimentActionDelegate.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteExperimentActionDelegate.java @@ -35,6 +35,7 @@ public class DeleteExperimentActionDelegate implements IWorkbenchWindowActionDel @SuppressWarnings("unused") private IWorkbenchWindow fWindow; private IStructuredSelection fSelection; + @SuppressWarnings("unused") private LTTngExperimentEntry fEntry; /** diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteTraceActionDelegate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteTraceActionDelegate.java index 02f6d6b279..192a91cb54 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteTraceActionDelegate.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/actions/DeleteTraceActionDelegate.java @@ -35,6 +35,7 @@ public class DeleteTraceActionDelegate implements IWorkbenchWindowActionDelegate @SuppressWarnings("unused") private IWorkbenchWindow fWindow; private IStructuredSelection fSelection; + @SuppressWarnings("unused") private LTTngTraceEntry fEntry; /** diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java index 77fd5cf144..e0110d9a3c 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/AbsResourcesTRangeUpdate.java @@ -11,12 +11,10 @@ *******************************************************************************/ 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 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); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesTRangeBeforeUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesTRangeBeforeUpdateHandlers.java index 3998f8d985..3ac29a5bd5 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesTRangeBeforeUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/evProcessor/ResourcesTRangeBeforeUpdateHandlers.java @@ -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); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java index 5e938907e2..16e1052535 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/model/ResourceContainer.java @@ -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); diff --git a/org.eclipse.linuxtools.lttng/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.lttng/META-INF/MANIFEST.MF index e87134ea8b..7fd773cd73 100644 --- a/org.eclipse.linuxtools.lttng/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.lttng/META-INF/MANIFEST.MF @@ -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, diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateManager.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateManager.java index cca485cc88..62b93d6dbc 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateManager.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateManager.java @@ -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 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"); } } diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateStrings.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateStrings.java index 1d8b11f44c..f0c803e374 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateStrings.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/StateStrings.java @@ -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; diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateProcessing.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateProcessing.java index 6126b9b24c..30b66d65ac 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateProcessing.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateProcessing.java @@ -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 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); diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java index cd7f12dcfd..2a7eb8695b 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/AbsStateUpdate.java @@ -11,13 +11,11 @@ *******************************************************************************/ 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 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 diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java index 8b649b8ccc..b36af501c6 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/evProcessor/state/StateUpdateHandlers.java @@ -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); diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java index 8f8e067ad6..3081ef892f 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/state/model/LttngProcessState.java @@ -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; } } diff --git a/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF index 395534a17e..816655bde5 100644 --- a/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF @@ -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, diff --git a/org.eclipse.linuxtools.tmf.ui/build.properties b/org.eclipse.linuxtools.tmf.ui/build.properties index 34d2e4d2da..c6baffa001 100644 --- a/org.eclipse.linuxtools.tmf.ui/build.properties +++ b/org.eclipse.linuxtools.tmf.ui/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + icons/ diff --git a/org.eclipse.linuxtools.tmf/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf/META-INF/MANIFEST.MF index e186545c8a..b3ff2c9d7c 100644 --- a/org.eclipse.linuxtools.tmf/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.tmf/META-INF/MANIFEST.MF @@ -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