* 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.ILttngEventProcessor;
-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;
// 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());
localProcess.setTraceID(traceId);
localProcess.setProcessType(stateProcess.getType().getInName());
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();
// within the display window
// ****** moved at the end since it produces gaps among the coloured rectangles
// localProcess.setNext_good_time(etime);
- 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;
+
+ // 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
// 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
// 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;
}