diff options
2 files changed, 31 insertions, 0 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java index 75a042604c..e640bc32c7 100644 --- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java +++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java @@ -20,9 +20,13 @@ import java.util.PriorityQueue; import java.util.Set; import org.eclipse.linuxtools.ctf.core.event.EventDefinition; +import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration; import org.eclipse.linuxtools.internal.ctf.core.Activator; import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputReaderTimestampComparator; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSet.Builder; + /** * A CTF trace reader. Reads the events of a trace. * @@ -249,6 +253,20 @@ public class CTFTraceReader implements AutoCloseable { } /** + * Gets an iterable of the stream input readers, useful for foreaches + * + * @return the iterable of the stream input readers + * @since 3.0 + */ + public Iterable<IEventDeclaration> getEventDeclarations() { + ImmutableSet.Builder<IEventDeclaration> builder = new Builder<>(); + for (StreamInputReader sir : fStreamInputReaders) { + builder.addAll(sir.getEventDeclarations()); + } + return builder.build(); + } + + /** * Initializes the priority queue used to choose the trace file with the * lower next event timestamp. * diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java index bcc65573d5..e0f7c1624e 100644 --- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java +++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputReader.java @@ -15,9 +15,12 @@ package org.eclipse.linuxtools.ctf.core.trace; import java.nio.ByteOrder; import org.eclipse.linuxtools.ctf.core.event.EventDefinition; +import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration; import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration; import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputPacketIndexEntry; +import com.google.common.collect.ImmutableSet; + /** * A CTF trace event reader. Reads the events of a trace file. * @@ -166,6 +169,16 @@ public class StreamInputReader implements AutoCloseable { } /** + * Gets the event definition set for this StreamInput + * + * @return Unmodifiable set with the event definitions + * @since 3.0 + */ + public Iterable<IEventDeclaration> getEventDeclarations() { + return ImmutableSet.copyOf(fStreamInput.getStream().getEvents().values()); + } + + /** * Set the trace to live mode * * @param live |