DESCRIPTION

Tmf: Trace synchronization using network events

* Event matching infrastructure allow to create dependencies between 2 events.
* Network events (tcp packets) are matched for lttng 2.0 traces, using one of
  two techniques: fgiraldeau's dynamic probe addon module, or an experimental
  branch with additional data on net_* tracepoints of lttng-modules.
* Traces in an experiment are synchronized using the Fully Incremental Convex
  Hull algorithm.
* A trace's timestamps can be modified using Timestamp Transforms classes.
  TmfTimestampTransformLinear takes a slope and/or an offset.
* Once synchronized, the trace is copied, without its supplementary files
  so the state system is regenerated with synchronized time.
* A new synchronization view shows statistics about the synchronization.
* The synchronization information is kept at the experiment level to be able
  to view synchronization's statistics after first sync.
* Synchronization formula for a trace is saved in supplementary files.
* Unit tests for trace synchronization.

Change-Id: I1971fcd856254fc5654c609d6146904cd3dfd25c
Signed-off-by: Aryana Jones xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2013-08-07 20:38:07.000000000

Uploaded patch set 5.

-------------------------------------
author: Brenden Conley
date: 2013-08-07 20:38:13.000000000

Patch Set 5:

Build Started https://hudson.eclipse.org/sandbox/job/linuxtools/3132/

-------------------------------------
author: Brenden Conley
date: 2013-08-07 20:56:01.000000000

Patch Set 5: Verified+1

Build Successful 

https://hudson.eclipse.org/sandbox/job/linuxtools/3132/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2013-08-09 21:21:39.000000000

Patch Set 5: Code-Review-1

(59 comments)

Here we gooooo

Also, I'm not sure about the stuff in event.matching. Would there be a need to "match" events for stuff other than synchronization? Should it go in synchronization.matching instead?

Line:54, lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java -> spacing

