Genericized CTF parser and events handling.
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 24 Jul 2012 19:38:15 +0000 (15:38 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 25 Jul 2012 14:08:30 +0000 (10:08 -0400)
Add support for enums in trace fields.
Add support for broken end timestamped traces. (experimental)
Add support for variant free id/timestamp pairings (non-lttng)
Add support for non-CPU based traces (dsp/gpu/fpga...)

Change-Id: I2e49f798ae5e2fefda0316631dbbb74609ba36aa
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/6951

org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/EnumDefinition.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDefinition.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/SimpleDatatypeDefinition.java [new file with mode: 0644]
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInput.java
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/trace/StreamInputPacketIndexEntry.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java

index d341d0a681467a6ad7fa15f8d00593f8f8c4451e..98ef3f48c9d578c0823f3dabdebb32d139c2394b 100644 (file)
@@ -16,7 +16,7 @@ import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
 
 /**
  * A CTF enum definition.
- * 
+ *
  * The definition of a enum point basic data type. It will take the data
  * from a trace and store it (and make it fit) as an integer and a string.
  *
@@ -24,7 +24,7 @@ import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
  * @author Matthew Khouzam
  * @author Simon Marchi
  */
-public class EnumDefinition extends Definition {
+public class EnumDefinition extends SimpleDatatypeDefinition {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -69,11 +69,17 @@ public class EnumDefinition extends Definition {
         return value;
     }
 
+    @Override
+    public String getStringValue(){
+        return getValue();
+    }
+
     /**
      * Gets the value of the enum in string format so "Enum a{DAY="0", NIGHT="1"}; will return 0
      * @return the value of the enum.
      */
-    public long getIntegerValue() {
+    @Override
+    public Long getIntegerValue() {
         return integerValue.getValue();
     }
 
index b39a97ce95eaf57fc6662146b2aa4f42973aee5e..e72d6ac37658e41e853cd5017b79a1caee299756 100644 (file)
@@ -27,7 +27,7 @@ import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
  * @author Matthew Khouzam
  * @author Simon Marchi
  */
-public class IntegerDefinition extends Definition {
+public class IntegerDefinition extends SimpleDatatypeDefinition {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -77,10 +77,28 @@ public class IntegerDefinition extends Definition {
         return declaration;
     }
 
+
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
 
+    /* (non-Javadoc)
+     * @see org.eclipse.linuxtools.ctf.core.event.types.SimpleDatatypeDefinition#getLongValue()
+     */
+    @Override
+    public Long getIntegerValue() {
+        return getValue();
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.linuxtools.ctf.core.event.types.SimpleDatatypeDefinition#getStringValue()
+     */
+    @Override
+    public String getStringValue() {
+        return this.toString();
+    }
+
     @Override
     public void read(BitBuffer input) {
         final long longNegBit = 0x0000000080000000L;
diff --git a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/SimpleDatatypeDefinition.java b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/SimpleDatatypeDefinition.java
new file mode 100644 (file)
index 0000000..23c492e
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ *
+ * 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.ctf.core.event.types;
+
+/**
+ * Simple Datatype definition is a datatype that allows the addition of
+ * getIntegerValue and getStringValue to a class.
+ *
+ * @author Matthew Khouzam
+ * @since 1.2
+ */
+public abstract class SimpleDatatypeDefinition extends Definition {
+
+    public SimpleDatatypeDefinition(IDefinitionScope definitionScope,
+            String fieldName) {
+        super(definitionScope, fieldName);
+    }
+
+    /**
+     * gets the value in integer form
+     *
+     * @return the integer in a Long, can be null
+     */
+    public Long getIntegerValue() {
+        return null;
+    }
+
+    /**
+     * gets the value in string form
+     *
+     * @return the integer in a String, can be null
+     */
+    public String getStringValue() {
+        return null;
+    }
+
+}
index 015e2543d96d7e29fbe31d57264bc847f655da27..333390b419aba0404993b00b87844760ccec27c4 100644 (file)
@@ -20,9 +20,9 @@ import java.util.HashMap;
 import org.eclipse.linuxtools.ctf.core.event.EventDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
-import org.eclipse.linuxtools.ctf.core.event.types.EnumDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.SimpleDatatypeDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.VariantDefinition;
@@ -294,25 +294,21 @@ public class StreamInputPacketReader implements IDefinitionScope {
                  * Read CPU ID
                  */
 
-                Definition cpuiddef = getStreamPacketContextDef()
-                        .lookupDefinition("cpu_id"); //$NON-NLS-1$
-                if (cpuiddef instanceof IntegerDefinition) {
-                    currentCpu = (int) ((IntegerDefinition) cpuiddef)
-                            .getValue();
+                if (this.getCurrentPacket().getTarget() != null) {
+                    this.currentCpu = (int) this.getCurrentPacket()
+                            .getTargetId();
                 }
                 /*
                  * Read number of lost events
                  */
-                Definition lostEventsdef = getStreamPacketContextDef()
-                        .lookupDefinition("events_discarded"); //$NON-NLS-1$
-                if (cpuiddef instanceof IntegerDefinition) {
-                    int totalLostEvents = (int) ((IntegerDefinition) lostEventsdef)
-                            .getValue();
-                    lostEventsInThisPacket = totalLostEvents - lostEvents;
-                    lostEvents = totalLostEvents;
-                    currentPacket.setLostEvents(lostEventsInThisPacket);
-                    lostSoFar = 0;
-                }
+
+                int totalLostEvents = (int) this.getCurrentPacket()
+                        .getLostEvents();
+                lostEventsInThisPacket = totalLostEvents - lostEvents;
+                lostEvents = totalLostEvents;
+                currentPacket.setLostEvents(lostEventsInThisPacket);
+                lostSoFar = 0;
+
             }
 
             /*
@@ -349,7 +345,7 @@ public class StreamInputPacketReader implements IDefinitionScope {
      *             If there was a problem reading the trace
      */
     public EventDefinition readNextEvent() throws CTFReaderException {
-        /* WARNING: This is very LTTng-specific. */
+        /* WARNING: This is still LTTng-specific. */
         Long eventID = null;
         long timestamp = 0;
 
@@ -374,42 +370,40 @@ public class StreamInputPacketReader implements IDefinitionScope {
             /*
              * Check for an event id.
              */
-            EnumDefinition idEnumDef = (EnumDefinition) sehd
+            SimpleDatatypeDefinition idDef = (SimpleDatatypeDefinition) sehd
                     .lookupDefinition("id"); //$NON-NLS-1$
-            assert (idEnumDef != null);
-
-            eventID = idEnumDef.getIntegerValue();
+            IntegerDefinition timestampDef = sehd.lookupInteger("timestamp"); //$NON-NLS-1$
+            eventID = idDef.getIntegerValue();
 
             /*
              * Check for the variant v.
              */
             VariantDefinition variantDef = (VariantDefinition) sehd
                     .lookupDefinition("v"); //$NON-NLS-1$
-            assert (variantDef != null);
+            if (variantDef != null) {
 
-            /*
-             * Get the variant current field
-             */
-            StructDefinition variantCurrentField = (StructDefinition) variantDef
-                    .getCurrentField();
-            assert (variantCurrentField != null);
+                /*
+                 * Get the variant current field
+                 */
+                StructDefinition variantCurrentField = (StructDefinition) variantDef
+                        .getCurrentField();
 
-            /*
-             * Try to get the id field in the current field of the variant. If
-             * it is present, it overrides the previously read event id.
-             */
-            IntegerDefinition idIntegerDef = (IntegerDefinition) variantCurrentField
-                    .lookupDefinition("id"); //$NON-NLS-1$
-            if (idIntegerDef != null) {
-                eventID = idIntegerDef.getValue();
-            }
+                /*
+                 * Try to get the id field in the current field of the variant.
+                 * If it is present, it overrides the previously read event id.
+                 */
+                IntegerDefinition idIntegerDef = (IntegerDefinition) variantCurrentField
+                        .lookupDefinition("id"); //$NON-NLS-1$
+                if (idIntegerDef != null) {
+                    eventID = idIntegerDef.getValue();
+                }
+                /*
+                 * Get the timestamp.
+                 */
+                timestampDef = (IntegerDefinition) variantCurrentField
+                        .lookupDefinition("timestamp"); //$NON-NLS-1$
 
-            /*
-             * Get the timestamp.
-             */
-            IntegerDefinition timestampDef = (IntegerDefinition) variantCurrentField
-                    .lookupDefinition("timestamp"); //$NON-NLS-1$
-            assert (timestampDef != null);
+            }
 
             /*
              * Calculate the event timestamp.
index 6fb5ebb58d68791a2ce88030efa350cbc218def8..0ec21d72e750fe7a3d482a725a81bfb75da744a1 100644 (file)
@@ -57,8 +57,6 @@ public class StreamInputReader {
 
     private CTFTraceReader parent;
 
-    @SuppressWarnings("unused")
-    private final long prevIndex;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -77,8 +75,6 @@ public class StreamInputReader {
          * Get the iterator on the packet index.
          */
         this.packetIndex = 0;
-
-        this.prevIndex = 0;
         /*
          * Make first packet the current one.
          */
index e2d4a760724ba54d5c5ce5659ec8f161cf78767e..d5f4609853944fece2235ad2aa1fab1b86faf8e5 100644 (file)
@@ -21,8 +21,11 @@ import java.util.UUID;
 
 import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
+import org.eclipse.linuxtools.ctf.core.event.types.EnumDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.StringDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.Utils;
@@ -98,6 +101,7 @@ public class StreamInput implements IDefinitionScope {
 
     /**
      * Gets the stream the streamInput wrapper is wrapping
+     *
      * @return the stream the streamInput wrapper is wrapping
      */
     public Stream getStream() {
@@ -106,6 +110,7 @@ public class StreamInput implements IDefinitionScope {
 
     /**
      * the common streamInput Index
+     *
      * @return the stream input Index
      */
     public StreamInputPacketIndex getIndex() {
@@ -113,7 +118,9 @@ public class StreamInput implements IDefinitionScope {
     }
 
     /**
-     * Gets the filechannel of the streamInput. This is a limited Java ressource.
+     * Gets the filechannel of the streamInput. This is a limited Java
+     * ressource.
+     *
      * @return the filechannel
      */
     public FileChannel getFileChannel() {
@@ -122,6 +129,7 @@ public class StreamInput implements IDefinitionScope {
 
     /**
      * Gets the filename of the streamInput file.
+     *
      * @return the filename of the streaminput file.
      */
     public String getFilename() {
@@ -129,7 +137,9 @@ public class StreamInput implements IDefinitionScope {
     }
 
     /**
-     * gets the last read timestamp of a stream. (this is not necessarily the last time in the stream.)
+     * gets the last read timestamp of a stream. (this is not necessarily the
+     * last time in the stream.)
+     *
      * @return the last read timestamp
      */
     public long getTimestampEnd() {
@@ -137,8 +147,11 @@ public class StreamInput implements IDefinitionScope {
     }
 
     /**
-     * Sets the last read timestamp of a stream. (this is not necessarily the last time in the stream.)
-     * @param timestampEnd the last read timestamp
+     * Sets the last read timestamp of a stream. (this is not necessarily the
+     * last time in the stream.)
+     *
+     * @param timestampEnd
+     *            the last read timestamp
      */
     public void setTimestampEnd(long timestampEnd) {
         this.timestampEnd = timestampEnd;
@@ -167,7 +180,6 @@ public class StreamInput implements IDefinitionScope {
      */
     public void setupIndex() {
 
-
         /*
          * The BitBuffer to extract data from the StreamInput
          */
@@ -226,8 +238,8 @@ public class StreamInput implements IDefinitionScope {
             StructDefinition tracePacketHeaderDef,
             StructDefinition streamPacketContextDef, BitBuffer bitBuffer)
             throws CTFReaderException {
-            @SuppressWarnings("unused")
-            MappedByteBuffer bb = createPacketBitBuffer(fileSizeBytes,
+        @SuppressWarnings("unused")
+        MappedByteBuffer bb = createPacketBitBuffer(fileSizeBytes,
                 packetOffsetBytes, packetIndex, bitBuffer);
 
         /*
@@ -266,8 +278,7 @@ public class StreamInput implements IDefinitionScope {
         /*
          * Update the counting packet offset
          */
-        packetOffsetBytes = computeNextOffset(packetIndex);
-        return packetOffsetBytes;
+        return computeNextOffset(packetIndex);
     }
 
     /**
@@ -389,13 +400,38 @@ public class StreamInput implements IDefinitionScope {
             StreamInputPacketIndexEntry packetIndex) {
         streamPacketContextDef.read(bitBuffer);
 
+        for (String field : streamPacketContextDef.getDeclaration()
+                .getFieldsList()) {
+            Definition id = streamPacketContextDef.lookupDefinition(field);
+            if (id instanceof IntegerDefinition) {
+                packetIndex.addAttribute(field,
+                        ((IntegerDefinition) id).getValue());
+            } else if (id instanceof FloatDefinition) {
+                packetIndex.addAttribute(field,
+                        ((FloatDefinition) id).getValue());
+            } else if (id instanceof EnumDefinition) {
+                packetIndex.addAttribute(field,
+                        ((EnumDefinition) id).getValue());
+            } else if (id instanceof StringDefinition) {
+                packetIndex.addAttribute(field,
+                        ((StringDefinition) id).getValue());
+            }
+
+        }
+
+        Long contentSize = (Long) packetIndex.lookupAttribute("content_size"); //$NON-NLS-1$
+        Long packetSize = (Long) packetIndex.lookupAttribute("packet_size"); //$NON-NLS-1$
+        Long timestampBegin = (Long) packetIndex
+                .lookupAttribute("timestamp_begin"); //$NON-NLS-1$
+        Long timestampEnd = (Long) packetIndex.lookupAttribute("timestamp_end"); //$NON-NLS-1$
+        String device = (String) packetIndex.lookupAttribute("device"); //$NON-NLS-1$
+        // LTTng Specific
+        Long CPU_ID = (Long) packetIndex.lookupAttribute("cpu_id"); //$NON-NLS-1$
         /*
          * Read the content size in bits
          */
-        IntegerDefinition contentSizeDef = (IntegerDefinition) streamPacketContextDef
-                .lookupDefinition("content_size"); //$NON-NLS-1$
-        if (contentSizeDef != null) {
-            packetIndex.setContentSizeBits((int) contentSizeDef.getValue());
+        if (contentSize != null) {
+            packetIndex.setContentSizeBits(contentSize.intValue());
         } else {
             packetIndex.setContentSizeBits((int) (fileSizeBytes * 8));
         }
@@ -403,10 +439,9 @@ public class StreamInput implements IDefinitionScope {
         /*
          * Read the packet size in bits
          */
-        IntegerDefinition packetSizeDef = (IntegerDefinition) streamPacketContextDef
-                .lookupDefinition("packet_size"); //$NON-NLS-1$
-        if (packetSizeDef != null) {
-            packetIndex.setPacketSizeBits((int) packetSizeDef.getValue());
+
+        if (packetSize != null) {
+            packetIndex.setPacketSizeBits(packetSize.intValue());
         } else {
             if (packetIndex.getContentSizeBits() != 0) {
                 packetIndex.setPacketSizeBits(packetIndex.getContentSizeBits());
@@ -418,21 +453,29 @@ public class StreamInput implements IDefinitionScope {
         /*
          * Read the begin timestamp
          */
-        IntegerDefinition timestampBeginDef = (IntegerDefinition) streamPacketContextDef
-                .lookupDefinition("timestamp_begin"); //$NON-NLS-1$
-        if (timestampBeginDef != null) {
-            packetIndex.setTimestampBegin(timestampBeginDef.getValue());
+
+        if (timestampBegin != null) {
+            packetIndex.setTimestampBegin(timestampBegin.longValue());
         }
 
         /*
          * Read the end timestamp
          */
-        IntegerDefinition timestampEndDef = (IntegerDefinition) streamPacketContextDef
-                .lookupDefinition("timestamp_end"); //$NON-NLS-1$
-        if (timestampEndDef != null) {
-            packetIndex.setTimestampEnd(timestampEndDef.getValue());
+        if (timestampEnd != null) {
+            if( timestampEnd == -1 ) {
+                timestampEnd = Long.MAX_VALUE;
+            }
+            packetIndex.setTimestampEnd(timestampEnd.longValue());
             setTimestampEnd(packetIndex.getTimestampEnd());
         }
+
+        if (device != null) {
+            packetIndex.setTarget(device);
+        }
+
+        if (CPU_ID != null) {
+            packetIndex.setTarget("CPU" + CPU_ID.toString()); //$NON-NLS-1$
+        }
     }
 
     /*
index e6f602bdc3cf3aec2574c8a5d17b42d5a65aeb41..beb6268e20ebfad4d9acb49a219af7a336665a6c 100644 (file)
@@ -12,6 +12,8 @@
 
 package org.eclipse.linuxtools.internal.ctf.core.trace;
 
+import java.util.HashMap;
+
 /**
  * <b><u>StreamInputPacketIndexEntry</u></b>
  * <p>
@@ -59,6 +61,13 @@ public class StreamInputPacketIndexEntry {
      */
     private long lostEvents = 0;
 
+    /**
+     * Which target is being traced
+     */
+    private String target ;
+    private long targetID;
+
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -201,4 +210,25 @@ public class StreamInputPacketIndexEntry {
     public void setLostEvents(long lostEvents) {
         this.lostEvents = lostEvents;
     }
+
+    private final HashMap<String, Object> attributes = new HashMap<String, Object>();
+    public void addAttribute(String field, Object value) {
+        attributes.put(field, value);
+    }
+    public Object lookupAttribute(String field){
+        return attributes.get(field);
+    }
+
+    public String getTarget() {
+        return target;
+    }
+
+    public void setTarget(String target) {
+        this.target = target;
+        this.targetID = Integer.parseInt(target.replaceAll("[\\D]", "")); //$NON-NLS-1$ //$NON-NLS-2$ // slow
+    }
+
+    public long getTargetId(){
+        return targetID;
+    }
 }
index f6a6d160bd12c3ca14d4c504acde4f34f7aaee67..70aeb7528378770f0f1b0760d48fdf5db21172a3 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
+import org.eclipse.linuxtools.ctf.core.event.types.EnumDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
@@ -67,7 +68,7 @@ public abstract class CtfTmfEventField implements ITmfEventField {
      */
     protected CtfTmfEventField(String name) {
         /* Strip the underscore */
-        if ( name.startsWith("_") ) { //$NON-NLS-1$
+        if (name.startsWith("_")) { //$NON-NLS-1$
             this.name = name.substring(1);
         } else {
             this.name = name;
@@ -106,6 +107,10 @@ public abstract class CtfTmfEventField implements ITmfEventField {
             int base = intDef.getDeclaration().getBase();
             field = new CTFIntegerField(intDef.getValue(), fieldName, base);
 
+        } else if (fieldDef instanceof EnumDefinition) {
+            EnumDefinition enumDef = (EnumDefinition) fieldDef;
+            field = new CTFStringField(enumDef.getValue(), fieldName);
+
         } else if (fieldDef instanceof StringDefinition) {
             field = new CTFStringField(
                     ((StringDefinition) fieldDef).getValue(), fieldName);
@@ -122,7 +127,8 @@ public abstract class CtfTmfEventField implements ITmfEventField {
                 /* This is a an array of CTF Integers */
                 long[] values = new long[arrayDecl.getLength()];
                 for (int i = 0; i < arrayDecl.getLength(); i++) {
-                    values[i] = ((IntegerDefinition) arrayDef.getElem(i)).getValue();
+                    values[i] = ((IntegerDefinition) arrayDef.getElem(i))
+                            .getValue();
                 }
                 field = new CTFIntegerArrayField(values, fieldName);
             }
@@ -142,15 +148,16 @@ public abstract class CtfTmfEventField implements ITmfEventField {
                 /* Sequence of integers => CTFIntegerArrayField */
                 long[] values = new long[seqDef.getLength()];
                 for (int i = 0; i < seqDef.getLength(); i++) {
-                    values[i] = ((IntegerDefinition) seqDef.getElem(i)).getValue();
+                    values[i] = ((IntegerDefinition) seqDef.getElem(i))
+                            .getValue();
                 }
                 field = new CTFIntegerArrayField(values, fieldName);
             }
             /* Add other Sequence types here */
 
-        } else if (fieldDef instanceof FloatDefinition){
+        } else if (fieldDef instanceof FloatDefinition) {
             FloatDefinition floatDef = (FloatDefinition) fieldDef;
-            field = new CTFFloatField( floatDef.getValue(), fieldName);
+            field = new CTFFloatField(floatDef.getValue(), fieldName);
         }
 
         return field;
@@ -168,13 +175,17 @@ public abstract class CtfTmfEventField implements ITmfEventField {
         switch (other.getFieldType()) {
         case FIELDTYPE_INTEGER:
             CTFIntegerField intOther = (CTFIntegerField) other;
-            return new CTFIntegerField(intOther.getValue(), intOther.name, intOther.getBase());
+            return new CTFIntegerField(intOther.getValue(), intOther.name,
+                    intOther.getBase());
         case FIELDTYPE_STRING:
-            return new CTFStringField(((CTFStringField) other).getValue(), other.name);
+            return new CTFStringField(((CTFStringField) other).getValue(),
+                    other.name);
         case FIELDTYPE_INTEGER_ARRAY:
-            return new CTFIntegerArrayField(((CTFIntegerArrayField) other).getValue(), other.name);
+            return new CTFIntegerArrayField(
+                    ((CTFIntegerArrayField) other).getValue(), other.name);
         case FIELDTYPE_FLOAT:
-            return new CTFFloatField(((CTFFloatField) other).getValue(), other.name);
+            return new CTFFloatField(((CTFFloatField) other).getValue(),
+                    other.name);
         default:
             return null;
         }
@@ -236,7 +247,6 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     }
 }
 
-
 /**
  * The CTF field implementation for integer fields.
  *
@@ -312,7 +322,6 @@ final class CTFIntegerField extends CtfTmfEventField {
     }
 }
 
-
 /**
  * The CTF field implementation for string fields
  *
@@ -351,7 +360,6 @@ final class CTFStringField extends CtfTmfEventField {
     }
 }
 
-
 /**
  * CTF field implementation for arrays of integers.
  *
@@ -399,7 +407,6 @@ final class CTFIntegerArrayField extends CtfTmfEventField {
     }
 }
 
-
 /**
  * CTF field implementation for floats.
  *
@@ -417,7 +424,7 @@ final class CTFFloatField extends CtfTmfEventField {
      * @param name
      *            The name of this field
      */
-    protected CTFFloatField(double value ,String name) {
+    protected CTFFloatField(double valueString name) {
         super(name);
         this.value = value;
     }
@@ -433,7 +440,7 @@ final class CTFFloatField extends CtfTmfEventField {
     }
 
     @Override
-    public String toString(){
+    public String toString() {
         return name + '=' + value;
     }
 }
index 8c1dd89258c6f8d7c09917d5fae7b41d2c2cf620..0c7542bd21955c579e52113207320ced77e3cb58 100644 (file)
@@ -94,8 +94,9 @@ public class CtfTmfTrace extends TmfTrace<CtfTmfEvent> implements ITmfEventParse
                 /* Handle the case where the trace is empty */
                 this.setStartTime(TmfTimestamp.BIG_BANG);
             } else {
-                this.setStartTime(ctx.getCurrentEvent().getTimestamp());
-                this.setEndTime(ctx.getCurrentEvent().getTimestamp());
+                final ITmfTimestamp curTime = ctx.getCurrentEvent().getTimestamp();
+                this.setStartTime(curTime);
+                this.setEndTime(curTime);
             }
 
         } catch (final CTFReaderException e) {
This page took 0.036509 seconds and 5 git commands to generate.