DESCRIPTION

lttng: Sort the entries in the Resources View

Make the ITmfTimeGraphEntry Comparable, so that each type can
define how they want to be sorted. Each view is then free to sort
however it wants.

This also fixes entries being added while the trace is being read
("live" reading). The entries are now added at their correct position.

Change-Id: I5a99652b5b755ea9f2e76e32167ad0d15b76a320
Signed-off-by: Braxton Mccarthy xxx@xxx.xxx


COMMENTS

author: Braxton Mccarthy
date: 2014-05-21 22:39:15.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-05-21 22:39:21.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-05-21 23:16:45.000000000

Patch Set 1: Verified+1

Build Successful 

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

-------------------------------------
author: Luciana Barry
date: 2014-05-22 13:54:43.000000000

Patch Set 1: Code-Review-1

(6 comments)

Line:14, /COMMIT_MSG -> I think (?) this was already the case?

Line:159, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> Not sure why this change to the base class?

Line:186, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> Don't need to consider the name format, just use getType() and getId().

Line:26, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> why does the class need to be abstract?

Line:72, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> I don't see in this patch why this change is necessary?

Line:26, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/ITimeGraphEntry.java -> I don't see in this patch where it is used? Why not let only the entries that require it be Comparable? As a bonus they would be Comparable<the right class>.

-------------------------------------
author: Braxton Mccarthy
date: 2014-05-22 14:37:56.000000000

Patch Set 1:

(7 comments)

Thanks for the comments! I'll keep the Comparable into ResourcesEntry for now.

Line:14, /COMMIT_MSG -> Not with current master. We'd get the initial (pseudo-random) order, and the additional entries seen as we read the trace get added at the end.

Line:170, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> this call requires the method in TimeGraphEntry to become public.

Line:159, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> I suspect the previous method was never being called at all. It would call super.addChild(TtimeGraphEntry). It's safer to override the method, so there is only one possible match.

Line:186, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> oh, good point! With that we can avoid the silly string splitting and parsing!

Line:26, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> It doesn't need to, but it can, so why not? :)  In general it's cleaner if only "leaf" classes are instantiable.

Line:72, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java -> entry.setParent(this);  in ResourcesEntry, see comment in that file

Line:26, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/ITimeGraphEntry.java -> It seems like a good idea to have entry types themselves be comparable. Like a CFV entry's default comparison would be with TID's etc.

Every view normally wants a specific order for their entries, making the entry object Comparable is semantically nicer than custom loops in the code of the view.

Granted it should be part of a separate patch though.

-------------------------------------
author: Luciana Barry
date: 2014-05-22 18:00:51.000000000

Patch Set 1:

(2 comments)

Line:170, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> Are you sure? The method was protected and this is a subclass.

Line:159, lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesEntry.java -> Indeed, ouch, that was a bad mistake!

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