Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2013-12-16 20:03:00 +0000
committerMarc Khouzam2014-01-06 20:49:53 +0000
commit6918b6c685627fab139ea76587d922c15228ae6b (patch)
tree548404295d3997ce0f20f8e1c0f6f6e51e2b8827
parent99bc05cba725a422cca6dae138e3766000dccd51 (diff)
downloadorg.eclipse.cdt-6918b6c685627fab139ea76587d922c15228ae6b.tar.gz
org.eclipse.cdt-6918b6c685627fab139ea76587d922c15228ae6b.tar.xz
org.eclipse.cdt-6918b6c685627fab139ea76587d922c15228ae6b.zip
Bug 353034 - Cache "trace-status" command
Change-Id: Id704b2b3824a016c1d9445e8625453944001863b Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/19876
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java
index 224ddef6138..a9b419a5396 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java
@@ -11,6 +11,7 @@
package org.eclipse.cdt.dsf.gdb.service;
import java.util.Hashtable;
+import java.util.concurrent.TimeUnit;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
@@ -389,7 +390,7 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
}
}
- private CommandCache fTraceCache;
+ private CommandCache fTraceStatusCache;
private ICommandControlService fConnection;
private CommandFactory fCommandFactory;
private IGDBBackend fBackend;
@@ -437,8 +438,8 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
fConnection = getServicesTracker().getService(ICommandControlService.class);
- fTraceCache = new CommandCache(getSession(), fConnection);
- fTraceCache.setContextAvailable(fConnection.getContext(), true);
+ fTraceStatusCache = new CommandCache(getSession(), fConnection);
+ fTraceStatusCache.setContextAvailable(fConnection.getContext(), true);
fBackend = getServicesTracker().getService(IGDBBackend.class);
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
@@ -753,7 +754,22 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
return;
}
- fConnection.queueCommand(
+ // Start an automatic one-time flushing of the TraceStatusCache.
+ // This avoids sending -trace-status multiples time in a very short
+ // amount of time. We still have to clear the cache very quickly
+ // because -trace-status can change very fast as it reports
+ // the number of frames collected. Having a small interval of
+ // stale data is currently not a big deal, and not user-visible.
+ // We just have to be careful in the future that command enablement
+ // should not be affected by this cache. For example, if a command
+ // checks if it should be enabled by using this call, and misses
+ // the latest state due to the cache.
+ // Bug 353034
+ getExecutor().schedule(new Runnable() {
+ @Override public void run() { fTraceStatusCache.reset(context); }
+ }, 300, TimeUnit.MILLISECONDS);
+
+ fTraceStatusCache.execute(
fCommandFactory.createMITraceStatus(context),
new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {
@Override
@@ -1120,6 +1136,6 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
@Override
public void flushCache(IDMContext context) {
- fTraceCache.reset(context);
+ fTraceStatusCache.reset(context);
}
}

Back to the top