+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/tests/trace/LTTngExperimentTest.java (fStartTime): Fixed unit test for updated start time
2010-09-17 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/lttng/control/LTTngSyntheticEventProviderTest.java: Adjusted unit test
private static int NB_EVENTS = 15316;
// Note: Start/end times are for the LTTng *trace*, not the actual events
- private static final TmfTimestamp fStartTime = new TmfTimestamp(13589692331524L, (byte) -9);
+ private static final TmfTimestamp fStartTime = new TmfTimestamp(13589759412128L, (byte) -9);
private static final TmfTimestamp fEndTime = new TmfTimestamp(13589907059242L, (byte) -9);
private static ITmfTrace[] fTraces;
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvas.java (asynchronousNotifyParentUpdatedInformation): Fixed typo
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramCanvasControlListener.java (controlMoved): Check for NPE
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/HistogramView.java: Cosmetic adjustemnts
+ * src/org/eclipse/linuxtools/lttng/ui/views/histogram/TimeTextGroup.java: Cosmetic adjustemnts
+
2010-10-13 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java: Added checks for disposed widget
}
/**
- * Function to asynchonously notify the parent of the related canvas that the window changed.<p>
+ * Function to asynchronously notify the parent of the related canvas that the window changed.<p>
*
* Basically, it just run "notifyParentSelectionWindowChanged()" in asyncExec.
*
* @param event The controle event generated by the move.
*/
public void controlMoved(ControlEvent event) {
- ourCanvas.redraw();
+ if (ourCanvas != null)
+ ourCanvas.redraw();
}
/**
* View that contain an visual approach to the window that control the request.
* This is intended to replace the TimeFrameView
* <p>
- * This view is composed of 2 canvas, one for the whole experiment and one for the selectionned window in the experiment.
+ * This view is composed of 2 canvas, one for the whole experiment and one for the selected window in the experiment.
* It also contain a certain number of controls to print or change informations about the experiment.
*/
public class HistogramView extends TmfView implements ControlListener {
private Text txtWindowMinNbEvents = null;
// We move the time label to header from TimeTextGroup.java
- protected static final String NANOSEC_LABEL = "(sec)";
- private static final String WINDOW_TIMERANGE_LABEL_TEXT = "Window Timerange, " + NANOSEC_LABEL;
- private static final String WINDOW_CURRENT_TIME_LABEL_TEXT = "Cursor Centered on, " + NANOSEC_LABEL;
- private static final String EVENT_CURRENT_TIME_LABEL_TEXT = "Current Event Time, " + NANOSEC_LABEL;
- private TimeTextGroup ntgTimeRangeWindow = null;
- private TimeTextGroup ntgCurrentWindowTime = null;
+// protected static final String NANOSEC_LABEL = "(sec)";
+// private static final String WINDOW_TIMERANGE_LABEL_TEXT = "Window Timerange, " + NANOSEC_LABEL;
+// private static final String WINDOW_CURRENT_TIME_LABEL_TEXT = "Cursor Centered on, " + NANOSEC_LABEL;
+// private static final String EVENT_CURRENT_TIME_LABEL_TEXT = "Current Event Time, " + NANOSEC_LABEL;
+ private static final String WINDOW_TIMESPAN_LABEL_TEXT = "Window Span (sec)";
+ private static final String WINDOW_CENTER_TIME_LABEL_TEXT = "Window Center (sec)";
+ private static final String CURRENT_EVENT_TIME_LABEL_TEXT = "Current Event (sec)";
+ private TimeTextGroup ntgWindowTimeSpan = null;
+ private TimeTextGroup ntgWindowCenterTime = null;
private TimeTextGroup ntgCurrentEventTime = null;
/**
- * Default contructor of the view
+ * Default constructor of the view
*/
public HistogramView() {
super(ID);
// Calculate if we need "small screen" fixes
if ( parent.getDisplay().getBounds().width < SCREEN_SMALL_IF_SMALLER_THAN ) {
- // A lot smaller font for timstampe
+ // A lot smaller font for timestamp
smallFont = new Font(font.getDevice(), tmpFontData.getName(), tmpFontData.getHeight() - VERY_SMALL_FONT_MODIFIER, tmpFontData.getStyle());
/*
/////////////////////////////////////////////////////////////////////////////////////
- // Layout that contain the time spinner
+ // Layout that contain the time spinners
// Contains :
- // NanosecTextGroup spTimeRangeWindow
- // NanosecTextGroup spCurrentWindowTime
- // NanosecTextGroup spCurrentEventTime
+ // NanosecTextGroup ntgCurrentEventTime
+ // NanosecTextGroup ntgTimeRangeWindow
+ // NanosecTextGroup ntgCurrentWindowTime
/////////////////////////////////////////////////////////////////////////////////////
- Composite layoutTimesSpinner = new Composite(layoutFullView, SWT.NONE);
+ Composite layoutTimeSpinners = new Composite(layoutFullView, SWT.NONE);
GridLayout gridTimesSpinner = new GridLayout();
gridTimesSpinner.numColumns = 3;
gridTimesSpinner.marginHeight = 0;
gridTimesSpinner.marginWidth = 0;
- gridTimesSpinner.horizontalSpacing = 0;
+ gridTimesSpinner.horizontalSpacing = 5;
gridTimesSpinner.verticalSpacing = 0;
- layoutTimesSpinner.setLayout(gridTimesSpinner);
+ gridTimesSpinner.makeColumnsEqualWidth = true;
+ gridTimesSpinner.marginLeft = 5;
+ gridTimesSpinner.marginRight = 5;
+ layoutTimeSpinners.setLayout(gridTimesSpinner);
GridData gridDataCurrentEvent = new GridData();
gridDataCurrentEvent.horizontalAlignment = SWT.LEFT;
gridDataCurrentEvent.verticalAlignment = SWT.CENTER;
- ntgCurrentEventTime = new TimeTextGroup(this, layoutTimesSpinner, SWT.BORDER, SWT.BORDER, EVENT_CURRENT_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime( 0L ), doesTimeTextGroupNeedAdjustment);
+ ntgCurrentEventTime = new TimeTextGroup(this, layoutTimeSpinners, SWT.BORDER, SWT.BORDER, CURRENT_EVENT_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime(0L), doesTimeTextGroupNeedAdjustment);
ntgCurrentEventTime.setLayoutData(gridDataCurrentEvent);
- GridData gridDataTimeRange = new GridData();
- gridDataCurrentEvent.horizontalAlignment = SWT.CENTER;
- gridDataCurrentEvent.verticalAlignment = SWT.CENTER;
- ntgTimeRangeWindow = new TimeTextGroup(this, layoutTimesSpinner, SWT.BORDER, SWT.BORDER, WINDOW_TIMERANGE_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime( 0L ), doesTimeTextGroupNeedAdjustment);
- ntgTimeRangeWindow.setLayoutData(gridDataTimeRange);
+ GridData gridDataTimeSpan = new GridData();
+ gridDataTimeSpan.horizontalAlignment = SWT.CENTER;
+ gridDataTimeSpan.verticalAlignment = SWT.CENTER;
+ ntgWindowTimeSpan = new TimeTextGroup(this, layoutTimeSpinners, SWT.BORDER, SWT.BORDER, WINDOW_TIMESPAN_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime(0L), doesTimeTextGroupNeedAdjustment);
+ ntgWindowTimeSpan.setLayoutData(gridDataTimeSpan);
- GridData gridDataCurrentWindow = new GridData();
- gridDataCurrentEvent.horizontalAlignment = SWT.RIGHT;
- gridDataCurrentEvent.verticalAlignment = SWT.CENTER;
- ntgCurrentWindowTime = new TimeTextGroup(this, layoutTimesSpinner, SWT.BORDER, SWT.BORDER, WINDOW_CURRENT_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime( 0L ), doesTimeTextGroupNeedAdjustment);
- ntgCurrentWindowTime.setLayoutData(gridDataCurrentWindow);
+ GridData gridDataWindowCenter = new GridData();
+ gridDataWindowCenter.horizontalAlignment = SWT.RIGHT;
+ gridDataWindowCenter.verticalAlignment = SWT.CENTER;
+ ntgWindowCenterTime = new TimeTextGroup(this, layoutTimeSpinners, SWT.BORDER, SWT.BORDER, WINDOW_CENTER_TIME_LABEL_TEXT, HistogramConstant.formatNanoSecondsTime(0L), doesTimeTextGroupNeedAdjustment);
+ ntgWindowCenterTime.setLayoutData(gridDataWindowCenter);
/////////////////////////////////////////////////////////////////////////////////////
GridLayout gridSelectionWindow = new GridLayout();
gridSelectionWindow.numColumns = 3;
gridSelectionWindow.marginHeight = 0;
- gridSelectionWindow.marginWidth = 0;
+ gridSelectionWindow.marginWidth = 2;
+ gridSelectionWindow.marginTop = 5;
gridSelectionWindow.horizontalSpacing = 0;
gridSelectionWindow.verticalSpacing = 0;
layoutSelectionWindow.setLayout(gridSelectionWindow);
gridExperimentHistogram.marginWidth = 0;
gridExperimentHistogram.horizontalSpacing = 0;
gridExperimentHistogram.verticalSpacing = 0;
+ gridExperimentHistogram.marginLeft = 5;
+ gridExperimentHistogram.marginRight = 5;
layoutExperimentHistogram.setLayout(gridExperimentHistogram);
/*
*/
/**
- * Method called when synchonization is active and that the user select an event.<p>
+ * Method called when synchronization is active and that the user select an event.
* We update the current event timeTextGroup and move the selected window if needed.
*
* @param signal Signal received from the framework. Contain the event.
// Set a (dynamic) time interval
long intervalTime = ( (ts2.getValue() - ts1.getValue()) / selectedWindowCanvas.getHistogramContent().getNbElement() );
- selectedWindowRequest = performRequest(experiment, selectedWindowCanvas, tmpRange, intervalTime,
- ExecutionType.FOREGROUND);
+ selectedWindowRequest = performRequest(experiment, selectedWindowCanvas, tmpRange, intervalTime, ExecutionType.FOREGROUND);
selectedWindowCanvas.redrawAsynchronously();
}
if ( lastUsedExperiment != null ) {
// If a request is ongoing, try to stop it
- if ( selectedWindowRequest != null && selectedWindowRequest.isCompleted() == false ) {
+ if (selectedWindowRequest != null && !selectedWindowRequest.isCompleted()) {
selectedWindowRequest.cancel();
}
}
}
- if(ntgCurrentWindowTime != null && fullExperimentCanvas != null) {
+ if(ntgWindowCenterTime != null && fullExperimentCanvas != null) {
// If the user changed the selected window time, recenter the window and call the notification
- long newSelectedWindowTime = ntgCurrentWindowTime.getValue();
+ long newSelectedWindowTime = ntgWindowCenterTime.getValue();
if ( newSelectedWindowTime != fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition() ) {
fullExperimentCanvas.setWindowCenterPosition(newSelectedWindowTime);
windowChangedNotification();
}
}
- if(ntgTimeRangeWindow != null && fullExperimentCanvas != null) {
+ if(ntgWindowTimeSpan != null && fullExperimentCanvas != null) {
// If the user changed the selected window size, resize the window and call the notification
- long newSelectedWindowTimeRange = ntgTimeRangeWindow.getValue();
+ long newSelectedWindowTimeRange = ntgWindowTimeSpan.getValue();
if ( newSelectedWindowTimeRange != fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth() ) {
fullExperimentCanvas.resizeWindowByAbsoluteTime(newSelectedWindowTimeRange);
windowChangedNotification();
txtWindowStopTime.setText( HistogramConstant.formatNanoSecondsTime( 0L ) );
txtWindowStartTime.getParent().layout();
- ntgCurrentWindowTime.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
- ntgTimeRangeWindow.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
+ ntgWindowCenterTime.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
+ ntgWindowTimeSpan.setValue( HistogramConstant.formatNanoSecondsTime( 0L ) );
// Using "startTime" here can avoid an useless TmfTimeSynchSignal here
// However it look ugly to have only this time
}
if(fullExperimentCanvas != null) {
- ntgCurrentWindowTime.setValue( fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition() );
- ntgTimeRangeWindow.setValue( fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth() );
+ ntgWindowCenterTime.setValue( fullExperimentCanvas.getCurrentWindow().getTimestampOfCenterPosition() );
+ ntgWindowTimeSpan.setValue( fullExperimentCanvas.getCurrentWindow().getWindowTimeWidth() );
// If the current event time is outside the selection window, recenter our window
if ( isGivenTimestampInSelectedWindow(ntgCurrentEventTime.getValue()) == false ) {
// Take one control in each group to call to refresh the layout
// Since both control have the same parent, only one call is needed
txtWindowStartTime.getParent().layout();
- ntgCurrentWindowTime.getParent().layout();
+ ntgWindowCenterTime.getParent().layout();
}
/**
*/
public void updateSelectedEventTime() {
ntgCurrentEventTime.setValueAsynchronously(currentEventTime);
+// sendTmfTimeSynchSignalBroadcast();
// Tell the selection canvas which event is currently selected
// This give a nice graphic output
selectedWindowCanvas.getHistogramContent().setSelectedEventTimeInWindow(currentEventTime);
*
* Just redraw everything...
*
- * @param event The controle event generated by the move.
+ * @param event The control event generated by the move.
*/
public void controlMoved(ControlEvent event) {
parent.redraw();
private static final int SMALL_FONT_MODIFIER = 1;
// Indentation size
- private static final int DEFAULT_INDENT_SIZE = 10;
+// private static final int DEFAULT_INDENT_SIZE = 10;
private HistogramView parentView = null;
private AsyncTimeTextGroupRedrawer asyncRedrawer = null;
}
/**
- * Default Constructor with adjustement for small screen, allow you to give the groupname and the textbox value.<p>
- *
+ * Default Constructor with adjustment for small screen, allow you to give the group name and the text box value.<p>
+ *
* @param newParentView Parent HistogramView
* @param parent Parent Composite, used to position the inner controls.
- * @param textStyle Style of the textbox. Usually SWT.BORDER or SWT.NONE (or anything that suit a Text)
+ * @param textStyle Style of the text box. Usually SWT.BORDER or SWT.NONE (or anything that suit a Text)
* @param groupStyle Style of the group. Anything that suite a Text
* @param groupValue Value (label) of the group.
- * @param textValue Value of the textbox.
+ * @param textValue Value of the text box.
* @param isSpaceSaverNeeded Value that tell if we try to save some space in the control.
*/
public TimeTextGroup(HistogramView newParentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue, boolean isSpaceSaverNeeded) {
Font smallFont = null;
int textBoxSize = -1;
- int indentSize = -1;
+// int indentSize = -1;
// If we were asked to save size, calculate the correct value here
if ( isSpaceSaverNeeded == true ) {
// No minimum textBoxSize and no indent size
textBoxSize = 0;
- indentSize = 0;
+// indentSize = 0;
}
else {
// We use only a slightly smaller font
textBoxSize = HistogramConstant.getTextSizeInControl(parent, LONGEST_STRING_VALUE);
// Default indent
- indentSize = DEFAULT_INDENT_SIZE;
+// indentSize = DEFAULT_INDENT_SIZE;
}
parentView = newParentView;
// ** Creation of the group
- GridLayout gridLayoutgroup = new GridLayout(2, false);
+// GridLayout gridLayoutgroup = new GridLayout(2, false);
+ GridLayout gridLayoutgroup = new GridLayout(1, false);
gridLayoutgroup.horizontalSpacing = 0;
gridLayoutgroup.verticalSpacing = 0;
grpName = new Group(parent, groupStyle);
txtNanosec = new Text(grpName, textStyle);
txtNanosec.setTextLimit( MAX_CHAR_IN_TEXTBOX );
- txtNanosec.setText( textValue );
+ txtNanosec.setText(textValue);
txtNanosec.setFont(smallFont);
GridData gridDataTextBox = new GridData(SWT.LEFT, SWT.CENTER, true, false);
- gridDataTextBox.horizontalIndent = indentSize;
+ gridDataTextBox.horizontalIndent = 0; // indentSize;
gridDataTextBox.verticalIndent = 0;
gridDataTextBox.minimumWidth = textBoxSize;
txtNanosec.setLayoutData(gridDataTextBox);
*
* @param newTime The new time to set
*/
- public void asynchronousSetValue(long newTime) {
+ public void asynchronousSetValue(final long newTime) {
// Ignore setting of value if widget is disposed
if (parentTimeTextGroup.getParent().isDisposed()) return;
- final long tmpTime = newTime;
-
Display display = parentTimeTextGroup.getParent().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
if (!parentTimeTextGroup.getParent().isDisposed()) {
- parentTimeTextGroup.setValue(tmpTime);
+ parentTimeTextGroup.setValue(newTime);
}
}
});
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/lttng/event/LttngEvent.java: Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventContent.java: Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventField.java: Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventReference.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventSource.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngEventType.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/event/LttngTimestamp.java (clone): Implement cloning
+ * src/org/eclipse/linuxtools/lttng/state/experiment/StateExperimentManager.java: (StateExperimentManager): Counter fix
+ (buildCheckPoints): Proper timestamp cloning
+ (.handleData): Per-trace event counter (bug...)
+ * src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java (currentLttngEvent): Make the event unique (single)
+ (LTTngTrace): Fix the trace time range to start at first event
+
2010-10-14 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/lttng/control/LttngSyntheticEventProvider.java: Handle processing through a coalesced request
@Override
public LttngEvent clone() {
- return new LttngEvent(this);
+ LttngEvent clone = (LttngEvent) super.clone();
+ clone.getContent().setEvent(clone);
+ clone.parentTrace = parentTrace;
+ clone.jniEventReference = jniEventReference;
+ return clone;
}
+
}
}
return strBuffer.toString();
-
}
+
+ @Override
+ public LttngEventContent clone() {
+ LttngEventContent clone = (LttngEventContent) super.clone();
+ LttngEventField[] fields = getFields();
+ clone.fFields = new LttngEventField[fields.length];
+ for (int i = 0; i < fields.length; i++) {
+ clone.fFields[i] = fields[i].clone();
+ }
+ clone.fFieldsMap = new HashMap<String, LttngEventField>();
+ for (String key : fFieldsMap.keySet()) {
+ clone.fFieldsMap.put(new String(key), ((LttngEventField) fFieldsMap.get(key)).clone());
+ }
+ return clone;
+ }
+
}
\ No newline at end of file
@Override
public String toString() {
- return getId().toString() + ":" + getValue().toString();
+ Object value = getValue();
+ return getId() + ":" + ((value != null) ? value.toString() : "null");
+ }
+
+ @Override
+ public LttngEventField clone() {
+ LttngEventField clone = (LttngEventField) super.clone();
+ clone.fValue = fValue;
+ return clone;
}
}
return tracename;
}
+ @Override
+ public LttngEventReference clone() {
+ LttngEventReference clone = (LttngEventReference) super.clone();
+ clone.fReference = new String((String) fReference);
+ clone.tracename = new String((String) tracename);
+ return clone;
+ }
}
public String toString() {
return fSourceId.toString();
}
+
+ @Override
+ public LttngEventSource clone() {
+ LttngEventSource clone = (LttngEventSource) super.clone();
+ clone.fSourceId = new String((String) fSourceId);
+ return clone;
+ }
}
// ...but maybe we should?
return tracefileName + "/" + cpuId.toString() + "/" + markerName;
}
+
+ @Override
+ public LttngEventType clone() {
+ LttngEventType clone = (LttngEventType) super.clone();
+ clone.tracefileName = new String(tracefileName);
+ clone.cpuId = new Long(cpuId);
+ clone.markerName = new String(markerName);
+ return clone;
+ }
+
}
return result;
}
+
+ @Override
+ public LttngTimestamp clone() {
+ return (LttngTimestamp) super.clone();
+ }
+
}
* building
*/
private final Map<ITmfTrace, IStateTraceManager> ftraceToManagerMap = new HashMap<ITmfTrace, IStateTraceManager>();
+ private final Map<ITmfTrace, Long> ftraceEventsReadMap = new HashMap<ITmfTrace, Long>();
private LttngSyntheticEvent syntheticEvent = null;
private ITmfEventRequest<LttngEvent> fStateCheckPointRequest = null;
// =======================================================================
public StateExperimentManager(Long id, String name) {
super(id, null, name, null);
- fexperimentListener = new StateExperimentListener("Experiment Manager",
- this);
+ fexperimentListener = new StateExperimentListener("Experiment Manager", this);
}
LTTngTreeNode[] traceNodes = experimentNode.getChildren();
synchronized (this) {
ftraceToManagerMap.clear();
+ ftraceEventsReadMap.clear();
}
ITmfTrace trace;
trace = traceManager.getTrace();
synchronized (this) {
ftraceToManagerMap.put(trace, traceManager);
+ ftraceEventsReadMap.put(trace, new Long(0));
}
}
LttngEvent.class, TmfTimeRange.Eternity,
TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.BACKGROUND) {
- Long nbEvents = 0L;
-
+ long nbEventsHandled = 0;
+
/*
* (non-Javadoc)
*
super.handleData(event);
if (event != null) {
// Tracer.trace("Chk: " + event.getTimestamp());
+ nbEventsHandled++;
ITmfTrace trace = event.getParentTrace();
IStateTraceManager traceManager = ftraceToManagerMap.get(trace);
+ long nbEvents = ftraceEventsReadMap.get(trace) + 1;
+ ftraceEventsReadMap.put(trace, nbEvents);
if (traceManager != null) {
// obtain synthetic event
- LttngSyntheticEvent synEvent = updateSynEvent(event,
- traceManager);
+ LttngSyntheticEvent synEvent = updateSynEvent(event, traceManager);
// update state system, and save check points as needed
traceManager.handleEvent(synEvent, nbEvents);
} else {
*/
private void printCompletedMessage() {
if (TraceDebug.isDEBUG()) {
- TraceDebug.debug("Trace check point building completed, number of events handled: " + nbEvents
+ TraceDebug.debug("Trace check point building completed, number of events handled: " + nbEventsHandled
+ "\n\t\t");
for (IStateTraceManager traceMgr : ftraceToManagerMap.values()) {
TraceDebug.debug(traceMgr.toString() + "\n\t\t");
public class LTTngTrace extends TmfTrace<LttngEvent> {
public static boolean printDebug = false;
- public static boolean uniqueEvent = false;
+ public static boolean uniqueEvent = true;
private final static boolean SHOW_LTT_DEBUG_DEFAULT = false;
private final static boolean IS_PARSING_NEEDED_DEFAULT = !uniqueEvent;
LttngEventContent eventContent = null;
LttngEventReference eventReference = null;
-
// The actual event
LttngEvent currentLttngEvent = null;
// Even if we don't have any index, set ONE checkpoint
// fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L) , new LttngLocation() ) );
- // Set the start time of the trace
- setTimeRange( new TmfTimeRange( new LttngTimestamp(currentJniTrace.getStartTime().getTime()),
- new LttngTimestamp(currentJniTrace.getEndTime().getTime())
- ) );
-// }
+ // Set the time range of the trace
+ TmfContext context = seekLocation(null);
+ LttngEvent event = getNextEvent(context);
+ LttngTimestamp startTime = new LttngTimestamp(event.getTimestamp());
+ LttngTimestamp endTime = new LttngTimestamp(currentJniTrace.getEndTime().getTime());
+
+ setTimeRange(new TmfTimeRange(startTime, endTime));
}
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java: Small cleanup
+
2010-10-13 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/tmf/ui/views/project/ProjectView.java: Added checks for disposed widget
*/\r
public class TmfEventsTable extends TmfComponent {\r
\r
-// private Shell fShell;\r
- \r
// ------------------------------------------------------------------------\r
// Table data\r
// ------------------------------------------------------------------------\r
+2010-10-15 Francois Chouinard <fchouinard@gmail.com>
+
+ * src/org/eclipse/linuxtools/tmf/event/TmfEvent.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventContent.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventField.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventReference.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventSource.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfEventType.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/event/TmfTimestamp.java: Implement cloning
+ * src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java (updateIndex): Fixed timestamp cloning
+ * src/org/eclipse/linuxtools/tmf/request/TmfDataRequest.java: Replaced lock.wait() by CountDownLatch
+ * src/org/eclipse/linuxtools/tmf/trace/TmfTrace.java (updateIndex): Fixed timestamp cloning
+
2010-10-13 Francois Chouinard <fchouinard@gmail.com>
* src/org/eclipse/linuxtools/tmf/request/TmfRequestExecutor.java: Added checks for disposed widget
@Override
public TmfEvent clone() {
- return new TmfEvent(this);
+ TmfEvent clone = null;
+ try {
+ clone = (TmfEvent) super.clone();
+ clone.fOriginalTimestamp = fOriginalTimestamp.clone();
+ clone.fEffectiveTimestamp = fEffectiveTimestamp.clone();
+ clone.fSource = fSource.clone();
+ clone.fType = fType.clone();
+ clone.fReference = fReference.clone();
+ clone.fContent = fContent.clone();
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+
+ return clone;
}
}
package org.eclipse.linuxtools.tmf.event;
-
/**
* <b><u>TmfEventContent</u></b>
* <p>
* The event content.
*/
-public class TmfEventContent {
+public class TmfEventContent implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
return result.toString();
}
+ @Override
+ public TmfEventContent clone() {
+ TmfEventContent clone = null;
+ try {
+ clone = (TmfEventContent) super.clone();
+ clone.fParentEvent = fParentEvent;
+ clone.fRawContent = null;
+ clone.fFields = null;
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
*
* TODO: Add support for field hierarchy.
*/
-public class TmfEventField {
+public class TmfEventField implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
- private final TmfEventContent fParent;
- private final String fFieldId;
- private Object fValue;
+ protected TmfEventContent fParent;
+ protected String fFieldId;
+ protected Object fValue;
// ------------------------------------------------------------------------
// Constructors
public String toString() {
return "[TmfEventField(" + fFieldId + ":" + fValue.toString() + ")]";
}
+ @Override
+ public TmfEventField clone() {
+ TmfEventField clone = null;
+ try {
+ clone = (TmfEventField) super.clone();
+ clone.fParent = fParent;
+ clone.fFieldId = new String(fFieldId);
+ clone.fValue = null;
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
+
}
\ No newline at end of file
* <p>
* An application-defined event reference.
*/
-public class TmfEventReference {
+public class TmfEventReference implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
return fReference.equals(o.fReference);
}
+ @Override
+ public TmfEventReference clone() {
+ TmfEventReference clone = null;
+ try {
+ clone = (TmfEventReference) super.clone();
+ clone.fReference = null;
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
* <p>
* The event source.
*/
-public class TmfEventSource {
+public class TmfEventSource implements Cloneable {
// ------------------------------------------------------------------------
// Attributes
return "[TmfEventSource(" + ((fSourceId != null) ? fSourceId.toString() : "null") + ")]";
}
+ @Override
+ public TmfEventSource clone() {
+ TmfEventSource clone = null;
+ try {
+ clone = (TmfEventSource) super.clone();
+ clone.fSourceId = null;
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
package org.eclipse.linuxtools.tmf.event;
import java.util.HashMap;
-import java.util.Map;
/**
* <b><u>TmfEventType</u></b>
* <p>
* The event type.
*/
-public class TmfEventType {
+public class TmfEventType implements Cloneable {
// ------------------------------------------------------------------------
// Constants
// Attributes
// ------------------------------------------------------------------------
- private final String fTypeId;
- private final String[] fFieldLabels;
- private final int fNbFields;
- private final Map<String, Integer> fFieldMap;
+ private String fTypeId;
+ private String[] fFieldLabels;
+ private int fNbFields;
+ private HashMap<String, Integer> fFieldMap;
// ------------------------------------------------------------------------
// Constructors
return "[TmfEventType:" + fTypeId + "]";
}
+ @Override
+ public TmfEventType clone() {
+ TmfEventType clone = null;
+ try {
+ clone = (TmfEventType) super.clone();
+ clone.fTypeId = new String(fTypeId);
+ clone.fNbFields = fNbFields;
+ // Clone the field labels
+ clone.fFieldLabels = new String[fFieldLabels.length];
+ for (int i = 0; i < fFieldLabels.length; i++) {
+ clone.fFieldLabels[i] = new String(fFieldLabels[i]);
+ }
+ // Clone the fields
+ clone.fFieldMap = new HashMap<String, Integer>();
+ for (String key : fFieldMap.keySet()) {
+ clone.fFieldMap.put(new String(key), new Integer(fFieldMap.get(key)));
+ }
+ }
+ catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return clone;
+ }
}
\ No newline at end of file
package org.eclipse.linuxtools.tmf.event;
-
/**
* <b><u>TmfTimestamp</u></b>
* <p>
// Add new entry at proper location (if empty)
if (fCheckpoints.size() == position) {
ITmfLocation<?> location = context.getLocation().clone();
- fCheckpoints.add(new TmfCheckpoint(timestamp, location));
+ fCheckpoints.add(new TmfCheckpoint(timestamp.clone(), location));
// System.out.println(this + "[" + (fCheckpoints.size() - 1) + "] " + timestamp + ", " + location.toString());
}
}
package org.eclipse.linuxtools.tmf.request;
+import java.util.concurrent.CountDownLatch;
+
import org.eclipse.linuxtools.tmf.Tracer;
import org.eclipse.linuxtools.tmf.event.TmfData;
private final int fNbRequested; // The number of requested events (ALL_DATA for all)
private int fNbRead; // The number of reads so far
- private final Object lock;
+ private CountDownLatch startedLatch = new CountDownLatch(1);
+ private CountDownLatch completedLatch = new CountDownLatch(1);
private boolean fRequestRunning = false;
private boolean fRequestCompleted = false;
private boolean fRequestFailed = false;
fNbRequested = nbRequested;
fExecType = execType;
fNbRead = 0;
- lock = new Object();
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "created");
}
* @throws InterruptedException
*/
public void waitForStart() throws InterruptedException {
- synchronized (lock) {
- while (!fRequestRunning) {
- lock.wait();
- }
- }
+ while (!fRequestRunning) {
+ startedLatch.await();
+ }
}
/**
* @throws InterruptedException
*/
public void waitForCompletion() throws InterruptedException {
- synchronized (lock) {
- while (!fRequestCompleted) {
- lock.wait();
- }
- }
+ while (!fRequestCompleted) {
+ completedLatch.await();
+ }
}
/**
*/
public void start() {
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "starting");
- synchronized(lock) {
+ synchronized(this) {
fRequestRunning = true;
- lock.notifyAll();
}
handleStarted();
+ startedLatch.countDown();
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "started");
}
*/
public void done() {
if (Tracer.isRequestTraced()) Tracer.traceRequest(this, "completing");
- synchronized(lock) {
+ synchronized(this) {
if (!fRequestCompleted) {
fRequestRunning = false;
fRequestCompleted = true;
}
- handleCompleted();
- lock.notifyAll();
}
+ handleCompleted();
+ completedLatch.countDown();
}
/**
* Called by the request processor upon failure.
*/
- public void fail() {
- synchronized(lock) {
- fRequestFailed = true;
- done();
- }
+ public synchronized void fail() {
+ fRequestFailed = true;
+ done();
}
/**
* Called by the request processor upon cancellation.
*/
- public void cancel() {
- synchronized(lock) {
- fRequestCanceled = true;
- done();
- }
+ public synchronized void cancel() {
+ fRequestCanceled = true;
+ done();
}
// ------------------------------------------------------------------------
@Override
public String toString() {
- return "[TmfDataRequest(" + fRequestId + "," + fDataType.getSimpleName()
- + "," + fIndex + "," + fNbRequested + ")]";
+ return "[TmfDataRequest(" + fRequestId + "," + fDataType.getSimpleName() +
+ "," + fIndex + "," + fNbRequested + ")]";
}
}
// Add new entry at proper location (if empty)
if (fCheckpoints.size() == position) {
ITmfLocation<?> location = context.getLocation().clone();
- fCheckpoints.add(new TmfCheckpoint(timestamp, location));
+ fCheckpoints.add(new TmfCheckpoint(timestamp.clone(), location));
// System.out.println(getName() + "[" + (fCheckpoints.size() - 1) + "] " + timestamp + ", " + location.toString());
}
}