DESCRIPTION

lttng: Support live updating of Control Flow view and Resources view

- Update AbstractTimeGraphView to use a list as input element and to
support a time graph content provider.

- Update AbstractTimeGraphView to create one separate BuildThread per
trace in the trace set. Change buildEventList method to be called
independently for each trace in the trace set.

- Update AbstractTimeGraphView to use a CopyOnWriteArrayList for the
entry list of each trace, and stop exposing the entry list map to
subclasses. Add interface to add or remove a list of entries to/from the
entry list of a trace.

- Update AbstractTimeGraphView refresh method to refresh the time graph
combo or time graph viewer when possible and avoid calling setInput,
which resets all tree elements.

- Update AbstractTimeGraphView to perform packing of tree columns only
once.

- Add support in TimeGraphEntry to update the end time and to replace
the last event with an event starting at the same time.

- Fix TmfEventsEditor sending TmfTraceClosed with null trace.

- Update ControlFlowView and ResourcesView to build the event list for a
trace continuously in a loop until its state system build is complete.
Support continuous updating of the entry list and its tree structure,
and partial updating of the event list at each iteration.

Change-Id: I440c369ddef703f8fbceac221cfea0c0699348c0
Signed-off-by: Luciana Barry xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2014-01-27 22:40:25.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-01-27 22:48:44.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5215/ : FAILURE

-------------------------------------
author: Brenden Conley
date: 2014-01-28 19:43:41.000000000

Patch Set 1: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2014-01-28 19:55:11.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5223/ : FAILURE

-------------------------------------
author: Ivy Mitchell
date: 2014-01-28 21:10:45.000000000

Patch Set 1: Verified+1 Code-Review+2 IP-Clean+1

This patch greatly improves tmf and my life in general, thank you.

-------------------------------------
author: Brenden Conley
date: 2014-01-28 21:25:51.000000000

Patch Set 1: -Verified

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

-------------------------------------
author: Luciana Barry
date: 2014-01-28 21:26:56.000000000

Patch Set 2: Patch Set 1 was rebased

-------------------------------------
author: Brenden Conley
date: 2014-01-28 21:39:46.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/5231/ : FAILURE

-------------------------------------
author: Braxton Mccarthy
date: 2014-01-28 21:56:08.000000000

Patch Set 1:

(18 comments)

Some comments

Line:94, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowEntry.java -> Why not make the super-method public instead?

Seems a little hackish to override this with no change just so it becomes package-visible.

Line:275, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> again!? Why not just test it in this inner-most loop?

Line:84, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> TIMEOUT is vague, LIVE_UPDATE_DELAY maybe?

Line:225, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> getAnalysisModules() is in ITmfTrace now, so shouldn't need to cast this anymore.

Just wondering if it matters if ControlFlowEntry has an ITmfTrace instead of a LttngKernelTrace...

Line:236, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Declarations should use the high-level type (List, Map)

Line:258, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> You already check for monitor.isCanceled() below. Is it really worth checkign twice per loop?

Line:274, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Why is that getQuark* getting this special treatment, and not the one below? Typically if you have the exec_name, you have the PPID, but you never know!

Why not have them both use the higher-level try{} and in the catch AttributeNotFoundE below, just continue?

Or, to keep the behavior the same as right now:

  int execNameQuark = -1;
  int ppidQuark = -1;

  try {
    execNameQuark = ssq.getQuarkRelative(threadQuark, Attributes.EXEC_NAME);
    ppidQuark = ssq.getQuarkRelative(threadQuark, Attributes.PPID);
  } catch (AttributeNotFoundException e) {
    continue;
  }

  try {
    List<ITmfStateInterval> execNameIntervals = ...

Line:315, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> The printStackTrace() does not bother me as much as not using Java7-style compound catch ;)

Line:341, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> List

Also, why use ArrayList here? Looking quickly, you never seem to do accesses to specific indexes. Might as well use LinkedList then, it doesn't have the amortized cost of resizing the "capacity" array underneath.

Line:366, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Why do copies here? addToEntryList() transfers the elements to a separate array already.

Line:96, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> see comment from ControlFlowView, this cast is not necessary anymore

Line:106, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> Map

Line:131, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> You can use
  List<ResourcesEntry> entryList = Collections.singletonList(traceEntry);

Line:138, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> You can do:

  for (Integer cpuQuark : cpuQuarks) {

would also avoid useless re-boxing (when doing entryMap.get(cpuQuark))

Line:151, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> idem

Line:164, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java -> idem

Line:341, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> If one/some of the elements are not of type ITimeGraphEntry, does it also throw a ClassCastException? One solution would be to try/catch that one, and return the empty array if it happens.

Line:1101, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> you can do  } else if {  on the same line

-------------------------------------
author: Luciana Barry
date: 2014-01-29 20:47:00.000000000

Patch Set 1:

(6 comments)

Line:236, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Ok, but I fail to see any reason why this would matter at all for a private or local variable.

Line:258, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> I try to end the thread as soon as possible so that resources can be released.

Line:274, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Because it's an acceptable case to have a thread that doesn't have its Exec_name attribute yet, but once it does, the PPID attribute has to be there, they are added at the same time.

Line:341, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> I own stock in ArrayList.

Line:366, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> It was because of the parameterized type, but I can just update it in the declaration.

Line:341, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/timegraph/AbstractTimeGraphView.java -> It shouldn't happen unless the concrete view class gets the viewer and calls setInput directly, but we can protect as you suggest.

-------------------------------------
author: Braxton Mccarthy
date: 2014-01-29 22:47:19.000000000

Patch Set 1:

(2 comments)

Line:236, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Not as important, but it's a good habit, and it ensures you use only methods available in List (if possible). Then if you want to change the implementation to something else, you just have to change one place.

*cough* LinkedList *cough* ;)

Line:341, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java -> Best reason ever ;)

But still, can you guarantee you always insert at most 10 elements in those lists (the default constructor specifies a capacity of 10)? If not, then LinkedList would be better.

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