* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Alvaro Sanchez-Leon - Initial implementation
+ * Contributors:
+ * Alvaro Sanchez-Leon - Initial implementation
+ * Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
*******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.controlflow.evProcessor;
import java.util.Vector;
-import org.eclipse.linuxtools.lttng.state.StateStrings.ProcessStatus;
-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.core.state.StateStrings.ProcessStatus;
+import org.eclipse.linuxtools.lttng.core.state.evProcessor.ILttngEventProcessor;
+import org.eclipse.linuxtools.lttng.core.state.model.LttngProcessState;
+import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState;
+import org.eclipse.linuxtools.lttng.ui.TraceDebug;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent;
-import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEvent.Type;
+import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
import org.eclipse.linuxtools.lttng.ui.views.common.AbsTRangeUpdate;
import org.eclipse.linuxtools.lttng.ui.views.common.ParamsUpdater;
import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowModelFactory;
import org.eclipse.linuxtools.lttng.ui.views.controlflow.model.FlowProcessContainer;
-public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements IEventProcessing {
+public abstract class AbsFlowTRangeUpdate extends AbsTRangeUpdate implements ILttngEventProcessor {
// ========================================================================
// Data
// TimeRangeEventProcess localProcess = new TimeRangeEventProcess(id, name, startTime, stopTime, groupName, className)
TimeRangeEventProcess localProcess = new TimeRangeEventProcess(
procContainer.getUniqueId(), stateProcess.getName(),
- traceStartTime, traceEndTime, "", stateProcess.getType()
+ traceStartTime, traceEndTime, "", stateProcess.getType() //$NON-NLS-1$
.getInName(), stateProcess.getCpu(), stateProcess
- .getInsertion_time().getValue());
- localProcess.setCreationTime(stateProcess.getCreation_time().getValue());
+ .getInsertion_time());
+
+
+ localProcess.setCreationTime(stateProcess.getCreation_time());
localProcess.setPid(stateProcess.getPid());
localProcess.setTgid(stateProcess.getTgid());
localProcess.setPpid(stateProcess.getPpid());
localProcess.setBrand(stateProcess.getBrand());
localProcess.setTraceID(traceId);
localProcess.setProcessType(stateProcess.getType().getInName());
- procContainer.addProcess(localProcess);
+ procContainer.addItem(localProcess);
+
+ if (TraceDebug.isCFV()) {
+ TraceDebug.traceCFV("addLocalProcess():" + localProcess); //$NON-NLS-1$
+ }
+
return localProcess;
}
* @param stateMode
* @return
*/
+ @SuppressWarnings("deprecation")
protected boolean makeDraw(LttngTraceState traceSt, long startTime,
long endTime, TimeRangeEventProcess localProcess,
ParamsUpdater params, String stateMode) {
+ if (TraceDebug.isCFV()) {
+ TraceDebug.traceCFV("makeDraw():[" + localProcess + //$NON-NLS-1$
+ ",candidate=[stime=" + startTime + //$NON-NLS-1$
+ ",etime=" + endTime + //$NON-NLS-1$
+ ",state=" + stateMode + "]]"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
// Determine start and end times to establish duration
Long stime = startTime;
Long etime = endTime;
+ if (!withinViewRange(stime, etime)) {
+ // No use to process the event since it's outside
+ // the visible time range of the window
+ params.incrementEventsDiscarded(ParamsUpdater.OUT_OF_VIEWRANGE);
+ return false;
+ }
+
if (etime < stime) {
// Validate the sequential order of events
params.incrementEventsDiscardedWrongOrder();
return false;
}
- if (!withinViewRange(stime, etime)) {
- // No use to process the event since it's outside
- // the visible time range of the window
- params.incrementEventsDiscarded();
- return false;
+ // Store the next good time to start drawing the next event
+ // this is done this early to display an accurate start time of the
+ // first event
+ // within the display window
+ // ****** moved at the end since it produces gaps among the coloured rectangles
+ // localProcess.setNext_good_time(etime);
+
+ // If First event of a process, initialise start time half page before to enable pagination to the left
+ if (stime < params.getStartTime()) {
+ // event start time is before the visible time window
+ long insertion = localProcess.getInsertionTime();
+ if (stime.longValue() == insertion) {
+ // if start time is equal to insertion this is the first event to be drawn for this process
+ long halfPage = (params.getEndTime() - params.getStartTime()) / 2;
+ long initTime = params.getStartTime() - halfPage;
+ if (initTime > insertion) {
+ // start time of this event is unknown, place it half page before visible window to allow left side
+ // pagination when selecting previous event
+ stime = initTime;
+ }
+ }
}
// Determine if the time range event will fit it the current
double k = getPixelsPerNs(traceSt, params);
double pixels = duration * k;
- // ***VERIFY***
- // Is all this equivalent to this call in C??
- // if(ltt_time_compare(hashed_process_data->next_good_time,evtime) > 0)
- // ***
// Visibility check
// Display a "more information" indication by allowing non visible event
// as long as its previous event is visible.
boolean visible = true;
- if (pixels < 1) {
+ if (pixels < 1.0) {
boolean prevEventVisibility = true;
// Get the visibility indication on previous event for
// this process
.size() - 1);
prevEventVisibility = prevEvent.isVisible();
- // ***VERIFY***
- // This replace all C Call like this one ?
- // #ifdef EXTRA_CHECK if(ltt_time_compare(evtime,
- // time_window.start_time) == -1 || ltt_time_compare(evtime,
- // time_window.end_time) == 1)
-
// if previous event visibility is false and the time span
// between events less than two pixels, there is no need to
// load it in memory i.e. not visible and a more indicator is
// return i.e. event discarded to free up memory
Long eventSpan = stime - prevEvent.getStartTime();
if (prevEventVisibility == false
- && ((double) eventSpan * k) < 2) {
+ && ((double) eventSpan * k) < 2.0) {
// discard the item
- params.incrementEventsDiscarded();
+ params.incrementEventsDiscarded(ParamsUpdater.NOT_VISIBLE);
return false;
}
}
// 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,
localProcess, Type.PROCESS_MODE, stateMode);
- // *** VERIFY ***
- // This is added to replace the multiple draw and gtk/glib command but
- // I'm not sure about it
time_window.setVisible(visible);
localProcess.getTraceEvents().add(time_window);
localProcess.setNext_good_time(etime);
- // *** VERIFY ***
- // Missing checks like this one?
- // #ifdef EXTRA_CHECK if(ltt_time_compare(evtime,
- // time_window.start_time) == -1 || ltt_time_compare(evtime,
- // time_window.end_time) == 1)
-
return false;
}