aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Wininger2014-04-11 14:59:43 (EDT)
committerAlexandre Montplaisir2014-04-11 15:21:52 (EDT)
commitef210e80858c7fd59fa47ac07c21d46f383e0c0b (patch)
tree23b6110e489dfca4dc7bb8cb91be003d4cab247a
parent04ff2587bbe83bacefb78150703d6979e00c79e9 (diff)
downloadorg.eclipse.linuxtools-ef210e80858c7fd59fa47ac07c21d46f383e0c0b.zip
org.eclipse.linuxtools-ef210e80858c7fd59fa47ac07c21d46f383e0c0b.tar.gz
org.eclipse.linuxtools-ef210e80858c7fd59fa47ac07c21d46f383e0c0b.tar.bz2
tmf : queryHistoryRange performance fixrefs/changes/55/21155/12
This patch removes unnecessary loops for small resolutions, which increases the performance. Benchmark : Before : Query resolution 1022444670: 0.245 Query resolution 102244467: 1.167 Query resolution 10224446: 3.390s Query resolution 1022444: 4.028s Query resolution 102244: 4.285s Query resolution 10224: 5.451s Query resolution 1022: 10.970s Query resolution 102: 37.396s Query resolution 10: 306.308s After : Query resolution 1022444670: 0.278s Query resolution 102244467: 1.138s Query resolution 10224446: 3.373s Query resolution 1022444: 3.976s Query resolution 102244: 4.329s Query resolution 10224: 5.309s Query resolution 1022: 8.001s Query resolution 102: 8.145s Query resolution 10: 8.231s Reference : Performance with queryHistoryRange without resolution : 8.414s Change-Id: I6022dc6c562d994310f9419c362dd1f06a414036 Signed-off-by: Florian Wininger <florian.wininger@polymtl.ca> Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-on: https://git.eclipse.org/r/21155 Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
index 00871e8..4ff2972 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
@@ -415,8 +415,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
if (stackDepth >= 100000) {
/*
- * Limit stackDepth to 100000, to avoid having Attribute Trees grow out
- * of control due to buggy insertions
+ * Limit stackDepth to 100000, to avoid having Attribute Trees grow
+ * out of control due to buggy insertions
*/
String message = "Stack limit reached, not pushing"; //$NON-NLS-1$
throw new AttributeNotFoundException(message);
@@ -468,7 +468,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
/* Update the state value of the stack-attribute */
ITmfStateValue nextSV;
- if (--stackDepth == 0 ) {
+ if (--stackDepth == 0) {
/* Store a null state value */
nextSV = TmfStateValue.nullValue();
} else {
@@ -542,7 +542,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
*/
protected void replaceOngoingState(List<ITmfStateInterval> newStateIntervals) {
transState.replaceOngoingState(newStateIntervals);
- }
+ }
//--------------------------------------------------------------------------
// Regular query methods (sent to the back-end)
@@ -686,8 +686,8 @@ public class StateSystem implements ITmfStateSystemBuilder {
throw new StateSystemDisposedException();
}
- List<ITmfStateInterval> intervals;
- ITmfStateInterval currentInterval;
+ List<ITmfStateInterval> intervals = new LinkedList<>();
+ ITmfStateInterval currentInterval = null;
long ts, tEnd;
IProgressMonitor mon = monitor;
@@ -707,29 +707,21 @@ public class StateSystem implements ITmfStateSystemBuilder {
tEnd = t2;
}
- /* Get the initial state at time T1 */
- intervals = new ArrayList<>();
- currentInterval = querySingleState(t1, attributeQuark);
- intervals.add(currentInterval);
-
/*
* Iterate over the "resolution points". We skip unneeded queries in the
* case the current interval is longer than the resolution.
*/
- for (ts = t1; (currentInterval.getEndTime() != -1) && (ts < tEnd);
- ts += resolution) {
+ for (ts = t1; ts <= tEnd;
+ ts += ((currentInterval.getEndTime() - ts) / resolution + 1) * resolution) {
if (mon.isCanceled()) {
return intervals;
}
- if (ts <= currentInterval.getEndTime()) {
- continue;
- }
currentInterval = querySingleState(ts, attributeQuark);
intervals.add(currentInterval);
}
/* Add the interval at t2, if it wasn't included already. */
- if (currentInterval.getEndTime() < tEnd) {
+ if (currentInterval != null && currentInterval.getEndTime() < tEnd) {
currentInterval = querySingleState(tEnd, attributeQuark);
intervals.add(currentInterval);
}