DESCRIPTION

tmf : fix for CtfIterator getCurrentEvent()

This function is very costly and is called 3 times per event.
The previousCurrentEvent is cached to accelerate the processus of state system build.

Benchmark for the TMF sample trace (13.4 Mo with 697343 events) :

Before :
Build of the state system : 8.896 s
Call of createEvent function : 2 091 982

After :
Build of the state system : 7.209 s
Call of createEvent function : 697 343

Possible gain of the state system building time : 23.4 %

Signed-off-by: Ayanna Reed xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2014-02-03 16:17:14.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-02-03 16:55:57.000000000

Patch Set 1: Verified+1

Build Successful 

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

-------------------------------------
author: Braxton Mccarthy
date: 2014-02-05 00:04:54.000000000

Patch Set 1: Code-Review-1

(6 comments)

Good find! Not sure why getCurrentEvent() is called multiple times for the same event... this whole CtfIterator business is just a bandaid over TMF's insane TmfContext API.

Some comments though.

Line:10, /COMMIT_MSG -> accelerate the process of building the state system

Line:23, /COMMIT_MSG -> missing Change-Id.  Make sure you re-use the one Gerrit assigned if you push a new patch.

Line:120, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java -> Since this method accesses mutable class fields, it should be synchronized. Or at least, locked on its own (not sure if it should be locked together with advance() etc.  I assume it should?)

Note that this will have a small performance impact. It will be interesting to see the new benchmark.

Line:3, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java -> You can use accents, files are all formatted in UTF-8 now.

Line:12, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java -> Improve performance.   or "Performance improvements".

Line:128, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java -> hashCode() calls the hashcode of this iterator object. Wouldn't be faster/more representative to check the hashCode of fCurrentLocation?

-------------------------------------
author: Ayanna Reed
date: 2014-02-05 15:04:35.000000000

Patch Set 1:

(3 comments)

Thanks Alex for the comments, it's even better with fCurLocation.hashCode().

Line:23, /COMMIT_MSG -> Done

Line:3, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java -> Done

Line:128, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java -> Yes, it's better : 7.2s -> 6.8s.

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