DESCRIPTION

tmf/ctf: add new interface to get pre-defined data types

This way, other trace classes may implement this interface and be queried on
the events it might contain. This will be useful for analysis who can query
traces to know whether or not they might contain the events it needs to
execute.

This can be used by many traces. The TmfSetHelper class should help
extract useful information from the set of events.

Change-Id: I1758c0d99b2b4d4b91f5b7fa3ee14b82c325dede
Signed-off-by: Aryana Jones xxx@xxx.xxx
Signed-off-by: Ivy Mitchell xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2014-05-09 14:35:26.000000000

Uploaded patch set 11.

-------------------------------------
author: Brenden Conley
date: 2014-05-09 14:35:31.000000000

Patch Set 11:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6938/

-------------------------------------
author: Annalise Jimenez
date: 2014-05-09 15:06:47.000000000

Patch Set 11:

Fixed a typo in ITmfTraceWithPreDefinedEvents.java

-------------------------------------
author: Brenden Conley
date: 2014-05-09 15:31:46.000000000

Patch Set 11: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6938/ : SUCCESS

-------------------------------------
author: Annalise Jimenez
date: 2014-05-09 17:11:13.000000000

Patch Set 11: Code-Review+1

This looks good to be. But since I'm the original author, I'll let someone else review this as well.

-------------------------------------
author: Braxton Mccarthy
date: 2014-05-09 17:38:58.000000000

Patch Set 11: Code-Review-1

(21 comments)

I have a more general question too. The CTF metadata can have some events defined, without those events actually appearing in the trace. You mention this in the Javadoc somewhere, but what would actually happen?

If an analysis needs a certain type of events to run, the getEventTypes() method says that it (should) contain it, but in practice there are none of these events in the trace. Can the analysis still run?

Line:7, /COMMIT_MSG -> tmf

"ctf" here refers to the ctf feature. "tmf.ctf" is part of "tmf" ;)

Line:10, /COMMIT_MSG -> analyses

Line:14, /COMMIT_MSG -> TmfSetHelper -> TmfEventCollectionHelper, I assume?

Line:93, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpLttngEventMatching.java -> same comment as previous file

Line:93, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java -> You define that has a List (ImmutableList.of(...)), so you won't need to do Arrays.asList below

Line:99, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java -> !traceEvents.isEmtpy()

Line:26, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfEventTypeCollectionHelper.java -> final instead of abstract

and add an empty private constructor

Line:42, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfEventTypeCollectionHelper.java -> awww, this whole file becomes useless with Java 8! :

  Set<ITmfEventType> types;
  types.stream().map(ITmfEventType::getName).etc

for now it's ok though

Line:347, lttng/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTraceTest.java -> here too, this could be defined as a (Immutable)List, to avoid Arrays.asList(). Minor thing

Line:367, lttng/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTraceTest.java -> assertFalse instead?

Line:22, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java -> analyses

Line:23, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java -> ask for

Line:28, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java -> This could be left as implementation details. You can mention the "the operation should not take too long", but if a trace type of typically very small traces want to implement this, they could do some by just reading the trace.

Line:38, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java -> event types

Line:40, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java -> This is implementation details. We might remove initTrace in the (far) future. You should just say "once the trace is ready to be read".

Line:57, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTraceWithPreDefinedEvents.java -> You can call it getEventTypes(), the fact that it's a Set is represented by the return value already.

Line:66, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> put AutoCloseable at the end.

We haven't yet decided on specific "rules" for the order of implements, but in general the closer interfaces (like our ITmf* ones) should go first, more general ones after.

Line:134, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> iter does not get closed. (The warnings are coming!)

Line:143, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> wrap this line (at "null" maybe)

Line:386, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> wow, that getTypes() method is awful, it's not a big change to make it return xxx@xxx.xxx Set<ITmfEventType> instead, perhaps it'd be worth doing in the same patch.

Line:391, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> Collections.unmodifiable* is much inferior to Immutable*. Now that we can use it, use ImmutableSet.copyOf() instead (or define the set directly as a ImmutableSet).

Ok, hear me out. In TmfEventTypeManager.getTypes() keep Set in the signature but return a ImmutableSet. And in here do ImmutableSet.copyOf(), which won't actually do a copy. So we replace 2-3 copies with none!

Also a note, never put Immutable* types in APIs, they should only be used internally. Guava is nice, but we should not (yet) push this dependency on our users.

-------------------------------------
author: Ivy Mitchell
date: 2014-05-09 18:24:03.000000000

Patch Set 11:

(8 comments)

If a trace has an event type defined, but no events, it will lead to an empty analysis.

Like a callstack view with a main() and connecting after we entered main().

Line:93, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpLttngEventMatching.java -> Done

Line:93, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java -> Done

Line:99, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java -> Done

Line:26, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfEventTypeCollectionHelper.java -> Done

Line:66, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> Done

Line:134, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> Done

Line:143, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> Done

Line:391, lttng/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java -> Done

-------------------------------------
