+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+/**
+ * The ctfIterator is the class that will act like a reader for the trace
+ * it does not have a file handle, so many iterators can be used without worries
+ * of io errors.
+ */
public class CtfIterator extends CTFTraceReader implements ITmfContext,
Comparable<CtfIterator> {
* Create a new CTF trace iterator, which initially points at the first
* event in the trace.
*
- * @param trace
+ * @param trace the trace to iterate over
*/
public CtfIterator(final CtfTmfTrace trace) {
super(trace.getCTFTrace());
this.curRank = UNKNOWN_RANK;
}
+ /**
+ * Constructor for CtfIterator.
+ * @param trace CtfTmfTrace the trace
+ * @param timestampValue long the timestamp in ns of the trace for positioning
+ * @param rank long the index of the trace for positioning
+ */
public CtfIterator(final CtfTmfTrace trace, final long timestampValue,
final long rank) {
super(trace.getCTFTrace());
}
+ /**
+ * Method getCtfTmfTrace. gets a CtfTmfTrace
+ * @return CtfTmfTrace
+ */
public CtfTmfTrace getCtfTmfTrace() {
return ctfTmfTrace;
}
+ /**
+ * Method getCurrentEvent. gets the current event
+ * @return CtfTmfEvent
+ */
public CtfTmfEvent getCurrentEvent() {
final StreamInputReader top = super.prio.peek();
if (top != null) {
return null;
}
+ /**
+ * Method seek. Seeks to a given timestamp
+ * @param timestamp long the timestamp in ns (utc)
+ * @return boolean
+ */
@Override
public boolean seek(final long timestamp) {
boolean ret = false;
return ret;
}
+ /**
+ * Method seekRank. seeks to a given rank
+ * @param rank long the rank to seek to
+ * @return boolean
+ */
public boolean seekRank(final long rank) {
boolean ret = false;
ret = super.seekIndex(rank);
return ret;
}
+ /**
+ * Method getRank.
+ * @return long
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getRank()
+ */
@Override
public long getRank() {
return super.getIndex();
}
+ /**
+ * Method setRank.
+ * @param rank long
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setRank(long)
+ */
@Override
public void setRank(final long rank) {
if(!this.curLocation.equals(nullLocation)) {
return clone;
}
+ /**
+ * Method dispose.
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#dispose()
+ */
@Override
public void dispose() {
// FIXME add dispose() stuff to CTFTrace and call it here...
}
+ /**
+ * Method setLocation.
+ * @param location ITmfLocation<?>
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#setLocation(ITmfLocation<?>)
+ */
@Override
public void setLocation(final ITmfLocation<?> location) {
// FIXME alex: isn't there a cleaner way than a cast here?
seek(((CtfLocation) location).getLocation());
}
+ /**
+ * Method getLocation.
+ * @return CtfLocation
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#getLocation()
+ */
@Override
public CtfLocation getLocation() {
return curLocation;
}
+ /**
+ * Method increaseRank.
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#increaseRank()
+ */
@Override
public void increaseRank() {
curRank++;
}
+ /**
+ * Method hasValidRank, if the iterator is valid
+ * @return boolean
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfContext#hasValidRank()
+ */
@Override
public boolean hasValidRank() {
return (getRank() >= 0);
}
+ /**
+ * Method advance go to the next event
+ * @return boolean successful or not
+ */
@Override
public boolean advance() {
return super.advance();
}
+ /**
+ * Method compareTo.
+ * @param o CtfIterator
+ * @return int -1, 0, 1
+ */
@Override
public int compareTo(final CtfIterator o) {
if (this.getRank() < o.getRank()) {
}
return 0;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = (prime * result)
+ + ((ctfTmfTrace == null) ? 0 : ctfTmfTrace.hashCode());
+ result = (prime * result)
+ + ((curLocation == null) ? 0 : curLocation.hashCode());
+ result = (prime * result) + (int) (curRank ^ (curRank >>> 32));
+ return result;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof CtfIterator)) {
+ return false;
+ }
+ CtfIterator other = (CtfIterator) obj;
+ if (ctfTmfTrace == null) {
+ if (other.ctfTmfTrace != null) {
+ return false;
+ }
+ } else if (!ctfTmfTrace.equals(other.ctfTmfTrace)) {
+ return false;
+ }
+ if (curLocation == null) {
+ if (other.curLocation != null) {
+ return false;
+ }
+ } else if (!curLocation.equals(other.curLocation)) {
+ return false;
+ }
+ if (curRank != other.curRank) {
+ return false;
+ }
+ return true;
+ }
}
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+/**
+ * The ctflocation is the nugget of information that is unique to a location in a trace.
+ * it can be copied and used to restore a position in a given trace.
+ */
public class CtfLocation implements ITmfLocation<Long> {
public static final Long INVALID_LOCATION = -1L;
+ /**
+ * Constructor for CtfLocation.
+ * @param location Long
+ */
public CtfLocation(Long location) {
setLocation(location);
}
+ /**
+ * Constructor for CtfLocation.
+ * @param timestamp ITmfTimestamp
+ */
public CtfLocation(ITmfTimestamp timestamp) {
setLocation(timestamp.getValue());
}
private Long fTimestamp;
-// @Override
+ /**
+ * Method setLocation.
+ * @param location Long
+ */
public void setLocation(Long location) {
this.fTimestamp = location;
}
+ /**
+ * Method getLocation.
+ * @return Long
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#getLocation()
+ */
@Override
public Long getLocation() {
return this.fTimestamp;
}
+ /**
+ * Method clone.
+ * @return CtfLocation
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfLocation#clone()
+ */
@Override
public CtfLocation clone() {
return new CtfLocation(getLocation());
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+/**
+ * CtfTmfcontent is a wrapper to allow pretty printing of the fields in a CtfTmfEvent
+ */
public class CtfTmfContent extends TmfEventField {
+ /**
+ * Constructor for CtfTmfContent.
+ * @param name String
+ * @param fields ITmfEventField[]
+ */
public CtfTmfContent(String name, ITmfEventField[] fields) {
super(name, fields);
}
* the StreamInputReader).
*
* @param eventDef
- * @param top
+
+ * @param fileName String
+ * @param originTrace CtfTmfTrace
*/
public CtfTmfEvent(EventDefinition eventDef, String fileName,
CtfTmfTrace originTrace) {
* mess, and put them into something ITmfEventField can cope with.
*
* @param eventDef
- * @return
+
+ * @return CtfTmfEventField[]
*/
private static CtfTmfEventField[] parseFields(EventDefinition eventDef) {
List<CtfTmfEventField> fields = new ArrayList<CtfTmfEventField>();
/**
* Get a null event
*
- * @return an empty event.
- */
+ * @return an empty event. */
public static CtfTmfEvent getNullEvent() {
if (nullEvent == null) {
nullEvent = new CtfTmfEvent();
/**
* Gets the current timestamp of the event
*
- * @return the current timestamp (long)
- */
+ * @return the current timestamp (long) */
public long getTimestampValue() {
return this.timestamp;
}
/**
* Gets the cpu core the event was recorded on.
*
- * @return the cpu id for a given source. In lttng it's from CPUINFO
- */
+ * @return the cpu id for a given source. In lttng it's from CPUINFO */
public int getCPU() {
return this.sourceCPU;
}
* this ID is not constant from one trace to another for the same event
* types! Use "getEventName()" for a constant reference.
*
- * @return the event ID
- */
+
+ * @return the event ID */
public long getID() {
return this.typeId;
}
/**
* Gets the name of a current event.
*
- * @return the event name
- */
+ * @return the event name */
public String getEventName() {
return eventName;
}
/**
* Gets the channel name of a field.
*
- * @return the channel name.
- */
+ * @return the channel name. */
public String getChannelName() {
return this.fileName;
}
+ /**
+ * Method getTrace.
+ * @return CtfTmfTrace
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getTrace()
+ */
@Override
public CtfTmfTrace getTrace() {
return fTrace;
}
+ /**
+ * Method getRank.
+ * @return long
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getRank()
+ */
@Override
public long getRank() {
// TODO Auto-generated method stub
// TODO Benchmark if the singleton approach is faster than just
// instantiating a final fTimestramp right away at creation time
+ /**
+ * Method getTimestamp.
+ * @return ITmfTimestamp
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getTimestamp()
+ */
@Override
public ITmfTimestamp getTimestamp() {
if (fTimestamp == null) {
}
String fSource = null;
+ /**
+ * Method getSource.
+ * @return String
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getSource()
+ */
@Override
public String getSource() {
// TODO Returns CPU for now
}
private CtfTmfEventType type = null;
+ /**
+ * Method getType.
+ * @return ITmfEventType
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getType()
+ */
@Override
public ITmfEventType getType() {
if(type == null){
return type;
}
+ /**
+ * Method getContent.
+ * @return ITmfEventField
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getContent()
+ */
@Override
public ITmfEventField getContent() {
return fContent;
}
String fReference = null;
+ /**
+ * Method getReference.
+ * @return String
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#getReference()
+ */
@Override
public String getReference() {
if( fReference == null){
return fReference;
}
+ /**
+ * Method clone.
+ * @return CtfTmfEvent
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEvent#clone()
+ */
@Override
public CtfTmfEvent clone() {
return new CtfTmfEvent(this);
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor for CtfTmfEventField.
+ * @param name String
+ */
protected CtfTmfEventField(String name) {
/* Strip the damn underscores, screw you CTF */
if ( name.startsWith("_") ) { //$NON-NLS-1$
// Getters/Setters/Predicates
// ------------------------------------------------------------------------
+ /**
+ * Method getName.
+ * @return String
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getName()
+ */
@Override
public String getName() {
return this.name;
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Method parseField.
+ * @param fieldDef Definition
+ * @param fieldName String
+ * @return CtfTmfEventField
+ */
public static CtfTmfEventField parseField(Definition fieldDef,
String fieldName) {
CtfTmfEventField field = null;
return field;
}
+ /**
+ * Method copyFrom.
+ * @param other CtfTmfEventField
+ * @return CtfTmfEventField
+ */
public static CtfTmfEventField copyFrom(CtfTmfEventField other) {
switch (other.getFieldType()) {
case 0:
}
}
+ /**
+ * Method clone.
+ * @return CtfTmfEventField
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#clone()
+ */
@Override
public CtfTmfEventField clone() {
return CtfTmfEventField.copyFrom(this);
/**
* Return the int representing this field's value type
*
- * @return the field type
- */
+
+ * @return the field type */
public abstract int getFieldType();
/**
* Return this field's value. You can cast it to the correct type depending
* on what getFieldType says.
*
- * @return the field value
+
+ * @return the field value * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
*/
@Override
public abstract Object getValue();
* Other methods defined by ITmfEventField, but not used here: the CTF
* fields do not have sub-fields (yet!)
*
- * @return the field names
+
+ * @return the field names * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFieldNames()
*/
@Override
public String[] getFieldNames() {
return null;
}
+ /**
+ * Method getFieldName.
+ * @param index int
+ * @return String
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFieldName(int)
+ */
@SuppressWarnings("unused")
@Override
public String getFieldName(int index) {
return null;
}
+ /**
+ * Method getFields.
+ * @return ITmfEventField[]
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getFields()
+ */
@Override
public ITmfEventField[] getFields() {
return null;
}
+ /**
+ * Method getField.
+ * @param fieldName String
+ * @return ITmfEventField
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getField(String)
+ */
@SuppressWarnings("unused")
@Override
public ITmfEventField getField(String fieldName) {
return null;
}
+ /**
+ * Method getField.
+ * @param index int
+ * @return ITmfEventField
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getField(int)
+ */
@SuppressWarnings("unused")
@Override
public ITmfEventField getField(int index) {
/**
* <b><u>CTFIntegerField</u></b>
+ * @author ematkho
+ * @version $Revision: 1.0 $
*/
final class CTFIntegerField extends CtfTmfEventField {
/**
* A CTF "IntegerDefinition" can be an integer of any byte size, so in the
* Java parser this is interpreted as a long.
+ * @param longValue long
+ * @param name String
*/
CTFIntegerField(long longValue, String name) {
super(name);
this.longValue = longValue;
}
+ /**
+ * Method getFieldType.
+ * @return int
+ */
@Override
public int getFieldType() {
return 0;
}
+ /**
+ * Method getValue.
+ * @return Long
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+ */
@Override
public Long getValue() {
return this.longValue;
/**
* <b><u>CTFStringField</u></b>
+ * @author ematkho
+ * @version $Revision: 1.0 $
*/
final class CTFStringField extends CtfTmfEventField {
private final String strValue;
+ /**
+ * Constructor for CTFStringField.
+ * @param strValue String
+ * @param name String
+ */
CTFStringField(String strValue, String name) {
super(name);
this.strValue = strValue;
}
+ /**
+ * Method getFieldType.
+ * @return int
+ */
@Override
public int getFieldType() {
return 1;
}
+ /**
+ * Method getValue.
+ * @return String
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+ */
@Override
public String getValue() {
return this.strValue;
/**
* <b><u>CTFIntegerArrayField</u></b>
+ * @author ematkho
+ * @version $Revision: 1.0 $
*/
final class CTFIntegerArrayField extends CtfTmfEventField {
private final long[] longValues;
+ /**
+ * Constructor for CTFIntegerArrayField.
+ * @param longValues long[]
+ * @param name String
+ */
CTFIntegerArrayField(long[] longValues, String name) {
super(name);
this.longValues = longValues;
}
+ /**
+ * Method getFieldType.
+ * @return int
+ */
@Override
public int getFieldType() {
return 2;
}
+ /**
+ * Method getValue.
+ * @return long[]
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+ */
@Override
public long[] getValue() {
return this.longValues;
}
+ /**
+ * Method toString.
+ * @return String
+ */
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
}
}
+/**
+ */
final class CTFFloatField extends CtfTmfEventField {
Double value;
+ /**
+ * Constructor for CTFFloatField.
+ * @param value double
+ * @param name String
+ */
protected CTFFloatField(double value ,String name) {
super(name);
this.value = value;
}
+ /**
+ * Method getFieldType.
+ * @return int
+ */
@Override
public int getFieldType() {
return 3;
}
+ /**
+ * Method getValue.
+ * @return Object
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfEventField#getValue()
+ */
@Override
public Object getValue() {
return this.value;
}
+ /**
+ * Method toString.
+ * @return String
+ */
@Override
public String toString(){
return name + '=' + value;
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
+/**
+ */
public class CtfTmfEventType extends TmfEventType {
+ /**
+ * Constructor for CtfTmfEventType.
+ * @param contextId String
+ * @param eventName String
+ * @param content ITmfEventField
+ */
public CtfTmfEventType(String contextId, String eventName,
ITmfEventField content) {
super(contextId, eventName, content);
}
+ /**
+ * Method toString.
+ * @return String
+ */
@Override
public String toString()
{
import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+/**
+ */
public class CtfTmfTimestamp extends TmfTimestamp {
+ /**
+ */
public enum TimestampType {
FULL_DATE, DAY, NANOS, SECONDS
}
private TimestampType type;
+ /**
+ * Constructor for CtfTmfTimestamp.
+ * @param timestamp long
+ */
public CtfTmfTimestamp(long timestamp) {
setValue(timestamp, -9, 0);
type = TimestampType.DAY;
}
+ /**
+ * Method setType.
+ * @param value TimestampType
+ */
public void setType(TimestampType value) {
type = value;
}
+ /**
+ * Method getType.
+ * @return TimestampType
+ */
public TimestampType getType() {
return type;
}
* org.eclipse.linuxtools.tmf.core.event.TmfTimestamp#getDelta(org.eclipse
* .linuxtools.tmf.core.event.ITmfTimestamp)
*/
+ /**
+ * Method getDelta.
+ * @param ts ITmfTimestamp
+ * @return ITmfTimestamp
+ * @see org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp#getDelta(ITmfTimestamp)
+ */
@Override
public ITmfTimestamp getDelta(ITmfTimestamp ts) {
TmfTimestamp parent = (TmfTimestamp) super.getDelta(ts);
return super.toString();
}
+ /**
+ * Method secondsToString.
+ * @return String
+ */
private String secondsToString() {
double timestamp = getValue();
timestamp /= 1000000000;
return retVal.toString();
}
+ /**
+ * Method nanoToString.
+ * @return String
+ */
private String nanoToString() {
final long timestamp = getValue();
StringBuilder retVal = new StringBuilder();
return retVal.toString();
}
+ /**
+ * Method dateToString.
+ * @return String
+ */
private String dateToString() {
final long timestamp = getValue();
final Date d = new Date(timestamp / 1000000);
return output.toString();
}
+ /**
+ * Method toFullDateString.
+ * @return String
+ */
private String toFullDateString() {
final long timestamp = getValue();
final Date d = new Date(timestamp / 1000000);
return output.toString();
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = (prime * result) + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof CtfTmfTimestamp)) {
+ return false;
+ }
+ CtfTmfTimestamp other = (CtfTmfTimestamp) obj;
+ if (type != other.type) {
+ return false;
+ }
+ return true;
+ }
+
}
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.core.resources.IProject;
import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+/**
+ */
public class CtfTmfTrace extends TmfEventProvider<CtfTmfEvent> implements ITmfTrace<CtfTmfEvent> {
// ------------------------------------------------------------------------
super();
}
+ /**
+ * Method initTrace.
+ * @param resource IResource
+ * @param path String
+ * @param eventType Class<CtfTmfEvent>
+ * @throws TmfTraceException
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#initTrace(IResource, String, Class<CtfTmfEvent>)
+ */
@SuppressWarnings("unused")
@Override
public void initTrace(final IResource resource, final String path, final Class<CtfTmfEvent> eventType)
setStartTime(iterator.getCurrentEvent().getTimestamp());
}
TmfSignalManager.register(this);
- // this.currLocation.setTimestamp(this.fEvent.getTimestamp().getValue());
- // this.fStartTime = new TmfSimpleTimestamp(this.currLocation
- // .getLocation().getStartTime());
- // this.fEndTime = new TmfSimpleTimestamp(this.currLocation
- // .getLocation().getEndTime());
- // setTimeRange(new TmfTimeRange(this.fStartTime.clone(),
- // this.fEndTime.clone()));
-
+ // FIXME this should become a request
buildStateSystem();
/* Refresh the project, so it can pick up new files that got created. */
}
}
+ /**
+ * Method dispose.
+ * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#dispose()
+ */
@Override
public void dispose() {
TmfSignalManager.deregister(this);
}
+ /**
+ * Method broadcast.
+ * @param signal TmfSignal
+ * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#broadcast(TmfSignal)
+ */
@Override
public void broadcast(final TmfSignal signal) {
TmfSignalManager.dispatchSignal(signal);
}
+ /**
+ * Method validate.
+ * @param project IProject
+ * @param path String
+ * @return boolean
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(IProject, String)
+ */
@SuppressWarnings("unused")
@Override
public boolean validate(final IProject project, final String path) {
}
}
- @Override
- public CtfTmfTrace clone() throws CloneNotSupportedException {
- CtfTmfTrace clone = null;
- clone = (CtfTmfTrace) super.clone();
- clone.fStartTime = this.fStartTime.clone();
- clone.fEndTime = this.fEndTime.clone();
- clone.fTrace = this.fTrace;
- return clone;
- }
-
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
/**
+ * Method getEventType.
* @return the trace path
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getEventType()
*/
@Override
public Class<CtfTmfEvent> getEventType() {
return fType;
}
+ /**
+ * Method getNbEnvVars.
+ * @return int
+ */
public int getNbEnvVars() {
return this.fTrace.getEnvironment().size();
}
+ /**
+ * Method getEnvNames.
+ * @return String[]
+ */
public String[] getEnvNames() {
final String[] s = new String[getNbEnvVars()];
return this.fTrace.getEnvironment().keySet().toArray(s);
}
+ /**
+ * Method getEnvValue.
+ * @param key String
+ * @return String
+ */
public String getEnvValue(final String key) {
return this.fTrace.getEnvironment().get(key);
}
/**
- * @return the trace path
+
+ * @return the trace path * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getPath()
*/
@Override
public String getPath() {
return this.fTrace.getPath();
}
+ /**
+ * Method getName.
+ * @return String
+ * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#getName()
+ */
@Override
public String getName() {
String traceName = (fResource != null) ? fResource.getName() : null;
return traceName;
}
+ /**
+ * Method getCacheSize.
+ * @return int
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCacheSize()
+ */
@Override
public int getCacheSize() {
return 50000; // not true, but it works
}
+ /**
+ * Method getNbEvents.
+ * @return long
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getNbEvents()
+ */
@Override
public long getNbEvents() {
return this.fNbEvents;
}
+ /**
+ * Method getTimeRange.
+ * @return TmfTimeRange
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getTimeRange()
+ */
@Override
public TmfTimeRange getTimeRange() {
return new TmfTimeRange(this.fStartTime, this.fEndTime);
}
+ /**
+ * Method getStartTime.
+ * @return ITmfTimestamp
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getStartTime()
+ */
@Override
public ITmfTimestamp getStartTime() {
return this.fStartTime;
}
+ /**
+ * Method getEndTime.
+ * @return ITmfTimestamp
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getEndTime()
+ */
@Override
public ITmfTimestamp getEndTime() {
return this.fEndTime;
}
+ /**
+ * Method getCurrentLocation.
+ * @return ITmfLocation<?>
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
+ */
@Override
public ITmfLocation<?> getCurrentLocation() {
return iterator.getLocation();
// Operators
// ------------------------------------------------------------------------
+ /**
+ * Method setTimeRange.
+ * @param range TmfTimeRange
+ */
protected void setTimeRange(final TmfTimeRange range) {
this.fStartTime = range.getStartTime();
this.fEndTime = range.getEndTime();
}
+ /**
+ * Method setStartTime.
+ * @param startTime ITmfTimestamp
+ */
protected void setStartTime(final ITmfTimestamp startTime) {
this.fStartTime = startTime;
}
+ /**
+ * Method setEndTime.
+ * @param endTime ITmfTimestamp
+ */
protected void setEndTime(final ITmfTimestamp endTime) {
this.fEndTime = endTime;
}
// TmfProvider
// ------------------------------------------------------------------------
+ /**
+ * Method armRequest.
+ * @param request ITmfDataRequest<CtfTmfEvent>
+ * @return ITmfContext
+ */
@Override
public ITmfContext armRequest(final ITmfDataRequest<CtfTmfEvent> request) {
if ((request instanceof ITmfEventRequest<?>)
*
* FIXME merge with getNextEvent below once they both use the same parameter
* type.
+ * @param context ITmfContext
+ * @return CtfTmfEvent
*/
@SuppressWarnings("unused")
@Override
// ITmfTrace
// ------------------------------------------------------------------------
+ /**
+ * Method seekEvent.
+ * @param location ITmfLocation<?>
+ * @return ITmfContext
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(ITmfLocation<?>)
+ */
@Override
public ITmfContext seekEvent(final ITmfLocation<?> location) {
CtfLocation currentLocation = (CtfLocation) location;
return iterator;
}
+ /**
+ * Method getLocationRatio.
+ * @param location ITmfLocation<?>
+ * @return double
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getLocationRatio(ITmfLocation<?>)
+ */
@Override
public double getLocationRatio(final ITmfLocation<?> location) {
final CtfLocation curLocation = (CtfLocation) location;
/ (iterator.getEndTime() - iterator.getStartTime());
}
+ /**
+ * Method getStreamingInterval.
+ * @return long
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getStreamingInterval()
+ */
@Override
public long getStreamingInterval() {
return 0;
}
+ /**
+ * Method seekEvent.
+ * @param timestamp ITmfTimestamp
+ * @return ITmfContext
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(ITmfTimestamp)
+ */
@Override
public ITmfContext seekEvent(final ITmfTimestamp timestamp) {
iterator.seek(timestamp.getValue());
/**
* Seek by rank
+ * @param rank long
+ * @return ITmfContext
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(long)
*/
@Override
public ITmfContext seekEvent(final long rank) {
/**
* Seek rank ratio
+ * @param ratio double
+ * @return ITmfContext
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#seekEvent(double)
*/
@Override
public ITmfContext seekEvent(final double ratio) {
return iterator;
}
+ /**
+ * Method readNextEvent.
+ * @param context ITmfContext
+ * @return CtfTmfEvent
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#readNextEvent(ITmfContext)
+ */
@SuppressWarnings("unused")
@Override
public CtfTmfEvent readNextEvent(final ITmfContext context) {
return iterator.getCurrentEvent();
}
+ /**
+ * Method getResource.
+ * @return IResource
+ * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getResource()
+ */
@Override
public IResource getResource() {
return this.fResource;
}
+ /**
+ * Method getStateSystem.
+ * @return IStateSystemQuerier
+ */
public IStateSystemQuerier getStateSystem() {
return this.ss;
}
+ /**
+ * Method getCTFTrace.
+ * @return CTFTrace
+ */
CTFTrace getCTFTrace() {
return fTrace;
}
/**
* Suppressing the warning, because the 'throws' will usually happen in
* sub-classes.
+ * @throws TmfTraceException
*/
@SuppressWarnings({ "unused", "static-method" })
protected void buildStateSystem() throws TmfTraceException {