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.

2D query will populate the view by asking the backend a list of intervals that suits its.
This method is a thread safe adaptation of "dynamic cache" implements in the patch : https://git.eclipse.org/r/#/c/19330/.
For the history tree backend, the range is the size of the leaf for the query's time.

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


COMMENTS

author: Ayanna Reed
date: 2013-12-09 20:23:03.000000000

Uploaded patch set 4.

-------------------------------------
author: Jordon Obrien
date: 2013-12-09 20:43:28.000000000

Patch Set 4:

(3 comments)

Much more better. A last round of nits.

In the actual state, it is a good "package" to start code review.

Now, do you have information on the improvement?
I know you already did the metrics.
Add the "right" one to the commit message.

Line:90, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> check the time range for ????

check the time range to be sure the color of the sun is still yellow.

Be descriptive. In this case the code and comment give me the same amount of information. The goal of a comment is to give me more information.

Maybe :

Validate the requested time to be within the time range of this list.

Line:220, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> this sentence make no sense.

redo -> done again

I think this is supposed to be two sentences.

Line:164, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> Add an other empty line.

/**
  * Main description
  *
  * Detailed. Much more details.
  *
  * note: ..
  */

-------------------------------------
author: Brenden Conley
date: 2013-12-09 20:59:34.000000000

Patch Set 4:

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

-------------------------------------
author: Brenden Conley
date: 2013-12-09 21:32:42.000000000

Patch Set 4: Verified+1

Build Successful 

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

-------------------------------------
author: Braxton Mccarthy
date: 2013-12-09 21:48:45.000000000

Patch Set 4: Code-Review-1

(16 comments)

Some comments.

I haven't tried it yet, but it looks relatively simple for what it promises, very nice!

As Étienne mentioned, you can include in the commit message some quick benchmark figures, indicating how this patch can help.

Line:7, /COMMIT_MSG -> tmf: ...

Line:9, /COMMIT_MSG -> to make -> making

Line:13, /COMMIT_MSG -> its -> it (?)

Line:14, /COMMIT_MSG -> This method is a thread-safe adaptation of the "dynamic cache" implemented in the patch:

Line:15, /COMMIT_MSG -> You could also mention that for the in-memory backend, it's limited by a fixed number of intervals.

Line:26, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> You don't need @version tags, we don't really use xxx@xxx.xxx is enough

Line:29, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> Is an interface really needed? If the only possible implementation is TmfStateIntervalList, then perhaps just the class is enough. Especially if you want to force the implementation to be immutable.

Line:43, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> list could be final

Line:104, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Might want to return a Collection.unmodifiableList(list), this will ensure the caller cannot then modify the list.

Line:109, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> you don't need "this." here, it's not ambiguous

Line:145, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/InMemoryBackend.java -> Add a TODO in the method maybe, because this is not unsupported by design, only because it wasn't done yet.

Line:255, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java -> same here, add a TODO

Line:220, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> yeah sounds like a bad case of thoughts going faster than words. My bad!

should be "this part will have to be redone to handle different node types"

Line:164, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> what he said, also ctrl+shift+f will preserve your paragraphs only if there's an empty line in-between.

Line:333, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> We should avoid putting assert's in the code, they are only executed if the JVM is run with -ea (-enableassertions), so they're useless 95% of the time.

If you must do some run-time checks, throw an exception.

Line:339, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> can't you use stateInfo.addAll() here?

-------------------------------------
author: Bradyn Guerra
date: 2013-12-09 23:26:05.000000000

Patch Set 4:

(2 comments)

A few comments about comments :)

Line:82, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> Change to "A time that intersects the interval to retrieve."?

If I understand well, it doesn't have to be in the "interval intersection", but between the start timestamp of the first interval and end timestamp of the last interval.

Line:163, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/IStateHistoryBackend.java -> that intersect t? I don't see a startTime and endTime here.

-------------------------------------
author: Jordon Obrien
date: 2013-12-10 04:46:34.000000000

Patch Set 4:

(7 comments)

more comments.

Line:29, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> I agree. The interface may be an over-design.

Any plan to have differents implementation of intervalList.
If yes, explain,

Line:28, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> I don't like the name List because it is not a list.
The container you use is a list, but that doesn't mean you "are" a list.

This is a "collection" or a "set".

And, I think you could use a name like

TmfStateIntervalSnapshot

Line:94, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> Storing intervals in a list is inefficiant.

You create a linear acces at a given timestamp.
The abstraction of a "List" doesn't mean is must be a list.

Line:103, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/TmfStateIntervalList.java -> I don't like exposing this method.
This should be hidden to let you implement a better data-structure.

Line:205, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> Remove this comment and the return.
I'll give you +5 karma points for cleanup.

Line:220, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> Could you fix the same comment in the previous method.

Line:332, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> I don't like the name "write".
You are populating, not writing.

I know there is an other method to be renamed in this file.
This could be done in a separate commit.

ideas:
populateInfoFromNode(...)
fetchIntervalsFromNode(...)
retrieveIntervalsFromNode(...)

-------------------------------------
author: Jordon Obrien
date: 2013-12-10 05:00:26.000000000

Patch Set 4:

(5 comments)

If you keep the interface, not that you document the structure to be immutable.

Don't expose in the interface the "mutable" methods.

This could be a reason to provide an interface.

Line:51, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> if it is intended to be immutable, why setters?

Line:67, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> immutable?

Line:75, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> immutable?

Line:97, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> immutable?

Line:102, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/interval/ITmfStateIntervalList.java -> immutable?

-------------------------------------
author: Jordon Obrien
date: 2013-12-10 05:20:04.000000000

Patch Set 4:

(4 comments)

more comments.

Line:218, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> Do we assume stateInfo is clear?
It is the responsability of the user to clear it?

Line:219, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> /* ... */ -> Read the information in the root node.

Line:225, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HistoryTreeBackend.java -> /* Then the algorithm follows the branch down in the relevant children. */

->
 /* Follow the branch down in the relevant children. */

Line:334, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HTNode.java -> This "if" is useless.
And as most of the time it will be false, it's not more efficient.
Remove it.

-------------------------------------
author: Jordon Obrien
date: 2013-12-10 05:32:48.000000000

Patch Set 4: Code-Review-1

(1 comment)

Line:14, /COMMIT_MSG -> This link seems to be unavailable.

-------------------------------------
author: Ayanna Reed
date: 2013-12-10 16:18:16.000000000

Patch Set 5: Patch Set 4 was rebased

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