CTF: Do not recalculate the single clock each time in CTFTrace#getClock()
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Mon, 4 Aug 2014 17:31:12 +0000 (13:31 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Mon, 4 Aug 2014 20:31:49 +0000 (16:31 -0400)
Change-Id: Ia42daadc9606335073da59a547e93867f445ed91
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/30990
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java

index c489ef2cb0ed994c9611e15550e7e2f5b044f727..4bb35847b7eb804f33a9a698b2460dc1b7ed7f38 100644 (file)
@@ -102,7 +102,7 @@ public class CTFTrace implements IDefinitionScope, AutoCloseable {
     /**
      * The clock of the trace
      */
-    private CTFClock fSingleClock;
+    private CTFClock fSingleClock = null;
 
     /**
      * Packet header structure definition
@@ -698,6 +698,9 @@ public class CTFTrace implements IDefinitionScope, AutoCloseable {
      * @return the clock
      */
     public final CTFClock getClock() {
+        if (fSingleClock != null && fClocks.size() == 1) {
+            return fSingleClock;
+        }
         if (fClocks.size() == 1) {
             fSingleClock = fClocks.get(fClocks.keySet().iterator().next());
             return fSingleClock;
This page took 0.02653 seconds and 5 git commands to generate.