ss: Add JUL logging to some classes
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Tue, 14 Jun 2016 18:27:30 +0000 (14:27 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Wed, 29 Jun 2016 20:10:08 +0000 (16:10 -0400)
This patch adds JUL log points to the state system queries and
to the HT_IO cache hits and misses.

Change-Id: I7dbbc9ec79f0da4a23cd2bc8756ebd3e0eea3b0c
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/75274
Reviewed-by: Hudson CI
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java

index 4213a597c74f94dc9b27bdc0f351430f39e621d8..2a3378c825e7d564391bd186acb2d47ff6509a40 100644 (file)
@@ -24,9 +24,11 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
@@ -59,6 +61,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
     private static final String PARENT = ".."; //$NON-NLS-1$
     private static final String WILDCARD = "*"; //$NON-NLS-1$
 
+    private static final Logger LOGGER = TraceCompassLog.getLogger(StateSystem.class);
+
     /* References to the inner structures */
     private final AttributeTree attributeTree;
     private final TransientState transState;
@@ -544,6 +548,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
             throw new StateSystemDisposedException();
         }
 
+        LOGGER.info(() -> "[StateSystem:FullQueryStart] ssid=" + this.getSSID() + ", ts=" + t);  //$NON-NLS-1$//$NON-NLS-2$
+
         final int nbAttr = getNbAttributes();
         List<@Nullable ITmfStateInterval> stateInfo = new ArrayList<>(nbAttr);
 
@@ -571,6 +577,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
                 throw new IllegalStateException("Incoherent interval storage"); //$NON-NLS-1$
             }
         }
+        LOGGER.info(() -> "[StateSystem:FullQueryEnd]");  //$NON-NLS-1$
         return stateInfo;
     }
 
@@ -581,6 +588,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
             throw new StateSystemDisposedException();
         }
 
+        LOGGER.info(() -> "[StateSystem:SingleQueryStart] ssid=" + this.getSSID() + ", ts=" + t + ", attribute=" + attributeQuark);  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+
         ITmfStateInterval ret = transState.getIntervalAt(t, attributeQuark);
         if (ret == null) {
             /*
@@ -597,6 +606,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
              */
             throw new IllegalStateException("Incoherent interval storage"); //$NON-NLS-1$
         }
+        LOGGER.info(() -> "[StateSystem:SingleQueryEnd]");  //$NON-NLS-1$
         return ret;
     }
 
index 66cd434ec58d7baa488e93b15bc8b4a7a5beae8c..9b9823d54f53fdda64efa467ea898f19441ef4cb 100644 (file)
@@ -18,9 +18,11 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
+import java.util.logging.Logger;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
 import org.eclipse.tracecompass.internal.statesystem.core.Activator;
 
 /**
@@ -33,7 +35,6 @@ import org.eclipse.tracecompass.internal.statesystem.core.Activator;
  * HistoryTree must contain 1 and only 1 HT_IO element.
  *
  * @author Alexandre Montplaisir
- *
  */
 class HT_IO {
 
@@ -73,6 +74,8 @@ class HT_IO {
     private static final int CACHE_MASK = CACHE_SIZE - 1;
     private static final CacheElement NODE_CACHE[] = new CacheElement[CACHE_SIZE];
 
+    private static final Logger LOGGER = TraceCompassLog.getLogger(HT_IO.class);
+
     /**
      * Standard constructor
      *
@@ -131,6 +134,7 @@ class HT_IO {
         CacheElement cachedNode = NODE_CACHE[offset];
 
         if (cachedNode != null && cachedNode.getKey() == this && cachedNode.getValue().getSequenceNumber() == seqNumber) {
+            LOGGER.finest(() -> "[HtIo:CacheHit] seqNum=" + seqNumber); //$NON-NLS-1$
             return cachedNode.getValue();
         }
 
@@ -138,6 +142,7 @@ class HT_IO {
         try {
             seekFCToNodePos(fFileChannelIn, seqNumber);
             HTNode readNode = HTNode.readNode(fConfig, fFileChannelIn);
+            LOGGER.finest(() -> "[HtIo:CacheMiss] seqNum=" + seqNumber); //$NON-NLS-1$
 
             /* Put the node in the cache. */
             NODE_CACHE[offset] = new CacheElement(this, readNode);
This page took 0.0282 seconds and 5 git commands to generate.