Fix for bug 382910: Improve responsiveness of Control Flow and Resources
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / statesystem / StateHistorySystem.java
index 4ee5cdcde7e6486c94555e32b49f8cb078b2f1ec..fb4f585f56bd09fe6a1a0936afa7353ae190197f 100644 (file)
@@ -18,6 +18,8 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.linuxtools.internal.tmf.core.Tracer;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
@@ -214,6 +216,13 @@ public class StateHistorySystem extends StateSystem implements
     public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
             long t1, long t2, long resolution) throws TimeRangeException,
             AttributeNotFoundException {
+        return queryHistoryRange(attributeQuark, t1, t2, resolution, new NullProgressMonitor());
+    }
+
+    @Override
+    public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
+            long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException,
+            AttributeNotFoundException {
         List<ITmfStateInterval> intervals;
         ITmfStateInterval currentInterval;
         long ts, tEnd;
@@ -241,6 +250,9 @@ public class StateHistorySystem extends StateSystem implements
          */
         for (ts = t1; (currentInterval.getEndTime() != -1) && (ts < tEnd);
                 ts += resolution) {
+            if (monitor.isCanceled()) {
+                return intervals;
+            }
             if (ts <= currentInterval.getEndTime()) {
                 continue;
             }
This page took 0.024178 seconds and 5 git commands to generate.