aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron2013-12-10 16:19:50 (EST)
committerMatthew Khouzam2013-12-16 10:43:04 (EST)
commite852a19df128448ff002d13c66d2ce5acdfee496 (patch)
treecc1eb7d621a4a1d4743a5bf45f2290121c6681ca
parent1b092c08316679284804716273a9a42b342ef4d8 (diff)
downloadorg.eclipse.linuxtools-e852a19df128448ff002d13c66d2ce5acdfee496.zip
org.eclipse.linuxtools-e852a19df128448ff002d13c66d2ce5acdfee496.tar.gz
org.eclipse.linuxtools-e852a19df128448ff002d13c66d2ce5acdfee496.tar.bz2
ctf: modify data-structure in CTF-Trace holding streams.refs/changes/19/19619/4
CTF allows multiple events to have the same ID as long as they are not part of the same stream. Thus, a unique event is represented by <stream-id, event-id> and not only by event-id. In this case, the CTF-Trace contains multiple streams but maps all event-id into the same map (without stream-id). Back-references are always a bad design. In a future patch-set, the plan is to remove CTF-Trace from CTF-Stream. Change-Id: If5fc50d8541b152938a96447087d88c78e35e959 Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Reviewed-on: https://git.eclipse.org/r/19619 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Hudson CI Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java38
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Stream.java1
2 files changed, 3 insertions, 36 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
index 65ddffa..fbc8203 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
@@ -135,9 +135,6 @@ public class CTFTrace implements IDefinitionScope {
private static final FileFilter METADATA_FILE_FILTER = new MetadataFileFilter();
private static final Comparator<File> METADATA_COMPARATOR = new MetadataComparator();
- /** map of all the event types */
- private final Map<Long, HashMap<Long, IEventDeclaration>> eventDecs = new HashMap<Long, HashMap<Long, IEventDeclaration>>();
-
/** Callsite helpers */
private CTFCallsiteComparator ctfCallsiteComparator = new CTFCallsiteComparator();
@@ -257,7 +254,7 @@ public class CTFTrace implements IDefinitionScope {
* @since 2.0
*/
public Map<Long, IEventDeclaration> getEvents(Long streamId) {
- return eventDecs.get(streamId);
+ return streams.get(streamId).getEvents();
}
/**
@@ -630,13 +627,12 @@ public class CTFTrace implements IDefinitionScope {
throw new ParseException("Stream id already exists"); //$NON-NLS-1$
}
- /* It should be ok now. */
+ /* This stream is valid and has a unique id. */
streams.put(stream.getId(), stream);
- eventDecs.put(stream.getId(), new HashMap<Long, IEventDeclaration>());
}
/**
- * gets the Environment variables from the trace metadata (See CTF spec)
+ * Gets the Environment variables from the trace metadata (See CTF spec)
*
* @return the environment variables in a map form (key value)
* @since 2.0
@@ -792,34 +788,6 @@ public class CTFTrace implements IDefinitionScope {
}
/**
- * Does a given stream contain any events?
- *
- * @param id
- * the stream ID
- * @return true if the stream has events.
- */
- public boolean hasEvents(Long id) {
- return eventDecs.containsKey(id);
- }
-
- /**
- * Add an event declaration map to the events map.
- *
- * @param id
- * the id of a stream
- * @return the hashmap containing events.
- * @since 2.0
- */
- public Map<Long, IEventDeclaration> createEvents(Long id) {
- HashMap<Long, IEventDeclaration> value = eventDecs.get(id);
- if (value == null) {
- value = new HashMap<Long, IEventDeclaration>();
- eventDecs.put(id, value);
- }
- return value;
- }
-
- /**
* Adds a callsite
*
* @param eventName
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Stream.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Stream.java
index 4482aec..06604d3 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Stream.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Stream.java
@@ -86,7 +86,6 @@ public class Stream {
*/
public void setId(long id) {
this.id = id;
- this.events = trace.createEvents(this.id);
}
/**