The ThreadedHistoryTreeBackend now keeps track of its own end time that
includes the end time of any interval that is in the interval queue.
This ensures that the history tree is closed with the correct end time.
The HistoryTree no longer updates its end time when initializing new
empty nodes. This ensures that the end time is never greater than the
real end time.
Change-Id: I8ff41d14f54ec1a33b8e22e81a21871f0cbf7ea0
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/64015
Reviewed-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
CoreNode newNode = new CoreNode(fConfig, fNodeCount, parentSeqNumber,
startTime);
fNodeCount++;
CoreNode newNode = new CoreNode(fConfig, fNodeCount, parentSeqNumber,
startTime);
fNodeCount++;
-
- /* Update the treeEnd if needed */
- if (startTime >= fTreeEnd) {
- fTreeEnd = startTime + 1;
- }
LeafNode newNode = new LeafNode(fConfig, fNodeCount, parentSeqNumber,
startTime);
fNodeCount++;
LeafNode newNode = new LeafNode(fConfig, fNodeCount, parentSeqNumber,
startTime);
fNodeCount++;
-
- /* Update the treeEnd if needed */
- if (startTime >= fTreeEnd) {
- fTreeEnd = startTime + 1;
- }
/*******************************************************************************
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
* Copyright (c) 2010, 2011 École Polytechnique de Montréal
* Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
*
* Copyright (c) 2010, 2011 École Polytechnique de Montréal
* Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
*
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.statesystem.core.Activator;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.statesystem.core.Activator;
-import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.CoreNode;
-import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTConfig;
-import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTInterval;
-import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTNode;
-import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HistoryTree;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
}
private void checkValidTime(long t) {
}
private void checkValidTime(long t) {
- long treeStart = fSht.getTreeStart();
- long treeEnd = fSht.getTreeEnd();
- if (t < treeStart || t > treeEnd) {
- throw new TimeRangeException(fSsid + " Time:" + t + ", Start:" + treeStart + ", End:" + treeEnd); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ long startTime = getStartTime();
+ long endTime = getEndTime();
+ if (t < startTime || t > endTime) {
+ throw new TimeRangeException(String.format("%s Time:%d, Start:%d, End:%d", //$NON-NLS-1$
+ fSsid, t, startTime, endTime));
/*******************************************************************************
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
* Copyright (c) 2010, 2011 École Polytechnique de Montréal
* Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
*
* Copyright (c) 2010, 2011 École Polytechnique de Montréal
* Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
*
private static final int CHUNK_SIZE = 127;
private final @NonNull BufferedBlockingQueue<HTInterval> intervalQueue;
private final @NonNull Thread shtThread;
private static final int CHUNK_SIZE = 127;
private final @NonNull BufferedBlockingQueue<HTInterval> intervalQueue;
private final @NonNull Thread shtThread;
+ /**
+ * The backend tracks its end time separately from the tree, to take into
+ * consideration intervals in the queue.
+ */
+ private long fEndTime;
/**
* New state history constructor
/**
* New state history constructor
int maxChildren)
throws IOException {
super(ssid, newStateFile, providerVersion, startTime, blockSize, maxChildren);
int maxChildren)
throws IOException {
super(ssid, newStateFile, providerVersion, startTime, blockSize, maxChildren);
intervalQueue = new BufferedBlockingQueue<>(queueSize / CHUNK_SIZE, CHUNK_SIZE);
shtThread = new Thread(this, "History Tree Thread"); //$NON-NLS-1$
intervalQueue = new BufferedBlockingQueue<>(queueSize / CHUNK_SIZE, CHUNK_SIZE);
shtThread = new Thread(this, "History Tree Thread"); //$NON-NLS-1$
int queueSize)
throws IOException {
super(ssid, newStateFile, providerVersion, startTime);
int queueSize)
throws IOException {
super(ssid, newStateFile, providerVersion, startTime);
intervalQueue = new BufferedBlockingQueue<>(queueSize / CHUNK_SIZE, CHUNK_SIZE);
shtThread = new Thread(this, "History Tree Thread"); //$NON-NLS-1$
intervalQueue = new BufferedBlockingQueue<>(queueSize / CHUNK_SIZE, CHUNK_SIZE);
shtThread = new Thread(this, "History Tree Thread"); //$NON-NLS-1$
HTInterval interval = new HTInterval(stateStartTime, stateEndTime,
quark, (TmfStateValue) value);
intervalQueue.put(interval);
HTInterval interval = new HTInterval(stateStartTime, stateEndTime,
quark, (TmfStateValue) value);
intervalQueue.put(interval);
+ fEndTime = Math.max(fEndTime, stateEndTime);
+ }
+
+ @Override
+ public long getEndTime() {
+ return fEndTime;