tmf: Update XML trace stub to use ns directly
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Wed, 11 Jan 2017 21:34:52 +0000 (16:34 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Fri, 13 Jan 2017 19:13:18 +0000 (14:13 -0500)
Now that custom parsers support nanoseconds timestamps, the custom XML trace
stub does not need to convert the timestamps to nanoseconds anymore, it can
be defined directly in the XML trace definition.

Change-Id: I2791b350c303bb82df9f83f0cabbb663e1166a75
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/88513
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/trace/xml/TmfXmlDevelopmentTrace.xml
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/trace/xml/TmfXmlTraceStub.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestTraceOffsetting.java

index 1cd1aa7e0762d5c179e6e2fb8847c0b769c373ff..fb9e3331ff19d022d5c6b18603a09a659ac8f904 100644 (file)
@@ -23,7 +23,7 @@
 <OutputColumn name="type"/>
 </Definition>
 <Definition name="events">
-<TimeStampOutputFormat>T</TimeStampOutputFormat>
+<TimeStampOutputFormat>Tn</TimeStampOutputFormat>
 <InputElement name="trace">
 <InputElement logentry="true" name="event">
 <InputData action="0" format="" name="Ignore"/>
@@ -31,7 +31,7 @@
 <InputData action="0" format="" name="Message"/>
 </Attribute>
 <Attribute name="timestamp">
-<InputData action="0" format="T" name="Time Stamp"/>
+<InputData action="0" format="Tn" name="Time Stamp"/>
 </Attribute>
 <InputElement name="field">
 <InputData action="0" format="" name="Ignore"/>
index 5525916a17d468e29ce66d362b0625ab8a3c73d7..844d784a9740cfe071794a41074f9bc7d07c48c2 100644 (file)
@@ -61,7 +61,6 @@ import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTrace;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomXmlTraceDefinition;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfContext;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
@@ -104,8 +103,6 @@ public class TmfXmlTraceStub extends TmfTrace {
     private static final String TYPE_LONG = "long"; //$NON-NLS-1$
     private static final String ASPECT_CPU = "cpu";
 
-    private static final Long SECONDS_TO_NS = 1000000000L;
-
     private final CustomXmlTraceDefinition fDefinition;
     private CustomXmlTrace fTrace;
 
@@ -354,8 +351,7 @@ public class TmfXmlTraceStub extends TmfTrace {
          * original is in second and we need to convert it. We should do that at
          * the source when it is supported
          */
-        ITmfTimestamp timestamp = TmfTimestamp.fromNanos(event.getTimestamp().getValue() / SECONDS_TO_NS);
-        TmfEvent newEvent = new TmfEvent(this, ITmfContext.UNKNOWN_RANK, timestamp, eventType, eventFields);
+        TmfEvent newEvent = new TmfEvent(this, ITmfContext.UNKNOWN_RANK, event.getTimestamp(), eventType, eventFields);
         updateAttributes(savedContext, event);
         return newEvent;
     }
index 661e098d66c815031ddc7e39021692acce69d87a..9e13718ef2c3fba36b31dbf55de0eddff0a0b1a0 100644 (file)
@@ -166,7 +166,7 @@ public class TestTraceOffsetting {
         editor = fBot.editorByTitle(fLocation.getName());
         eventsTableBot = editor.bot().table();
         timestamp = eventsTableBot.cell(1, 1);
-        assertEquals("19:00:00.000 000 099", timestamp);
+        assertEquals("19:01:39.000 000 000", timestamp);
         SWTBotUtils.deleteProject(PROJET_NAME, fBot);
     }
 
This page took 0.027958 seconds and 5 git commands to generate.