DESCRIPTION

tmf: Integration of the pcap parser within TMF

Change-Id: I1f5cdac29ceaa8e513467965b889bf152d2f4edb
Signed-off-by: Itzel Singleton xxx@xxx.xxx


COMMENTS

author: Itzel Singleton
date: 2014-07-18 22:17:48.000000000

Uploaded patch set 7.

-------------------------------------
author: Brenden Conley
date: 2014-07-19 04:11:45.000000000

Patch Set 7:

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

-------------------------------------
author: Brenden Conley
date: 2014-07-19 04:53:40.000000000

Patch Set 7: Verified-1

Build Failed 

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

-------------------------------------
author: Brenden Conley
date: 2014-07-21 18:45:43.000000000

Patch Set 7: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2014-07-21 19:21:56.000000000

Patch Set 7: Verified+1

Build Successful 

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

-------------------------------------
author: Ivy Mitchell
date: 2014-07-22 22:17:41.000000000

Patch Set 7:

Don't forget the test cases :)

-------------------------------------
author: Braxton Mccarthy
date: 2014-07-23 20:35:09.000000000

Patch Set 7: Code-Review-1

(41 comments)

Also, the TmfFilter things should be put in a separate patch (on which this one can depend).

Line:36, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> put this TODO inside the class javadoc

Line:38, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> Add a small description

Line:40, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> remove this empty line

Line:65, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> Would be easier to make TmfTimeRange.ETERNITY xxx@xxx.xxx

Line:76, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> Might be a bit harsh to throw a runtime exception from within an event request. It could be possible, if you're using an experiment of a pcap trace + something else for example, to receive events unrelated to the pcap type. In this case you could just "let it slide" (return).

Line:79, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> PcapEvent.getPacket() returns a Packet, not a PcapPacket.

So either it should be instanceof checked here.

Or, another possibility would be to make PcapEvent only take (at the constructor) and return (in its getPacket()) a PcapPacket, instead of a mere Packet.

Line:81, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> Here too, instead of a runtime exception, you could just ignore this event and keep going.

this.fail() is also an option to gracefully terminate an event request.

Line:92, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> no need to override these two methods if you don't do anything special

Line:112, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/analysis/StreamListAnalysis.java -> Trace is NOT an experiment?

Line:19, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/graph/NetworkGraphView.java -> add empty line between

Line:31, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamDiagramView.java -> add empty line between

Line:18, lttng/org.eclipse.linuxtools.tmf.pcap.ui/META-INF/MANIFEST.MF -> don't put versions on the org.eclipse.{core|ui} plugins (unless you have very specific and documented reasons to do so).

Put the org.eclipse.* and the tmf ones together too

Line:40, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/signal/TmfPacketStreamUpdatedSignal.java -> Why is this parameter nullable? What is the point of sending a "packet stream updated" signal if there is no stream? What does it meeeaaaaaan...

Line:59, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/event/PcapEvent.java -> Wrap this to 2-3 lines. 1 parameter per line is also classy.

how about restricting 'content' to a PcapEventField ? You could then override the getter to only return a PcapEventField too.

Line:69, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/event/PcapEvent.java -> Do you really need to expose pcap.core-specific types? It would be cleaner if it didn't (could be used internally and in non-API classes/methods, but ideally not in API ones).

Like right now tmf.ctf exposes a bunch of ctf.core-specific concepts, which in turns makes it so that lttng2.* plugins need to import ctf.core too. This is not ideal.

Line:17, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/messages.properties -> This shouldn't need to be externalized, it can apply to all languages (I hope...). This part could be inside the code and NON-NLS'ed.

Line:18, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/messages.properties -> In addition to screaming "whitespace!!!1", it's not good practice to have to include spaces at the beginning or end of a localized string. It's easy to miss it and not include it in the other languages. Those spaces should be in the code instead.

File Comment: lttng/org.eclipse.linuxtools.tmf.pcap.ui/rsc/events_view.gif -> rename this "rsc" directory to "icons", to stay consistent with the other .ui plugins.

Line:55, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> put the TODO inside the /** */

Line:94, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> It's a bit annoying to do this every time you want to log something...

How about making xxx@xxx.xxx and null checking in there?

Line:157, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> You don't seem to do a instanceof check anywhere. Potentially unsafe cast?

Line:191, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> This (and part of the method above) could be separated into a PcapEventFactory.

Line:204, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> same line

Line:208, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> same line

Line:218, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> Doesn't matter much, but if it happens often that you have no fields at all, you could store this array statically, instead of creating a new one each time.

Line:232, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> shouldn't you cast ratio to long first?
  ((long) ratio) * pcap.getTotalNbPackets()

that way you don't end up in the middle of packet in the file?

Line:279, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> Don't want to do super.dispose() in all cases?

Line:300, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> Collection.EMPTY_MAP (or ImmutableMap.of() if the type inference is bad)

Line:306, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> same line

Line:30, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/event/PcapEventField.java -> Why does a field has to know about the pcap.core Packet object? These two concepts should stay separate. The Strings and whatnot you are taking from fPacket could be passed at the constructor instead.

Perhaps a PcapEventFactory could generate the PcapEvent (and its PcapEventFields) from the Packet object.

Line:96, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/event/PcapEventField.java -> you could have separate field types, nothing wrong with it. It's a bit bad atm because the framework considers "the field container" and the "the field themselves" to be the same thing. So PcapEventField is kind of your container here.

But for those other tracetype-specific fields, they could have their own class type (PcapDestinationField, PcapProtocolField etc.)) Those should be public too, but can be internal.

Line:57, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/NetworkingPerspectiveFactory.java -> here too would be easier to make those values on the xxx@xxx.xxx directly.

Line:106, lttng/pom.xml -> You should put this after the tmf.* plugins. The order used to be important (had to be in order of dependencies), but until we move everything in here to alphabetical order, it should be kept the same, as it will remain compatible with older versions of Tycho.

Line:153, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> method names shouldn't start with capital letter

Line:162, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> you can use
  trace.getAnalysisModuleOfClass(StreamListAnalysis.class, StreamListAnalysis.ID);

no need to cast then

Line:171, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> these two comments aren't very useful

Line:186, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> great, can't unhear now!

Line:204, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> Maybe use:
  TmfUiRefreshHandler.getInstance().queueUpdate()

Not only this will "coalesce" the UI updates, but since you often do resetView(), followed by updateUI(), you could avoid the clear if it is not needed. (although if you want to have both be executed, you could send a different source object for both).

Line:208, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> table ? (singular)

Line:231, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> getAnalysisModuleOfClass(...)

Line:244, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/stream/StreamListView.java -> are you REALLY guaranteed that every entry in the set is non-null? Perhaps an old-school null-check would be better.

-------------------------------------
author: Ivy Mitchell
date: 2014-07-23 20:36:39.000000000

Patch Set 7: Code-Review-1

(2 comments)

I am very impressed. This is good stuff, minor comments

Line:18, lttng/org.eclipse.linuxtools.tmf.pcap.ui/src/org/eclipse/linuxtools/tmf/pcap/ui/editor/Messages.java -> really?

Line:128, lttng/org.eclipse.linuxtools.tmf.pcap.core/src/org/eclipse/linuxtools/tmf/pcap/core/trace/PcapTrace.java -> why buffer?

-------------------------------------
author: Braxton Mccarthy
date: 2014-07-23 20:37:01.000000000

Patch Set 7:

Oh also, rerun the sync_settings script, some settings have changed since the first version of this.

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