summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorEtienne Bergeron2013-11-16 22:57:50 (EST)
committer Alexandre Montplaisir2013-11-26 15:09:50 (EST)
commite8d13b2ef23e50ac8686549d3ba44abc4e163c04 (patch)
tree2833be08e3e192fa2347470da59a9c03a789f03e
parent75e41738707e0e8cd4334a634280fc39e88bb9c1 (diff)
downloadorg.eclipse.linuxtools-e8d13b2ef23e50ac8686549d3ba44abc4e163c04.zip
org.eclipse.linuxtools-e8d13b2ef23e50ac8686549d3ba44abc4e163c04.tar.gz
org.eclipse.linuxtools-e8d13b2ef23e50ac8686549d3ba44abc4e163c04.tar.bz2
ctf: Fix multiple coding style and typo issues while reading code.refs/changes/41/18541/12
Change-Id: If63330f4c86e7cd87cf979e1709a81fb7c8958ab Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Reviewed-on: https://git.eclipse.org/r/18541 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Hudson CI
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java24
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java6
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java11
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java13
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/EventDeclaration.java4
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java4
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/exceptions/ParseException.java2
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndex.java9
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java6
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java1
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java3
14 files changed, 39 insertions, 49 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
index 812f6bd..3929001 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
@@ -258,9 +258,6 @@ public class CTFTraceReader {
*/
public boolean advance() {
/*
- * Index the
- */
- /*
* Remove the reader from the top of the priority queue.
*/
StreamInputReader top = this.prio.poll();
@@ -306,15 +303,16 @@ public class CTFTraceReader {
}
/**
- * Seeks to a given timestamp It will go to the event just after the
- * timestamp or the timestamp itself. if a if a trace is 10 20 30 40 and
- * you're looking for 19, it'll give you 20, it you want 20, you'll get 20,
- * if you want 21, you'll get 30. You want -inf, you'll get the first
- * element, you want +inf, you'll get the end of the file with no events.
+ * Seeks to a given timestamp. It will seek to the nearest event greater or
+ * equal to timestamp. If a trace is [10 20 30 40] and you are looking for
+ * 19, it will give you 20. If you want 20, you will get 20, if you want 21,
+ * you will get 30. The value -inf will seek to the first element and the
+ * value +inf will seek to the end of the file (past the last event).
*
* @param timestamp
* the timestamp to seek to
- * @return true if the trace has more events following the timestamp
+ * @return true if there are events above or equal the seek timestamp,
+ * false if seek at the end of the trace (no valid event).
*/
public boolean seek(long timestamp) {
/*
@@ -330,19 +328,15 @@ public class CTFTraceReader {
/*
* Add it to the priority queue if there is a current event.
*/
-
- }
- for (StreamInputReader streamInputReader : this.streamInputReaders) {
if (streamInputReader.getCurrentEvent() != null) {
this.prio.add(streamInputReader);
-
}
}
return hasMoreEvents();
}
/**
- * gets the stream with the oldest event
+ * Gets the stream with the oldest event
*
* @return the stream with the oldest event
*/
@@ -405,7 +399,7 @@ public class CTFTraceReader {
}
/**
- * gets the last event timestamp that was read. This is NOT necessarily the
+ * Gets the last event timestamp that was read. This is NOT necessarily the
* last event in a trace, just the last one read so far.
*
* @return the last event
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
index 64e5066..7c9eed0 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
@@ -239,8 +239,8 @@ public class Metadata {
private boolean isPacketBased(FileChannel metadataFileChannel)
throws CTFReaderException {
/*
- * Create a ByteBuffer to read the TSDL magic number (default is big
- * endian)
+ * Create a ByteBuffer to read the TSDL magic number (default is
+ * big-endian)
*/
ByteBuffer magicByteBuffer = ByteBuffer.allocate(Utils.TSDL_MAGIC_LEN);
@@ -260,7 +260,7 @@ public class Metadata {
return true;
}
- /* Try the same thing, but with little endian */
+ /* Try the same thing, but with little-endian */
magicByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
magic = magicByteBuffer.getInt(0);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
index d8ad3d6..43d13de 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInput.java
@@ -115,7 +115,7 @@ public class StreamInput implements IDefinitionScope {
}
/**
- * the common streamInput Index
+ * The common streamInput Index
*
* @return the stream input Index
*/
@@ -125,7 +125,7 @@ public class StreamInput implements IDefinitionScope {
/**
* Gets the filechannel of the streamInput. This is a limited Java
- * ressource.
+ * resource.
*
* @return the filechannel
*/
@@ -143,7 +143,7 @@ public class StreamInput implements IDefinitionScope {
}
/**
- * gets the last read timestamp of a stream. (this is not necessarily the
+ * Gets the last read timestamp of a stream. (this is not necessarily the
* last time in the stream.)
*
* @return the last read timestamp
@@ -164,7 +164,7 @@ public class StreamInput implements IDefinitionScope {
}
/**
- * useless for streaminputs
+ * Useless for streaminputs
*/
@Override
public String getPath() {
@@ -352,7 +352,6 @@ public class StreamInput implements IDefinitionScope {
throw new CTFReaderException(
"CTF magic mismatch " + Integer.toHexString(magic) + " vs " + Integer.toHexString(Utils.CTF_MAGIC)); //$NON-NLS-1$//$NON-NLS-2$
}
-
}
/*
@@ -457,7 +456,7 @@ public class StreamInput implements IDefinitionScope {
/* Read the end timestamp */
if (tsEnd != null) {
- if( tsEnd == -1 ) {
+ if (tsEnd == -1) {
tsEnd = Long.MAX_VALUE;
}
packetIndex.setTimestampEnd(tsEnd.longValue());
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java
index 0d6641c..fdedf04 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java
@@ -110,7 +110,7 @@ public class StreamInputReader {
}
/**
- * gets the current packet context
+ * Gets the current packet context
*
* @return the current packet context (size, lost events and such)
*/
@@ -248,7 +248,6 @@ public class StreamInputReader {
if (this.streamInput.addPacketHeaderIndex()) {
packetIndex = getPacketSize() - 1;
this.packetReader.setCurrentPacket(getPacket());
-
} else {
this.packetReader.setCurrentPacket(null);
}
@@ -268,7 +267,7 @@ public class StreamInputReader {
/**
* Changes the location of the trace file reader so that the current event
- * is the first event with a timestamp greater than the given timestamp.
+ * is the first event with a timestamp greater or equal the given timestamp.
*
* @param timestamp
* The timestamp to seek to.
@@ -296,9 +295,11 @@ public class StreamInputReader {
}
/*
- * Advance until A. we reached the end of the trace file (which means
- * the given timestamp is after the last event), or B. we found the
- * first event with a timestamp greater than the given timestamp.
+ * Advance until either of these conditions are met
+ * <ul>
+ * <li> reached the end of the trace file (the given timestamp is after the last event), </li>
+ * <li> found the first event with a timestamp greater or equal the given timestamp. </li>
+ * </ul>
*/
readNextEvent();
boolean done = (this.getCurrentEvent() == null);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/EventDeclaration.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/EventDeclaration.java
index fa00efe..27848e2 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/EventDeclaration.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/EventDeclaration.java
@@ -171,7 +171,7 @@ public class EventDeclaration implements IEventDeclaration {
}
/**
- * Sets the id of am event declaration
+ * Sets the id of an event declaration
*
* @param id
* the id
@@ -186,7 +186,7 @@ public class EventDeclaration implements IEventDeclaration {
}
/**
- * Sets the stream of am event declaration
+ * Sets the stream of an event declaration
*
* @param stream
* the stream
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
index 13f27d5..d31d363 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
@@ -72,7 +72,7 @@ public class IOStructGen {
// ------------------------------------------------------------------------
/**
- * Constuctor
+ * Constructor
*
* @param tree
* the tree (ANTLR generated) with the parsed TSDL data.
@@ -256,7 +256,7 @@ public class IOStructGen {
for (CommonTree child : children) {
String left;
- /* this is a regex to find the leading and trailing quotes*/
+ /* this is a regex to find the leading and trailing quotes */
final String regex = "^\"|\"$"; //$NON-NLS-1$
/* this is to replace the previous quotes with nothing... effectively deleting them */
final String nullString = ""; //$NON-NLS-1$
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/exceptions/ParseException.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/exceptions/ParseException.java
index 9b11d06..7a56912 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/exceptions/ParseException.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/exceptions/ParseException.java
@@ -30,7 +30,7 @@ public class ParseException extends Exception {
/**
* Constructor
*
- * @param message (to be sent to logs
+ * @param message to be sent to logs
*/
public ParseException(String message) {
super(message);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndex.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndex.java
index 5532ad0..50c73ed 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndex.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndex.java
@@ -84,26 +84,25 @@ public class StreamInputPacketIndex {
public void addEntry(StreamInputPacketIndexEntry entry)
throws CTFReaderException {
assert (entry.getContentSizeBits() != 0);
- assert (entry.getContentSizeBits() != 0);
+ /* Validate consistent entry. */
if (entry.getTimestampBegin() > entry.getTimestampEnd()) {
throw new CTFReaderException("Packet begin timestamp is after end timestamp"); //$NON-NLS-1$
}
+ /* Validate entries are inserted in monotonic increasing timestamp order. */
if (!this.entries.isEmpty()) {
if (entry.getTimestampBegin() < this.entries.lastElement()
.getTimestampBegin()) {
throw new CTFReaderException("Packets begin timestamp decreasing"); //$NON-NLS-1$
}
}
-
this.entries.add(entry);
}
/**
- * This method returns the first packet with the end timestamp greater
- * or equal to the given timestamp. The returned packet is the first one
- * that could include the timestamp.
+ * Returns the first PacketIndexEntry that could include the timestamp,
+ * that is the last packet with a begin timestamp smaller than the given timestamp.
*
* @param timestamp
* The timestamp to look for.
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java
index f528404..fa2378b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTree.java
@@ -59,7 +59,7 @@ class HistoryTree {
private final HT_IO treeIO;
// ------------------------------------------------------------------------
- // Variable Fields (will change throughout the existance of the SHT)
+ // Variable Fields (will change throughout the existence of the SHT)
// ------------------------------------------------------------------------
/** Latest timestamp found in the tree (at any given moment) */
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
index 0f250a9..753ff29 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
@@ -85,7 +85,6 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
} else {
setUnknownLocation();
}
-
}
/**
@@ -157,7 +156,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
this.advance();
}
} else {
- ret= false;
+ ret = false;
}
/* Seek the current location accordingly */
if (ret) {
@@ -165,6 +164,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
} else {
curLocation = NULL_LOCATION;
}
+
return ret;
}
@@ -233,7 +233,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
@Override
public void increaseRank() {
/* Only increase the rank if it's valid */
- if(hasValidRank()) {
+ if (hasValidRank()) {
curRank++;
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
index 65fac21..afe436d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
@@ -139,7 +139,7 @@ class CtfTraceManager {
*
* @param context
* the context to look up
- * @return the iterator refering to the context
+ * @return the iterator referring to the context
*/
public CtfIterator getIterator(final CtfTmfContext context) {
/*
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
index 55acb6b..c33d6c2 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
@@ -143,6 +143,5 @@ public final class CtfLocation extends TmfLocation {
@Override
public void serialize(ByteBuffer bufferOut) {
getLocationInfo().serialize(bufferOut);
-
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java
index 7a3c467..cb97492 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java
@@ -133,6 +133,5 @@ public class CtfLocationInfo implements Comparable<CtfLocationInfo> {
public void serialize(ByteBuffer bufferOut) {
bufferOut.putLong(timestamp);
bufferOut.putLong(index);
-
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java
index fb50df7..05834bd 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java
@@ -40,7 +40,7 @@ public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
* @param fileName
* The name of the trace file from which this event comes
* @param cpu
- * The CPU on which this event happend
+ * The CPU on which this event happened
* @param declaration
* The CTF Event Declaration object that created this event
* @param timeRange
@@ -75,5 +75,4 @@ public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
return fNbLost;
}
-
}