ctf: Introduce IEventDefinition
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 14 Jan 2016 22:02:29 +0000 (17:02 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 21 Jan 2016 01:29:17 +0000 (20:29 -0500)
This interface is extracted from EventDefinition. It allows all of
IEventDeclaration to return only the interface and leave the internals
in the internal folder.

This should improve the maintainability of the CTF plugin without impacting
performance or testability.

Change-Id: I398c4440c67738eaa80a2e63e6d562352d0d64a8
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/64412
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
30 files changed:
ctf/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceReadBenchmark.java
ctf/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceSeekBenchmark.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/event/CTFEventDefinitionTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFPacketReaderTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputReaderTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceReaderTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceWriterTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/TraceReadAllTracesTest.java
ctf/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventDeclarationTest.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/EventDefinition.java [deleted file]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDeclaration.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDefinition.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/LostEventDeclaration.java [deleted file]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTraceReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/IPacketReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDeclaration.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDefinition.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/LostEventDeclaration.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/CTFPacketReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/NullPacketReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputReaderTimestampComparator.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfEvent.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfEventFactory.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/CtfTmfLostEvent.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/NullEventDefinition.java [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstEvent.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstEventFactory.java

index a41011fd4a41d361e52418c5d73c6e472a13c95c..bcca812ffcb56f5437e4b4c57d2e756cce70727d 100644 (file)
@@ -19,7 +19,7 @@ import org.eclipse.test.performance.Dimension;
 import org.eclipse.test.performance.Performance;
 import org.eclipse.test.performance.PerformanceMeter;
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTraceUtils;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -70,7 +70,7 @@ public class TraceReadBenchmark {
                 try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
 
                     while (traceReader.hasMoreEvents()) {
-                        EventDefinition ed = traceReader.getCurrentEventDef();
+                        IEventDefinition ed = traceReader.getCurrentEventDef();
                         /* Do something with the event */
                         ed.getCPU();
                         traceReader.advance();
index 2a8c37a09447daddcf10691586bac015ed53038a..1b6d23877273d31f099b330012a63812573bb5e6 100644 (file)
@@ -23,7 +23,7 @@ import org.eclipse.test.performance.Dimension;
 import org.eclipse.test.performance.Performance;
 import org.eclipse.test.performance.PerformanceMeter;
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTraceUtils;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -78,11 +78,11 @@ public class TraceSeekBenchmark {
             try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
 
                 /* Read the whole trace to find out the start and end times */
-                EventDefinition firstEvent = traceReader.getCurrentEventDef();
+                IEventDefinition firstEvent = traceReader.getCurrentEventDef();
                 final long startTime = firstEvent.getTimestamp();
                 long endTime = startTime;
                 while (traceReader.hasMoreEvents()) {
-                    EventDefinition ev = traceReader.getCurrentEventDef();
+                    IEventDefinition ev = traceReader.getCurrentEventDef();
                     endTime = ev.getTimestamp();
                     traceReader.advance();
                 }
index 62c5e6201a5f2b20e97b256a9af8a2b32afe50c9..9f92bc11477cfb298a9aa996c4700ee832034498 100644 (file)
@@ -20,7 +20,7 @@ import java.nio.ByteOrder;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
 import org.eclipse.tracecompass.ctf.core.event.types.Definition;
 import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
@@ -30,6 +30,7 @@ import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
 import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDefinition;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -78,7 +79,7 @@ public class CTFEventDefinitionTest {
         StructDefinition pContext = new StructDefinition(pContextDec, null, ILexicalScope.FIELDS.getPath(), new Definition[0]);
         StructDefinition fields = new StructDefinition(fDec, null, ILexicalScope.FIELDS.getPath(), fDefs);
 
-        int cpu = EventDefinition.UNKNOWN_CPU;
+        int cpu = IEventDefinition.UNKNOWN_CPU;
 
         fixture.add(new EventDefinition(eventDeclaration, cpu, 100, null, null, null, null, null, null));
         fixture.add(new EventDefinition(eventDeclaration, cpu, 100, null, null, null, null, fields, null));
index 7defd85c7d58a2c4f3083fbac2f601603ba86f4c..d16b33cbab35de063b5a253896a02f978b9f3f84 100644 (file)
@@ -24,7 +24,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFException;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
 import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
@@ -34,6 +33,7 @@ import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
 import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.internal.ctf.core.trace.CTFPacketReader;
 import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
 import org.junit.Test;
index 01b501b6ace948a5d61c76105f24b9e7b6475929..c21088a80a5dd76733e3b2941acd551792a74cc6 100644 (file)
@@ -19,7 +19,7 @@ import java.io.IOException;
 import java.util.Set;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.Definition;
 import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
 import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
@@ -34,6 +34,7 @@ import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.ICTFStream;
 import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.internal.ctf.core.trace.CTFStream;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.junit.Before;
@@ -43,8 +44,7 @@ import org.junit.Test;
  * The class <code>StreamInputReaderTest</code> contains tests for the class
  * <code>{@link CTFStreamInputReader}</code>.
  *
- * @author ematkho
- * @version $Revision: 1.0 $
+ * @author Matthew Khouzam
  */
 @SuppressWarnings("javadoc")
 public class CTFStreamInputReaderTest {
@@ -128,8 +128,7 @@ public class CTFStreamInputReaderTest {
      */
     @Test
     public void testGetCurrentEvent() {
-        EventDefinition result = fixture.getCurrentEvent();
-        assertNotNull(result);
+        assertNotNull(fixture.getCurrentEvent());
     }
 
     /**
@@ -137,7 +136,7 @@ public class CTFStreamInputReaderTest {
      */
     @Test
     public void testGetCurrentPacketContext() {
-        EventDefinition currentEvent = fixture.getCurrentEvent();
+        IEventDefinition currentEvent = fixture.getCurrentEvent();
         assertNotNull(currentEvent);
         ICompositeDefinition result = currentEvent.getPacketContext();
         assertNotNull(result);
@@ -175,7 +174,7 @@ public class CTFStreamInputReaderTest {
     public void testGoToLastEvent2() throws CTFException {
         long timestamp = -1;
         while (fixture.readNextEvent().equals(CTFResponse.OK)) {
-            EventDefinition currentEvent = fixture.getCurrentEvent();
+            IEventDefinition currentEvent = fixture.getCurrentEvent();
             assertNotNull(currentEvent);
             timestamp = currentEvent.getTimestamp();
         }
@@ -185,7 +184,7 @@ public class CTFStreamInputReaderTest {
 
     private long goToEnd() throws CTFException {
         fixture.goToLastEvent();
-        EventDefinition currentEvent = fixture.getCurrentEvent();
+        IEventDefinition currentEvent = fixture.getCurrentEvent();
         assertNotNull(currentEvent);
         return currentEvent.getTimestamp();
     }
index 57b12a377e9286577fd992eb8a1d056502578eae..b2a721a4e25095bc2b255e5e6cddb6d11da36a86 100644 (file)
@@ -24,7 +24,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.tests.shared.LttngKernelTraceGenerator;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -115,7 +115,7 @@ public class CTFTraceGrowingTest {
             fixture.addStreamFile(stream);
             reader.update();
             assertTrue(reader.advance());
-            EventDefinition currentEventDef = reader.getCurrentEventDef();
+            IEventDefinition currentEventDef = reader.getCurrentEventDef();
             assertNotNull(reader.getCurrentEventDef());
             assertEquals(16518l, currentEventDef.getTimestamp());
         }
@@ -138,7 +138,7 @@ public class CTFTraceGrowingTest {
             fixture.addStreamFile(stream);
             reader.update();
             assertTrue(reader.advance());
-            EventDefinition currentEventDef = reader.getCurrentEventDef();
+            IEventDefinition currentEventDef = reader.getCurrentEventDef();
             assertNotNull(currentEventDef);
             assertEquals(223007L, currentEventDef.getTimestamp());
         }
@@ -166,7 +166,7 @@ public class CTFTraceGrowingTest {
             reader.update();
             reader.update();
             assertTrue(reader.advance());
-            EventDefinition currentEventDef = reader.getCurrentEventDef();
+            IEventDefinition currentEventDef = reader.getCurrentEventDef();
             assertNotNull(currentEventDef);
             assertEquals(223007L, currentEventDef.getTimestamp());
         }
index 8edb4ba126fbe15b92a8d20314e8f91e9c0f60c8..9101fb54f7c4d7fc282e0b48f3de7b2355973e22 100644 (file)
@@ -17,7 +17,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTraceUtils;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -150,7 +150,7 @@ public class CTFTraceReaderTest {
      */
     @Test
     public void testGetCurrentEventDef_first() {
-        EventDefinition result = fixture.getCurrentEventDef();
+        IEventDefinition result = fixture.getCurrentEventDef();
         assertNotNull(result);
     }
 
@@ -164,7 +164,7 @@ public class CTFTraceReaderTest {
     @Test
     public void testGetCurrentEventDef_last() throws CTFException {
         fixture.goToLastEvent();
-        EventDefinition result = fixture.getCurrentEventDef();
+        IEventDefinition result = fixture.getCurrentEventDef();
         assertNotNull(result);
     }
 
index 8de88f6cc130e31f03aa1b8485c5c20785df0d8c..f1acbe2d6dddfe2290d89b1ff2a6111ecd330e3c 100644 (file)
@@ -25,7 +25,7 @@ import java.util.List;
 
 import org.eclipse.core.runtime.URIUtil;
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTraceUtils;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -186,7 +186,7 @@ public class CTFTraceWriterTest {
                 try (CTFTraceReader reader = new CTFTraceReader(outTrace)) {
                     while(reader.hasMoreEvents()) {
                         count++;
-                        EventDefinition def = reader.getCurrentEventDef();
+                        IEventDefinition def = reader.getCurrentEventDef();
                         end = def.getTimestamp();
                         if (start == null) {
                             start = outTrace.getClock().getClockOffset() + reader.getStartTime();
index 46f51fa5b701af5b60050a0b60e885a12a31c0dd..ecd8e9f20412810b13f5eef1fd9383333dcf15f7 100644 (file)
@@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
 import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTraceUtils;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -85,7 +85,7 @@ public class TraceReadAllTracesTest {
     public void readTraces() {
         if (fTraceEnum.getNbEvents() != -1) {
             try (CTFTraceReader reader = new CTFTraceReader(CtfTestTraceUtils.getTrace(fTraceEnum))) {
-                EventDefinition currentEventDef = reader.getCurrentEventDef();
+                IEventDefinition currentEventDef = reader.getCurrentEventDef();
                 double start = currentEventDef.getTimestamp();
                 long count = 0;
                 double end = start;
index 101d05e11951f4922426237f2a44d2416933cd8d..2118a4808385bcbaccf891e37806855e5342e4f2 100644 (file)
@@ -18,14 +18,15 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.LostEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
 import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
 import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTraceUtils;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
 import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.LostEventDeclaration;
 import org.eclipse.tracecompass.internal.ctf.core.trace.CTFStream;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.junit.Before;
@@ -317,22 +318,23 @@ public class EventDeclarationTest {
     @Test
     public void testEventDefinition() throws CTFException {
         CTFTrace trace = CtfTestTraceUtils.getTrace(testTrace);
-        EventDefinition ed = null;
+        IEventDefinition ed = null;
         try (CTFTraceReader tr = new CTFTraceReader(trace);) {
             tr.advance();
             ed = tr.getCurrentEventDef();
         }
-
+        assertTrue(ed instanceof IDefinitionScope);
+        IDefinitionScope ds = (IDefinitionScope)ed;
         assertNotNull(ed);
-        assertNotNull(ed.getScopePath());
+        assertNotNull(ds.getScopePath());
         assertNotNull(ed.getDeclaration());
         assertNotNull(ed.getFields());
         assertNull(ed.getContext());
         assertNotNull(ed.getPacketContext());
         assertNotNull(ed.getCPU());
-        assertNull(ed.lookupDefinition("context"));
-        assertNotNull(ed.lookupDefinition("fields"));
-        assertNull(ed.lookupDefinition("other"));
+        assertNull(ds.lookupDefinition("context"));
+        assertNotNull(ds.lookupDefinition("fields"));
+        assertNull(ds.lookupDefinition("other"));
         assertNotNull(ed.toString());
     }
 
diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/EventDefinition.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/EventDefinition.java
deleted file mode 100644 (file)
index 5b90a63..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2014 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
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-
-/**
- * Representation of a particular instance of an event.
- */
-public final class EventDefinition implements IDefinitionScope {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /**
-     * Value representing an unknown cpu number.
-     *
-     * @since 2.0
-     */
-    public static final int UNKNOWN_CPU = -1;
-
-    /**
-     * A null event, can be used for testing or poison pilling
-     */
-    public static final @NonNull EventDefinition NULL_EVENT = new EventDefinition(new EventDeclaration(), UNKNOWN_CPU, -1L, null, null, null, null, null, null);
-
-    /**
-     * The corresponding event declaration.
-     */
-    private final IEventDeclaration fDeclaration;
-
-    /**
-     * The timestamp of the current event.
-     */
-    private final long fTimestamp;
-
-    private final ICompositeDefinition fEventHeaderDefinition;
-
-    /**
-     * The event context structure definition.
-     */
-    private final ICompositeDefinition fEventContext;
-
-    private final ICompositeDefinition fStreamContext;
-
-    private final ICompositeDefinition fPacketContext;
-
-    /**
-     * The event fields structure definition.
-     */
-    private final ICompositeDefinition fFields;
-
-    /**
-     * The current cpu, could be @link {@link IPacketHeader#UNKNOWN_CPU}
-     */
-    private final int fCpu;
-
-    private final @NonNull Map<String, Object> fPacketAttributes;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructs an event definition.
-     *
-     * @param declaration
-     *            The corresponding event declaration
-     * @param cpu
-     *            The cpu source of the event. You can use UNKNOWN_CPU if it is
-     *            not known.
-     * @param timestamp
-     *            event timestamp
-     * @param eventHeaderDefinition
-     *            The event header definition, can be null if there is no header
-     *            definition
-     * @param eventContext
-     *            The event context
-     * @param packetContext
-     *            the packet context (the one with content size, not magic
-     *            number)
-     * @param streamContext
-     *            the stream context
-     * @param fields
-     *            The event fields
-     * @param packetDescriptor
-     *            descriptor of the packet containing this event
-     * @since 2.0
-     */
-    public EventDefinition(IEventDeclaration declaration,
-            int cpu,
-            long timestamp,
-            ICompositeDefinition eventHeaderDefinition,
-            ICompositeDefinition streamContext,
-            ICompositeDefinition eventContext,
-            ICompositeDefinition packetContext,
-            ICompositeDefinition fields,
-            @Nullable ICTFPacketDescriptor packetDescriptor) {
-        fDeclaration = declaration;
-        fEventHeaderDefinition = eventHeaderDefinition;
-        fCpu = cpu;
-        fTimestamp = timestamp;
-        fFields = fields;
-        fEventContext = eventContext;
-        fPacketContext = packetContext;
-        fStreamContext = streamContext;
-        fPacketAttributes = packetDescriptor != null ? packetDescriptor.getAttributes() : Collections.EMPTY_MAP;
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters/Setters/Predicates
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 1.0
-     */
-    @Override
-    public ILexicalScope getScopePath() {
-        String eventName = fDeclaration.getName();
-        if (eventName == null) {
-            return null;
-        }
-        ILexicalScope myScope = ILexicalScope.EVENT.getChild(eventName);
-        if (myScope == null) {
-            myScope = new LexicalScope(ILexicalScope.EVENT, eventName);
-        }
-        return myScope;
-    }
-
-    /**
-     * Gets the declaration (the form) of the data
-     *
-     * @return the event declaration
-     */
-    public IEventDeclaration getDeclaration() {
-        return fDeclaration;
-    }
-
-    /**
-     * Get the event header
-     *
-     * @return the event header
-     * @since 1.1
-     */
-    public ICompositeDefinition getEventHeader() {
-        return fEventHeaderDefinition;
-    }
-
-    /**
-     * Gets the fields of a definition
-     *
-     * @return the fields of a definition in struct form. Can be null.
-     * @since 1.0
-     */
-    public ICompositeDefinition getFields() {
-        return fFields;
-    }
-
-    /**
-     * Gets the context of this event without the context of the stream
-     *
-     * @return the context in struct form
-     * @since 1.0
-     */
-    public ICompositeDefinition getEventContext() {
-        return fEventContext;
-    }
-
-    /**
-     * Gets the context of this event within a stream
-     *
-     * @return the context in struct form
-     * @since 1.0
-     */
-    public ICompositeDefinition getContext() {
-
-        /* Most common case so far */
-        if (fStreamContext == null) {
-            return fEventContext;
-        }
-
-        /* streamContext is not null, but the context of the event is null */
-        if (fEventContext == null) {
-            return fStreamContext;
-        }
-
-        // TODO: cache if this is a performance issue
-
-        /* The stream context and event context are assigned. */
-        StructDeclaration mergedDeclaration = new StructDeclaration(1);
-
-        List<Definition> fieldValues = new ArrayList<>();
-
-        /* Add fields from the stream */
-        List<@NonNull String> fieldNames = fStreamContext.getFieldNames();
-        for (String fieldName : fieldNames) {
-            Definition definition = fStreamContext.getDefinition(fieldName);
-            mergedDeclaration.addField(fieldName, definition.getDeclaration());
-            fieldValues.add(definition);
-        }
-
-        /*
-         * Add fields from the event context, overwrite the stream ones if
-         * needed.
-         */
-        for (String fieldName : fEventContext.getFieldNames()) {
-            Definition definition = fEventContext.getDefinition(fieldName);
-            mergedDeclaration.addField(fieldName, definition.getDeclaration());
-            if (fieldNames.contains(fieldName)) {
-                fieldValues.set((fieldNames.indexOf(fieldName)), definition);
-            } else {
-                fieldValues.add(definition);
-            }
-        }
-        return new StructDefinition(mergedDeclaration, this, "context", //$NON-NLS-1$
-                fieldValues.toArray(new Definition[fieldValues.size()]));
-    }
-
-    /**
-     * Gets the context of packet the event is in.
-     *
-     * @return the packet context
-     * @since 1.0
-     */
-    public ICompositeDefinition getPacketContext() {
-        return fPacketContext;
-    }
-
-    /**
-     * gets the CPU the event was generated by. Slightly LTTng specific
-     *
-     * @return The CPU the event was generated by
-     */
-    public int getCPU() {
-        return fCpu;
-    }
-
-    /**
-     * @return the timestamp
-     */
-    public long getTimestamp() {
-        return fTimestamp;
-    }
-
-    /**
-     * Get the packet attributes.
-     *
-     * @return the packet attributes, such as "device" and "timestamp_begin"
-     * @since 2.0
-     */
-    public @NonNull Map<String, Object> getPacketAttributes() {
-        return fPacketAttributes;
-    }
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 1.0
-     */
-    @Override
-    public IDefinition lookupDefinition(String lookupPath) {
-        if (lookupPath.equals("context")) { //$NON-NLS-1$
-            return fEventContext;
-        } else if (lookupPath.equals("fields")) { //$NON-NLS-1$
-            return fFields;
-        } else {
-            return null;
-        }
-    }
-
-    @Override
-    public String toString() {
-        Iterable<String> list;
-        StringBuilder retString = new StringBuilder();
-        final String cr = System.getProperty("line.separator");//$NON-NLS-1$
-
-        retString.append("Event type: ").append(fDeclaration.getName()).append(cr); //$NON-NLS-1$
-        retString.append("Timestamp: ").append(Long.toString(fTimestamp)).append(cr); //$NON-NLS-1$
-
-        if (fEventContext != null) {
-            list = fEventContext.getFieldNames();
-
-            for (String field : list) {
-                retString.append(field).append(" : ").append(fEventContext.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
-            }
-        }
-
-        if (fFields != null) {
-            list = fFields.getFieldNames();
-
-            for (String field : list) {
-                retString.append(field).append(" : ").append(fFields.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
-            }
-        }
-
-        return retString.toString();
-    }
-
-}
index 6419c95592f0ae8bc0e842da835b9d96d1f73fae..09aa50fa15fa527a3b7c7f922b35364889972c3a 100644 (file)
@@ -37,20 +37,23 @@ public interface IEventDeclaration {
     public static final long UNSET_EVENT_ID = -2L;
 
     /**
-     * Creates an instance of EventDefinition corresponding to this declaration.
+     * Creates an instance of {@link IEventDefinition} corresponding to this
+     * declaration.
      *
      * @param streamInputReader
-     *            The StreamInputReader for which this definition is created.
+     *            The {@link CTFStreamInputReader} for which this definition is
+     *            created.
      * @param input
-     *            the bitbuffer input source
+     *            the {@link BitBuffer} input source
      * @param timestamp
      *            The timestamp when the event was taken
-     * @return A new EventDefinition.
+     * @return A new {@link IEventDefinition}
      * @throws CTFException
      *             As a bitbuffer is used to read, it could have wrapped
      *             IOExceptions.
+     * @since 2.0
      */
-    EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException;
+    IEventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException;
 
     /**
      * Gets the name of an event declaration
diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDefinition.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDefinition.java
new file mode 100644 (file)
index 0000000..546a7ac
--- /dev/null
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event;
+
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+
+/**
+ * IEventDefinition, an interface for representing individual events.
+ *
+ * @author Matthew Khouzam
+ * @since 2.0
+ */
+public interface IEventDefinition {
+
+    /**
+     * Value representing an unknown cpu number.
+     */
+    int UNKNOWN_CPU = -1;
+
+    /**
+     * Gets the declaration (the form) of the data
+     *
+     * @return the event declaration
+     */
+    IEventDeclaration getDeclaration();
+
+    /**
+     * Get the event header
+     *
+     * @return the event header
+     */
+    ICompositeDefinition getEventHeader();
+
+    /**
+     * Gets the fields of a definition
+     *
+     * @return the fields of a definition in struct form. Can be null.
+     */
+    ICompositeDefinition getFields();
+
+    /**
+     * Gets the context of this event without the context of the stream
+     *
+     * @return the context in struct form
+     */
+    ICompositeDefinition getEventContext();
+
+    /**
+     * Gets the context of this event within a stream
+     *
+     * @return the context in struct form
+     */
+    ICompositeDefinition getContext();
+
+    /**
+     * Gets the context of packet the event is in.
+     *
+     * @return the packet context
+     */
+    ICompositeDefinition getPacketContext();
+
+    /**
+     * gets the CPU the event was generated by. Slightly LTTng specific
+     *
+     * @return The CPU the event was generated by
+     */
+    int getCPU();
+
+    /**
+     * Get the timestamp, it is offsetted
+     *
+     * @return the timestamp
+     */
+    long getTimestamp();
+
+    /**
+     * Get the packet attributes.
+     *
+     * @return the packet attributes, such as "device" and "timestamp_begin"
+     */
+    @NonNull Map<@NonNull String, @NonNull Object> getPacketAttributes();
+
+}
\ No newline at end of file
diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/LostEventDeclaration.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/LostEventDeclaration.java
deleted file mode 100644 (file)
index a995fee..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2015 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.tracecompass.ctf.core.event;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-import org.eclipse.tracecompass.ctf.core.trace.ICTFStream;
-
-/**
- * A lost event definition
- *
- * @author Matthew Khouzam
- * @since 1.0
- */
-public class LostEventDeclaration implements IEventDeclaration {
-
-    /**
-     * Id of lost events
-     *
-     * @since 1.0
-     */
-    public static final long LOST_EVENT_ID = -1L;
-
-    /**
-     * Gets a "lost" event. This is a synthetic event that is there to show that
-     * there should be something there.
-     */
-    public static final LostEventDeclaration INSTANCE = new LostEventDeclaration();
-
-    private final StructDeclaration fFields = new StructDeclaration(0);
-
-    private LostEventDeclaration() {
-        getFields().addField(CTFStrings.LOST_EVENTS_FIELD, IntegerDeclaration.UINT_32B_DECL);
-        getFields().addField(CTFStrings.LOST_EVENTS_DURATION, IntegerDeclaration.UINT_64B_DECL);
-    }
-
-    @Override
-    public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, BitBuffer input, long timestamp) throws CTFException {
-        return null;
-    }
-
-    @Override
-    public String getName() {
-        return CTFStrings.LOST_EVENT_NAME;
-    }
-
-    @Override
-    public StructDeclaration getFields() {
-        return fFields;
-    }
-
-    @Override
-    public StructDeclaration getContext() {
-        return null;
-    }
-
-    @Override
-    public Long getId() {
-        return LOST_EVENT_ID;
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public ICTFStream getStream() {
-        return null;
-    }
-
-    @Override
-    public long getLogLevel() {
-        return 0;
-    }
-
-    @Override
-    public Set<String> getCustomAttributes() {
-        return Collections.<String> emptySet();
-    }
-
-    @Override
-    public String getCustomAttribute(String key) {
-        return null;
-    }
-
-}
index e74f4ae33715082dd1eace0669381cc502b83e53..093d083ddba4338eac66b7b3abf8c2126254a8d3 100644 (file)
@@ -24,8 +24,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
 import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
@@ -73,7 +73,7 @@ public class CTFStreamInputReader implements AutoCloseable {
      * Reference to the current event of this trace file (iow, the last on that
      * was read, the next one to be returned)
      */
-    private @Nullable EventDefinition fCurrentEvent = null;
+    private @Nullable IEventDefinition fCurrentEvent = null;
 
     private int fId;
 
@@ -195,8 +195,9 @@ public class CTFStreamInputReader implements AutoCloseable {
      *
      * @return the current event in the stream, null if the stream is
      *         finished/empty/malformed
+     * @since 2.0
      */
-    public @Nullable EventDefinition getCurrentEvent() {
+    public @Nullable IEventDefinition getCurrentEvent() {
         return fCurrentEvent;
     }
 
@@ -390,7 +391,7 @@ public class CTFStreamInputReader implements AutoCloseable {
          * timestamp.
          */
         readNextEvent();
-        EventDefinition currentEvent = getCurrentEvent();
+        IEventDefinition currentEvent = getCurrentEvent();
         while (currentEvent != null && (currentEvent.getTimestamp() < timestamp)) {
             readNextEvent();
             currentEvent = getCurrentEvent();
@@ -465,15 +466,15 @@ public class CTFStreamInputReader implements AutoCloseable {
         /*
          * Go until the end of that packet
          */
-        EventDefinition prevEvent = null;
+        IEventDefinition prevEvent = null;
         while (fCurrentEvent != null) {
             prevEvent = fCurrentEvent;
-            this.readNextEvent();
+            readNextEvent();
         }
         /*
          * Go back to the previous event
          */
-        this.setCurrentEvent(prevEvent);
+        setCurrentEvent(prevEvent);
     }
 
     /**
@@ -481,8 +482,9 @@ public class CTFStreamInputReader implements AutoCloseable {
      *
      * @param currentEvent
      *            the event to set
+     * @since 2.0
      */
-    public void setCurrentEvent(@Nullable EventDefinition currentEvent) {
+    public void setCurrentEvent(@Nullable IEventDefinition currentEvent) {
         fCurrentEvent = currentEvent;
     }
 
index 9c9bae563b5784fccbc5a630aa1cd13ed5e24458..9f2c45c7736a5d78f3d8ce129a43a591ffbdc8ad 100644 (file)
@@ -24,8 +24,8 @@ import java.util.PriorityQueue;
 import java.util.Set;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.internal.ctf.core.Activator;
 import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputReaderTimestampComparator;
 
@@ -329,8 +329,9 @@ public class CTFTraceReader implements AutoCloseable {
      *
      * @return An event definition, or null of the trace reader reached the end
      *         of the trace.
+     * @since 2.0
      */
-    public EventDefinition getCurrentEventDef() {
+    public IEventDefinition getCurrentEventDef() {
         CTFStreamInputReader top = getTopStream();
         return (top != null) ? top.getCurrentEvent() : null;
     }
@@ -367,7 +368,7 @@ public class CTFTraceReader implements AutoCloseable {
              * We're in OK, there's a guaranteed top#getCurrentEvent() unless another
              * thread does something bad.
              */
-            EventDefinition currentEvent = checkNotNull(top.getCurrentEvent());
+            IEventDefinition currentEvent = checkNotNull(top.getCurrentEvent());
             final long topEnd = fTrace.timestampCyclesToNanos(currentEvent.getTimestamp());
             setEndTime(Math.max(topEnd, getEndTime()));
             fEventCountPerTraceFile[top.getName()]++;
index 165566d012ce2913e33a0667b2a6d83f5a9432dc..736189bf9c1c6471fbfc58130dd1fef00cfda7f7 100644 (file)
@@ -13,7 +13,7 @@
 package org.eclipse.tracecompass.ctf.core.trace;
 
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
 
 /**
@@ -61,7 +61,7 @@ public interface IPacketReader {
      * @throws CTFException
      *             If there was a problem reading the trace
      */
-    EventDefinition readNextEvent() throws CTFException;
+    IEventDefinition readNextEvent() throws CTFException;
 
     /**
      * Get the packet being read
index e10cfd1d03bd5208c660cd4a8ce1bfe447a816fd..a48ec1028f45c20f03e4731cb22a156284a9c4b7 100644 (file)
@@ -21,7 +21,6 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.ctf.core.CTFException;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
 import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDefinition.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDefinition.java
new file mode 100644 (file)
index 0000000..ef74172
--- /dev/null
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * Copyright (c) 2011-2014 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
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
+
+/**
+ * Representation of a particular instance of an event.
+ */
+public final class EventDefinition implements IDefinitionScope, IEventDefinition {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * The corresponding event declaration.
+     */
+    private final IEventDeclaration fDeclaration;
+
+    /**
+     * The timestamp of the current event.
+     */
+    private final long fTimestamp;
+
+    private final ICompositeDefinition fEventHeaderDefinition;
+
+    /**
+     * The event context structure definition.
+     */
+    private final ICompositeDefinition fEventContext;
+
+    private final ICompositeDefinition fStreamContext;
+
+    private final ICompositeDefinition fPacketContext;
+
+    /**
+     * The event fields structure definition.
+     */
+    private final ICompositeDefinition fFields;
+
+    /**
+     * The current cpu, could be @link {@link IPacketHeader#UNKNOWN_CPU}
+     */
+    private final int fCpu;
+
+    private final @NonNull Map<String, Object> fPacketAttributes;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructs an event definition.
+     *
+     * @param declaration
+     *            The corresponding event declaration
+     * @param cpu
+     *            The cpu source of the event. You can use UNKNOWN_CPU if it is
+     *            not known.
+     * @param timestamp
+     *            event timestamp
+     * @param eventHeaderDefinition
+     *            The event header definition, can be null if there is no header
+     *            definition
+     * @param eventContext
+     *            The event context
+     * @param packetContext
+     *            the packet context (the one with content size, not magic
+     *            number)
+     * @param streamContext
+     *            the stream context
+     * @param fields
+     *            The event fields
+     * @param packetDescriptor
+     *            descriptor of the packet containing this event
+     * @since 2.0
+     */
+    public EventDefinition(IEventDeclaration declaration,
+            int cpu,
+            long timestamp,
+            ICompositeDefinition eventHeaderDefinition,
+            ICompositeDefinition streamContext,
+            ICompositeDefinition eventContext,
+            ICompositeDefinition packetContext,
+            ICompositeDefinition fields,
+            @Nullable ICTFPacketDescriptor packetDescriptor) {
+        fDeclaration = declaration;
+        fEventHeaderDefinition = eventHeaderDefinition;
+        fCpu = cpu;
+        fTimestamp = timestamp;
+        fFields = fields;
+        fEventContext = eventContext;
+        fPacketContext = packetContext;
+        fStreamContext = streamContext;
+        fPacketAttributes = packetDescriptor != null ? packetDescriptor.getAttributes() : Collections.EMPTY_MAP;
+    }
+
+    // ------------------------------------------------------------------------
+    // Getters/Setters/Predicates
+    // ------------------------------------------------------------------------
+
+    @Override
+    public ILexicalScope getScopePath() {
+        String eventName = fDeclaration.getName();
+        if (eventName == null) {
+            return null;
+        }
+        ILexicalScope myScope = ILexicalScope.EVENT.getChild(eventName);
+        if (myScope == null) {
+            myScope = new LexicalScope(ILexicalScope.EVENT, eventName);
+        }
+        return myScope;
+    }
+
+    @Override
+    public IEventDeclaration getDeclaration() {
+        return fDeclaration;
+    }
+
+    @Override
+    public ICompositeDefinition getEventHeader() {
+        return fEventHeaderDefinition;
+    }
+
+    @Override
+    public ICompositeDefinition getFields() {
+        return fFields;
+    }
+
+    @Override
+    public ICompositeDefinition getEventContext() {
+        return fEventContext;
+    }
+
+    @Override
+    public ICompositeDefinition getContext() {
+
+        /* Most common case so far */
+        if (fStreamContext == null) {
+            return fEventContext;
+        }
+
+        /* streamContext is not null, but the context of the event is null */
+        if (fEventContext == null) {
+            return fStreamContext;
+        }
+
+        // TODO: cache if this is a performance issue
+
+        /* The stream context and event context are assigned. */
+        StructDeclaration mergedDeclaration = new StructDeclaration(1);
+
+        List<Definition> fieldValues = new ArrayList<>();
+
+        /* Add fields from the stream */
+        List<@NonNull String> fieldNames = fStreamContext.getFieldNames();
+        for (String fieldName : fieldNames) {
+            Definition definition = fStreamContext.getDefinition(fieldName);
+            mergedDeclaration.addField(fieldName, definition.getDeclaration());
+            fieldValues.add(definition);
+        }
+
+        /*
+         * Add fields from the event context, overwrite the stream ones if
+         * needed.
+         */
+        for (String fieldName : fEventContext.getFieldNames()) {
+            Definition definition = fEventContext.getDefinition(fieldName);
+            mergedDeclaration.addField(fieldName, definition.getDeclaration());
+            if (fieldNames.contains(fieldName)) {
+                fieldValues.set((fieldNames.indexOf(fieldName)), definition);
+            } else {
+                fieldValues.add(definition);
+            }
+        }
+        return new StructDefinition(mergedDeclaration, this, "context", //$NON-NLS-1$
+                fieldValues.toArray(new Definition[fieldValues.size()]));
+    }
+
+    @Override
+    public ICompositeDefinition getPacketContext() {
+        return fPacketContext;
+    }
+
+    @Override
+    public int getCPU() {
+        return fCpu;
+    }
+
+    @Override
+    public long getTimestamp() {
+        return fTimestamp;
+    }
+
+    @Override
+    public Map<String, Object> getPacketAttributes() {
+        return fPacketAttributes;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    @Override
+    public IDefinition lookupDefinition(String lookupPath) {
+        if (lookupPath.equals("context")) { //$NON-NLS-1$
+            return fEventContext;
+        } else if (lookupPath.equals("fields")) { //$NON-NLS-1$
+            return fFields;
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public String toString() {
+        Iterable<String> list;
+        StringBuilder retString = new StringBuilder();
+        final String cr = System.getProperty("line.separator");//$NON-NLS-1$
+
+        retString.append("Event type: ").append(fDeclaration.getName()).append(cr); //$NON-NLS-1$
+        retString.append("Timestamp: ").append(Long.toString(fTimestamp)).append(cr); //$NON-NLS-1$
+
+        if (fEventContext != null) {
+            list = fEventContext.getFieldNames();
+
+            for (String field : list) {
+                retString.append(field).append(" : ").append(fEventContext.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
+            }
+        }
+
+        if (fFields != null) {
+            list = fFields.getFieldNames();
+
+            for (String field : list) {
+                retString.append(field).append(" : ").append(fFields.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
+            }
+        }
+
+        return retString.toString();
+    }
+
+}
diff --git a/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/LostEventDeclaration.java b/ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/LostEventDeclaration.java
new file mode 100644 (file)
index 0000000..77a7eb9
--- /dev/null
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.tracecompass.internal.ctf.core.event;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+import org.eclipse.tracecompass.ctf.core.trace.ICTFStream;
+
+/**
+ * A lost event definition
+ *
+ * @author Matthew Khouzam
+ * @since 1.0
+ */
+public class LostEventDeclaration implements IEventDeclaration {
+
+    /**
+     * Id of lost events
+     *
+     * @since 1.0
+     */
+    public static final long LOST_EVENT_ID = -1L;
+
+    /**
+     * Gets a "lost" event. This is a synthetic event that is there to show that
+     * there should be something there.
+     */
+    public static final LostEventDeclaration INSTANCE = new LostEventDeclaration();
+
+    private final StructDeclaration fFields = new StructDeclaration(0);
+
+    private LostEventDeclaration() {
+        getFields().addField(CTFStrings.LOST_EVENTS_FIELD, IntegerDeclaration.UINT_32B_DECL);
+        getFields().addField(CTFStrings.LOST_EVENTS_DURATION, IntegerDeclaration.UINT_64B_DECL);
+    }
+
+    @Override
+    public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, BitBuffer input, long timestamp) throws CTFException {
+        return null;
+    }
+
+    @Override
+    public String getName() {
+        return CTFStrings.LOST_EVENT_NAME;
+    }
+
+    @Override
+    public StructDeclaration getFields() {
+        return fFields;
+    }
+
+    @Override
+    public StructDeclaration getContext() {
+        return null;
+    }
+
+    @Override
+    public Long getId() {
+        return LOST_EVENT_ID;
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public ICTFStream getStream() {
+        return null;
+    }
+
+    @Override
+    public long getLogLevel() {
+        return 0;
+    }
+
+    @Override
+    public Set<String> getCustomAttributes() {
+        return Collections.<String> emptySet();
+    }
+
+    @Override
+    public String getCustomAttribute(String key) {
+        return null;
+    }
+
+}
index c04ecf6096eabb74bfa4e171ba247d3e5c45f70c..0e42c6b553f2cb8c7399a1c50eb45f6df7e90b1f 100644 (file)
@@ -18,9 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFException;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.LostEventDeclaration;
 import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
 import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
 import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
@@ -38,6 +36,8 @@ import org.eclipse.tracecompass.ctf.core.trace.CTFIOException;
 import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
 import org.eclipse.tracecompass.ctf.core.trace.IPacketReader;
 import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.LostEventDeclaration;
 import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderDefinition;
 
 /**
index 9325a48f41ea71f0ba3272b7b5fd376f30b0022a..3a5a442a4d8a72e1182f5e6d630babaa5759b001 100644 (file)
@@ -15,10 +15,10 @@ package org.eclipse.tracecompass.internal.ctf.core.trace;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
 import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
 import org.eclipse.tracecompass.ctf.core.trace.IPacketReader;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDefinition;
 
 /**
  * Null packet reader, used for unset packets
index 3e60759068c4e3e077906053371c13d3ae61141d..ea3be0930c648db486b98c8df9c1d152588e78bf 100644 (file)
@@ -17,7 +17,7 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 import java.io.Serializable;
 import java.util.Comparator;
 
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
 
 /**
@@ -45,8 +45,8 @@ public class StreamInputReaderTimestampComparator implements
      */
     @Override
     public int compare(CTFStreamInputReader a, CTFStreamInputReader b) {
-        EventDefinition eventA = checkNotNull(a.getCurrentEvent());
-        EventDefinition eventB = checkNotNull(b.getCurrentEvent());
+        IEventDefinition eventA = checkNotNull(a.getCurrentEvent());
+        IEventDefinition eventB = checkNotNull(b.getCurrentEvent());
 
         long ta = eventA.getTimestamp();
         long tb = eventB.getTimestamp();
index 299ad2e5aed353c4c13e2a1ff018649e8784506a..733c6d0687b2a2f1a81a2e4522a6c6331a23bb9f 100644 (file)
@@ -18,7 +18,7 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
@@ -163,7 +163,7 @@ public class CtfIterator extends CTFTraceReader
     public synchronized long getCurrentTimestamp() {
         final CTFStreamInputReader top = super.getPrio().peek();
         if (top != null) {
-            EventDefinition currentEvent = top.getCurrentEvent();
+            IEventDefinition currentEvent = top.getCurrentEvent();
             if (currentEvent != null) {
                 long ts = currentEvent.getTimestamp();
                 return fTrace.timestampCyclesToNanos(ts);
index 29f0d6a14e430c5c7c02cf4abcc599f444afcda1..d76e26da977f4c533dc18e91dfb19eb8ce8fd5e6 100644 (file)
@@ -25,8 +25,8 @@ import java.util.Set;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
 import org.eclipse.tracecompass.ctf.core.trace.ICTFStream;
@@ -64,7 +64,7 @@ public class CtfTmfEvent extends TmfEvent
     // ------------------------------------------------------------------------
 
     private final @Nullable IEventDeclaration fEventDeclaration;
-    private final EventDefinition fEvent;
+    private final IEventDefinition fEvent;
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -121,7 +121,7 @@ public class CtfTmfEvent extends TmfEvent
             String channel,
             int cpu,
             IEventDeclaration declaration,
-            EventDefinition eventDefinition) {
+            IEventDefinition eventDefinition) {
         super(trace,
                 rank,
                 timestamp,
@@ -165,7 +165,7 @@ public class CtfTmfEvent extends TmfEvent
         fSourceCpu = -1;
         fEventName = EMPTY_CTF_EVENT_NAME;
         fEventDeclaration = null;
-        fEvent = EventDefinition.NULL_EVENT;
+        fEvent = NullEventDefinition.INSTANCE;
         fChannel = ""; //$NON-NLS-1$
         fStream = null;
         fPacketAttributes = Collections.EMPTY_MAP;
@@ -184,7 +184,7 @@ public class CtfTmfEvent extends TmfEvent
         fSourceCpu = -1;
         fEventName = EMPTY_CTF_EVENT_NAME;
         fEventDeclaration = null;
-        fEvent = EventDefinition.NULL_EVENT;
+        fEvent = NullEventDefinition.INSTANCE;
         fChannel = ""; //$NON-NLS-1$
         fStream = null;
         fPacketAttributes = Collections.EMPTY_MAP;
@@ -287,7 +287,7 @@ public class CtfTmfEvent extends TmfEvent
      * Extract the field information from the structDefinition haze-inducing
      * mess, and put them into something ITmfEventField can cope with.
      */
-    private static CtfTmfEventField[] parseFields(EventDefinition eventDef) {
+    private static CtfTmfEventField[] parseFields(IEventDefinition eventDef) {
         List<CtfTmfEventField> fields = new ArrayList<>();
 
         ICompositeDefinition structFields = eventDef.getFields();
@@ -340,10 +340,10 @@ public class CtfTmfEvent extends TmfEvent
     }
 
     /**
-     * Gets the packet attributes. The result is an instance of one of
-     * the following classes: <code>Entry<String, Long></code>, <code>Long</code>,
-     * <code>String</code> or <code>Double</code>. The map contains pairs of key and
-     * values where the key and value can never be null.
+     * Gets the packet attributes. The result is an instance of one of the
+     * following classes: <code>Entry<String, Long></code>, <code>Long</code>,
+     * <code>String</code> or <code>Double</code>. The map contains pairs of key
+     * and values where the key and value can never be null.
      *
      * @return gets the packet attributes
      * @since 2.0
index 0d019fba7a50d03604e907ff29a459f6d0ab20fe..292870b71252be4b7943748d981296b58a99277b 100644 (file)
@@ -15,8 +15,8 @@ package org.eclipse.tracecompass.tmf.ctf.core.event;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
 import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
@@ -76,7 +76,7 @@ public class CtfTmfEventFactory {
      * @return The newly-built CtfTmfEvent
      * @since 2.0
      */
-    public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, @Nullable String fileName) {
+    public CtfTmfEvent createEvent(CtfTmfTrace trace, IEventDefinition eventDef, @Nullable String fileName) {
 
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
@@ -123,7 +123,7 @@ public class CtfTmfEventFactory {
      * @since 2.0
      */
     protected static CtfTmfEvent createLostEvent(CtfTmfTrace trace,
-            EventDefinition eventDef,
+            IEventDefinition eventDef,
             final IEventDeclaration eventDecl,
             final long ts,
             final TmfNanoTimestamp timestamp,
index 3b6a3c3b8dd7d5341c6faf5ac912679541417c3f..ccd505ee641b8a1a13d3c6d92bce2c9ff568a819 100644 (file)
@@ -16,8 +16,8 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
@@ -63,7 +63,7 @@ public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
             IEventDeclaration declaration,
             TmfTimeRange timeRange,
             long nbLost,
-            EventDefinition def) {
+            IEventDefinition def) {
         /*
          * Only the factory should call this method, the cast to
          * (TmfNanoTimestamp) should be safe.
diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/NullEventDefinition.java b/ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/event/NullEventDefinition.java
new file mode 100644 (file)
index 0000000..de24b74
--- /dev/null
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+
+/**
+ * Null event definition, used as a poison pill
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+final class NullEventDefinition implements IEventDefinition {
+
+    public static final NullEventDefinition INSTANCE = new NullEventDefinition();
+
+    private NullEventDefinition() {
+    }
+
+    @Override
+    public long getTimestamp() {
+        return 0;
+    }
+
+    @Override
+    public @Nullable ICompositeDefinition getPacketContext() {
+        return null;
+    }
+
+    @Override
+    public Map<String, Object> getPacketAttributes() {
+        return Collections.EMPTY_MAP;
+    }
+
+    @Override
+    public @Nullable ICompositeDefinition getFields() {
+        return null;
+    }
+
+    @Override
+    public @Nullable ICompositeDefinition getEventHeader() {
+        return null;
+    }
+
+    @Override
+    public @Nullable ICompositeDefinition getEventContext() {
+        return null;
+    }
+
+    @Override
+    public @Nullable IEventDeclaration getDeclaration() {
+        return null;
+    }
+
+    @Override
+    public @Nullable ICompositeDefinition getContext() {
+        return null;
+    }
+
+    @Override
+    public int getCPU() {
+        return IEventDefinition.UNKNOWN_CPU;
+    }
+}
\ No newline at end of file
index 7b20767365e8e957d48c4f69457064d5a16f7ad7..e823405bcae5df2403a584b0de393840cfdd0341 100644 (file)
@@ -11,8 +11,8 @@ package org.eclipse.tracecompass.lttng2.ust.core.trace;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoSourceAspect;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
 import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
@@ -57,7 +57,7 @@ public class LttngUstEvent extends CtfTmfEvent implements ITmfSourceLookup {
      *            The event definition
      */
     protected LttngUstEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
-            String channel, int cpu, IEventDeclaration declaration, EventDefinition eventDefinition) {
+            String channel, int cpu, IEventDeclaration declaration, IEventDefinition eventDefinition) {
         super(trace, rank, timestamp, channel, cpu, declaration, eventDefinition);
     }
 
index 87e52060af372eef837da8a367ead56cc6d63f48..4e8dd9c45684f4960ff787024089e85c1894c0d3 100644 (file)
@@ -12,8 +12,8 @@ package org.eclipse.tracecompass.lttng2.ust.core.trace;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
 import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.IEventDefinition;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
@@ -43,7 +43,7 @@ public class LttngUstEventFactory extends CtfTmfEventFactory {
     }
 
     @Override
-    public CtfTmfEvent createEvent(CtfTmfTrace trace, EventDefinition eventDef, @Nullable String fileName) {
+    public CtfTmfEvent createEvent(CtfTmfTrace trace, IEventDefinition eventDef, @Nullable String fileName) {
         /* Prepare what to pass to CtfTmfEvent's constructor */
         final IEventDeclaration eventDecl = eventDef.getDeclaration();
         final long ts = eventDef.getTimestamp();
This page took 0.068274 seconds and 5 git commands to generate.