DESCRIPTION

Add 2D queries support in the HistoryTreeBackend.

We allow to make automatic range 2D queries in the History Tree. For the standard HistoryTree, it means that we query the complete branch that intersects a time. The result is a TmfStateIntervalList that contains the intervals list, the begin and the end time of this query.

Change-Id: Ifc104d70c472fe6e878780ff19f277145b8a2429
Signed-off-by: Ayanna Reed xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2013-12-09 13:24:10.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2013-12-09 13:57:35.000000000

Patch Set 1: Verified+1

Build Successful 

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

-------------------------------------
author: Jordon Obrien
date: 2013-12-09 15:45:52.000000000

Patch Set 1:

(14 comments)

drive by.

I still didn't take a deep look into the details of the 2D-query. I saw a lot of potential for improvements and this need to be discuss.

A general comment.
Florian, try to make a package deal with this commit which can convince reviewers in a few seconds that this patch-set is a really good solution.

Otherwise, the concept of code review is too expensive.
The goal is to leverage the code quality and we need to decrease as much as possible any back-and-forth (expensive).

So, try to answer questions before they are asked.

Line:9, /COMMIT_MSG -> Try to avoid long line in commit log.

Line:10, /COMMIT_MSG -> Explain what is a 2d request.

Explain why 2d method is better.
Give metrics to sell you idea.

I won't buy something I'm not convince of...

Line:47, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> I think there is no ":" in the coding style

Line:70, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> Try to avoid redundant and useless comment. In this case, the function name give you the same amount of information.

/**
  * Remove all intervals from this intervals list.
  */

Line:102, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/NullBackend.java -> Should this function should returned a boolean?
You need to know if the backend support query 2D.
And, should the "default implementation" be in a base class?

Or, as you did in an other file:
throw new UnsupportedOperationException();

Line:33, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Start -> End

Line:38, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> intervals*

Line:83, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/InMemoryBackend.java -> final

Line:240, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> This piece of code is useless.
remove it

Line:3, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> If this was implented by Alex when he was a Poly, you should leave it as is.

Line:162, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> You can say that, but not write it.
"give me all interval around the given time" 

This is the interface and the documentation for a person who want to abstract the lower layer. Be clear.

Explain what is a 2d query.

Line:326, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> vector?
You assume it's a vector but any "List" works here.
Keep the same level of abstraction in your comments.

Line:329, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> This is not documentation. You forward the reader to somewhere else. You can keep this sentence, but add a "real" description first.

Line:334, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> This is common in the code base, and I dislike it.

size() == 0   -> isEmpty()

You cannot assume the way the List operator implements size() and may be a huge cost (linear and not constant time).

-------------------------------------
author: Jordon Obrien
date: 2013-12-09 16:23:07.000000000

Patch Set 1:

More comments.

1) When a patch is not ready to commit, add something in the commit message to specify it (like Draft, don't submit, etc...).

see:
  https://git.eclipse.org/r/#/c/15935/
  ust: memory usage prototype (Draft)

This avoid leading incomplete code to land in the code base.


2) Always provide unittests to cover your code.
   Even if this was not the practice into TMF before,
   it should come (I hope).

   unittests are documentation on the API.
   Don't postpone the technical dept to maintainers.

   Well tested code have more chance to land.
   And stable code can receive more commits.

-------------------------------------
author: Bradyn Guerra
date: 2013-12-09 17:05:41.000000000

Patch Set 1:

(2 comments)

I catched a small bug related to the calculation of the start and end time of a list of intervals. Code review is great to catch that kind of problem early :)

Line:64, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> It should be
start = Math.**min**(start, interval.getStartTime());
end = Math.**max**(end, interval.get**End**Time()); 
And in the constructor, something like:
this.start = Long.MAX_VALUE;
this.end = Long.MIN_VALUE;

With your current code, after adding:
A[start=10]
B[start=20]
this.start is 20, which is wrong.

Line:76, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Should you return null immediatly if time < start || time > end?

-------------------------------------
author: Ayanna Reed
date: 2013-12-09 17:09:07.000000000

Patch Set 1:

(11 comments)

Line:70, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> Done

Line:102, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/NullBackend.java -> I have add a new UnsupportedOperationException(); in the Partial History.
Here, I used the same pattern as doQuery.

Line:33, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Done

Line:38, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Done

Line:83, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/InMemoryBackend.java -> Done

Line:240, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> Done

Line:3, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> It's okay with change policies.

Line:162, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> Done

Line:326, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> Done

Line:329, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> Done

Line:334, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> Done

-------------------------------------
author: Ayanna Reed
date: 2013-12-09 17:19:55.000000000

Patch Set 1:

(2 comments)

Update with Francois comments.

Line:64, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> No, we want to have the intersection of all intervals. The time interval [start,end] is the biggest interval that contains all StateInterval.
In fact it's an interval where we are sure that we have all the information to populate the view after.

So ifA[start=10] B[start=20] this.start is 20, and it's correct.

Line:76, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Done

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