From: Geneviève Bastien Date: Tue, 14 Jun 2016 18:27:30 +0000 (-0400) Subject: ss: Add JUL logging to some classes X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=b2648641471dcf8e47eec7ddb273e4a5bf175943;p=deliverable%2Ftracecompass.git ss: Add JUL logging to some classes 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 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/75274 Reviewed-by: Hudson CI --- diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java index 4213a597c7..2a3378c825 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java @@ -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; } diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java index 66cd434ec5..9b9823d54f 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java @@ -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);