DESCRIPTION

ctf: add Event header data types

This is a composite datatype described in the examples of the CTF spec,
section 6.1.1 . Right now, chances are that many people will re-use this pattern
so why not enhance its performance.

Change-Id: I2042be35fee38e42680691af879357ebb1aff95b
Signed-off-by: Ivy Mitchell xxx@xxx.xxx


COMMENTS

author: Ivy Mitchell
date: 2014-08-04 01:17:17.000000000

Uploaded patch set 16.

-------------------------------------
author: Brenden Conley
date: 2014-08-04 01:17:24.000000000

Patch Set 16:

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

-------------------------------------
author: Brenden Conley
date: 2014-08-04 01:19:39.000000000

Patch Set 16: Verified-1

Build Failed 

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

-------------------------------------
author: Brenden Conley
date: 2014-08-04 01:42:52.000000000

Patch Set 16: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2014-08-04 02:10:49.000000000

Patch Set 16: Verified-1

Build Failed 

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

-------------------------------------
author: Brenden Conley
date: 2014-08-04 03:01:49.000000000

Patch Set 16: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2014-08-04 03:36:57.000000000

Patch Set 16: Verified+1

Build Successful 

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

-------------------------------------
author: Braxton Mccarthy
date: 2014-08-04 22:56:33.000000000

Patch Set 16: Code-Review-1

(8 comments)

Looks good, but there should be some tests to go with the new header types.

Line:102, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderLargeDecl.java -> same here, 32 bits unsigned can give something bigger than Int.MAX_VALUE, should be checked.

Line:129, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderLargeDecl.java -> same here, should have a test

Line:109, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderCompactDecl.java -> The read value can technically be bigger than int, so it should be checked (maybe with Long.intValue()). Or use .getInt(), but I assume here the sign is important.

Line:133, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderCompactDecl.java -> there should be tests for these methods (should pass / shouldn't pass) since they are quite complex.

Line:168, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderCompactDecl.java -> is it really safe to cast this to either StructDeclaration or IntegerDeclaration without instanceof checks?

I understand it *should* be this way, but a "bad" trace could crash the program.

Line:29, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> mention the section, like the other ones

Line:90, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> haven't looked at the whole picture here, but do you want/need to return a new instance every time this method is called? Or could you just create one "32 bit integer definition" on-demand, then always return it? (since they're immutable now, aren't they?)

Line:92, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> same

-------------------------------------
author: Ivy Mitchell
date: 2014-08-05 03:04:08.000000000

Patch Set 16:

(4 comments)

Line:109, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderCompactDecl.java -> Yes, but the data is then stored in a list so we can only get(int)

Line:168, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderCompactDecl.java -> got a point. what's one or two more tests in this list? :)

Line:90, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> The parser only calls this once theoretically. But a cache can be added if there is a non-hypothetical performance gain to be had.

Line:92, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> same

-------------------------------------
author: Braxton Mccarthy
date: 2014-08-05 18:16:58.000000000

Patch Set 16:

(2 comments)

Line:109, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderCompactDecl.java -> That's fine, I understand that we only support int values for "id". But here the value we read from the buffer could be bigger than Int.MAX_VALUE. Basically, it's an unsafe cast, it should be checked. And truncated to int.max_value, or throw an error etc.

Line:90, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> It calls this once, per trace, right?

If you have 300 traces, you would have 300 copies of identical, immutable objects?

I mentioned a "cache" because I know you guys love lazy-loaded fields ;) But simpler might be to just have a static final field that gets loaded with the class.

-------------------------------------
author: Ivy Mitchell
date: 2014-08-07 23:13:12.000000000

Patch Set 16:

(3 comments)

Line:29, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> Not Done oops

Line:90, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> It is actually never called, see https://git.eclipse.org/r/#/c/25937/17/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFStreamInputPacketReader.java
it is implemented for politeness sake.

Line:92, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> samer

-------------------------------------
author: Ivy Mitchell
date: 2014-08-08 19:27:13.000000000

Patch Set 16:

(2 comments)

Line:102, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderLargeDecl.java -> Done

Line:29, lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/types/composite/EventHeaderDef.java -> Done

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