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,
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;
}
// ========================================================================
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;
}
}
* @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
*/\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
// ========================================================================
// 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;
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) {
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) {
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) {
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) {
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) {
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
@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
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
*******************************************************************************/
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;
}
}
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
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;
* 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);
}
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);
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);
}
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());
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;
/**
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 {
+ discardedOutofOrder);
sb.append("\n\t\tRequested Time Range: " + range.getStartTime()
- + " - " + range.getEndTime());
+ + "-" + range.getEndTime());
TraceDebug.debug(sb.toString());
}
}
*******************************************************************************/
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;
// 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());
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
//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)");
}
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)
{
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;
}
// *** 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];
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;
}
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());
}
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 {
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];
// }
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());
}
}
}
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 {
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() {
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)
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());
}
*******************************************************************************/
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;
stateProcess, localProcess, params);
} else {
TraceDebug
- .debug("Running process is null! (getStateModesHandler)");
+ .debug("Running state process is null! (getStateModesHandler)");
}
return false;
}
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);
// 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,
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);
// 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)");
//
// 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
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)) {
*/
public class TraceDropTarget extends DropTargetAdapter {
+ @SuppressWarnings("unused")
private final TreeViewer fViewer;
/**
@SuppressWarnings("unused")
private IWorkbenchWindow fWindow;
private IStructuredSelection fSelection;
+ @SuppressWarnings("unused")
private LTTngExperimentEntry fEntry;
/**
@SuppressWarnings("unused")
private IWorkbenchWindow fWindow;
private IStructuredSelection fSelection;
+ @SuppressWarnings("unused")
private LTTngTraceEntry fEntry;
/**
*******************************************************************************/
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;
// 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;
}
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,
.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);
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) {
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);
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;
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,
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,
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,
.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);
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);
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,
// 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");
}
}
}
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"), /* */
}
/**
- * @return the maping from int to softirq name
+ * @return the mapping from int to softirq name
*/
public String[] getSoftIrqNames() {
return soft_irq_names;
*/
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;
* @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);
}
}
}
- */
-// if (fieldVal == null) {
-// if (TraceDebug.isDEBUG()) {
-// sendNoFieldFoundMsg(((LttngEventContent) trcEvent.getContent()).getFields(), fieldname);
-// }
-// }
+ if (fieldVal == null) {
+ if (TraceDebug.isDEBUG()) {
+ sendNoFieldFoundMsg(fields, expectedFieldName);
+ }
+ }
return fieldVal;
}
*/
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);
}
}
}
- */
-
-// if (fieldVal == null) {
-// if (TraceDebug.isDEBUG()) {
-// sendNoFieldFoundMsg(((LttngEventContent) trcEvent.getContent()).getFields(), fieldname);
-// }
-// }
+
+ if (fieldVal == null) {
+ if (TraceDebug.isDEBUG()) {
+ sendNoFieldFoundMsg(fields, expectedFieldName);
+ }
+ }
return fieldVal;
}
* @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,
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);
*******************************************************************************/
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;
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
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);
}
return;
}
+ //The process state is updated within the pop method
process.popFromExecutionStack();
- process.setState(process.peekFromExecutionStack());
process.getState().setChange_Time(eventTime);
}
// ========================================================================
// 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;
/*
* 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.
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
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
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());
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);
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);
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 */
* 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);
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;
public void pushToExecutionStack(LttngExecutionState newState) {
execution_stack.push(newState);
+ setState(newState);
}
public LttngExecutionState popFromExecutionStack() {
return null;
}
else {
- return execution_stack.pop();
+ LttngExecutionState popedState = execution_stack.pop();
+ // adjust current state to the new top
+ setState(peekFromExecutionStack());
+ return popedState;
}
}
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,
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ icons/
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