Line:62, lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java -> fail(

Also, you are suppressing NLS warnings, so no need for $NON-NLS-1$

Line:32, lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/event/TmfSyncEventStub.java -> ctrl+shift+f this javadoc

Line:35, lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/event/TmfSyncEventStub.java -> if you have a long line with nested calls, sometimes it becomes easier to split it all on different lines, like:

  super(trace,
    timestamp,
    stub,
    new TmfEventTypeStub(),
    new TmfEventField(stub, stub, null),
    stub);

Line:161, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/timestamp/TmfTimestamp.java -> no no no no

Line:86, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/TsTransformTest.java -> (BigDecimal

other places in this file too

Line:101, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/TsTransformTest.java -> extra space detected

Line:62, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/SyncTest.java -> Are those messages only used in unit tests? If so, no need to externalize them.

Personally, I don't use messages in unit tests at all. It makes everything harder to read (compared to assertEquals(a, b)). If a test fails, double-clicking on it brings you to the relevant line. If the test description is clear, the message is redundant.

Line:162, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java -> not sure it's worth it if it only saves one NON-NLS annotation :P

Line:178, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java -> no need for the comment if it's emtpy

Line:351, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java -> you could do int i on this line

Line:428, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SyncAlgorithmFullyIncremental.java -> instead of this, you could add the list of cases just above default, like:

 case FAIL:
 default:
   <do stuff>

This way, if another entry is eventually added to the enum, it will properly give a warning here, and not just do the default clause.

Line:59, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java -> y u add line

Line:134, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java -> is this file stored with the supplementary files? It doesn't have to be hidden then (the directory itself is quite hidden away already)

Line:783, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTrace.java -> take the empty line from line 59, and put it above the /** here instead

Line:25, lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTestFiles.java -> try to leave javadoc warnings on. It's such a small file anyway ;)

Line:10, /COMMIT_MSG -> TCP
LTTng

I like me capitals in me acronyms

Line:8, lttng/org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore -> <ocd>Could you put it above /trace2 please</ocd>

Line:79, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatches.java -> instead of hard-coding the class name (TmfEventMatches), you can use getClass().getSimpleName(). That way it will magically work for sub-classes too.

Line:92, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java -> don't auto-format stuff inside <pre> tags. It will change how it's actually outputted.

Rest is good though, so maybe just undo those manually.

Line:396, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java -> Will the TimestampTransform be set in stone for a given trace once the trace is created?

If so, then it should be final, and there should be no setter.

If not, then it's not re-entrant-y to have a separate getter, setter, and createTimetamp operation (which I assume uses the current TimestampTransform of the trace).  Perhaps the TT should not be coupled with the trace then, and should be passed in parameter with createTimestamp().

Line:20, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/synchronization/AllTests.java -> update this line

Line:33, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> I drank decaf for a whole week without knowing once. I thought I was gonna die. True story.

Line:36, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> Is it documented somewhere what these version numbers do? Like in the state history, there was a major and a minor version, but in the end we kept only one because over-design.

Line:42, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> Add description

Line:52, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> Add description

Line:73, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> Hey I recognize this. You're stealing muh open-source codez aren't you! :P

Line:76, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> If these exception messages can ever be shown to the user, they should be externalized. If not, nevermind.

Line:121, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> Add description

Line:97, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java -> ctrl+shift+f this javadoc

Line:110, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java -> Instead of having fMatches be potentially null, couldn't you just check at the constructor to make sure the parameter is not null? (and throw IllegalArgumentException if it is).

Line:138, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java -> remove this line

Line:208, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java -> log the exception, or our friend Sonar will complain (Activator.log...)

Line:31, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationAlgorithm.java -> remove comment if it's empty

Line:38, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationAlgorithm.java -> object types should start with a capital letter

Line:29, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkEventMatching.java -> xxx@xxx.xxx line

Line:469, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java -> synchronize() sounds like a low-level Java operation and could be confused with 'synchronized' stuff... perhaps something like runSynchronization() would be better?

Line:58, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java -> space after cast.

In fact you could make CtfTmfTrace.createTimestamp return a CtfTmfTimestamp (covariant return type), so you wouldn't need the cast here.

Line:42, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java -> remove empty line

Line:79, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java -> outer parentheses are not needed

Line:29, lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh -> add && to the previous command (not sure if those are really useful though, but better be safe I guess)

Also please update the get-traces.xml script. It's the script used by Maven to do the same thing as this one. Syntax should be straightforward, just copy-paste what it does for the first 2 traces.

Line:22, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfMatchEventDefinition.java -> The description seems to have run away. I think I saw a cat with a class description somewhere...

Line:23, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/ITmfMatchEventDefinition.java -> also xxx@xxx.xxx line

Line:29, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/ITmfTimestampTransform.java -> ctrl+shitf+f

Line:52, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/ITmfTimestampTransform.java -> extra space detected

Line:76, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/Activator.java -> hmm, this should be done on-demand if the user requests synchronization...

more investigation needed

Line:64, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java -> Sir, the javadoc has been detached! Quickly, re-attach it!

Line:30, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java -> xxx@xxx.xxx

Line:57, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/TmfSynchronizationView.java -> remove empty line

Line:444, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java -> You could return a CtfTmfTimestamp here (see comment from previous file)

Line:15, lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF -> Unless you are absolutely certain that you use features only present in that version of Eclipse, do not put a minimum version number.

Line:18, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/synchronization/Messages.java -> Message file for the Synchronization View

Line:21, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkMatchDefinition.java xxx@xxx.xxx line

Line:30, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfNetworkMatchDefinition.java -> ctrl+shift+f this block

Line:41, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java -> Real class description plz

Line:54, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java -> add empty line here

Line:223, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java -> use System.property("line.separator") instead of \n (you can put it in a static local variable)

Line:19, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfTraceSynchronizedSignal.java xxx@xxx.xxx line

Line:50, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/signal/TmfTraceSynchronizedSignal.java -> see getClass().getSimpleName() trick mentioned earlier

-------------------------------------
author: Annalise Jimenez
date: 2013-08-12 18:23:57.000000000

Patch Set 5:

(5 comments)

Thanks for your comments alex, new patchset will follow.

As for what is in event.matching.  Who knows what people will want to match?  I prefer to be prepared for other types of matching, it's not expensive (one abstract, one interface).  

"Network" match actually means one event from one trace can be matched with one event from another trace.  But one may want to match a sequence of events (a -> b -> c) to another sequence of events (d -> e -> f) whether to be used for time sync or not.  I wouldn't want to limit them.

Line:396, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfTrace.java -> This is part of what will need to be rewritten eventually.  The timestamp transform should come within a context (somewhere somehow...).  

But for now it is set on the trace after the synchronization is done (and saved in supplementary files), so it's not really at the constructor level.  Anyway, it can't be final, it needs to go at least when initTrace is called.

Unless you have a heavy objection, I'd leave it like this for now.

Line:33, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> The only decaf I accept to drink is in hexadecimal!  It really tastes so bad?
Now was that a humoristic way to tell me to change that magic number?

Line:36, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> That was copy-pasted from HistoryTree back when over-design was trendy ;-)  I guess I'll downgrade it as well!

Line:73, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/synchronization/SynchronizationBackend.java -> Am I so obvious?

Line:76, lttng/org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/Activator.java -> The event matching does not know a priori what classes it can use to match, and developers and users may add their own.  That's why they register here.

I don't know where else they could go unless I create a new *drums rolling* extension point!  (I'm sold to extension points.   a framework says "extend me please!")

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