mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 04:15:35 +02:00
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
This commit is contained in:
parent
99bc05cba7
commit
6918b6c685
1 changed files with 21 additions and 5 deletions
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.dsf.gdb.service;
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
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 ICommandControlService fConnection;
|
||||||
private CommandFactory fCommandFactory;
|
private CommandFactory fCommandFactory;
|
||||||
private IGDBBackend fBackend;
|
private IGDBBackend fBackend;
|
||||||
|
@ -437,8 +438,8 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
|
||||||
|
|
||||||
|
|
||||||
fConnection = getServicesTracker().getService(ICommandControlService.class);
|
fConnection = getServicesTracker().getService(ICommandControlService.class);
|
||||||
fTraceCache = new CommandCache(getSession(), fConnection);
|
fTraceStatusCache = new CommandCache(getSession(), fConnection);
|
||||||
fTraceCache.setContextAvailable(fConnection.getContext(), true);
|
fTraceStatusCache.setContextAvailable(fConnection.getContext(), true);
|
||||||
|
|
||||||
fBackend = getServicesTracker().getService(IGDBBackend.class);
|
fBackend = getServicesTracker().getService(IGDBBackend.class);
|
||||||
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
|
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory();
|
||||||
|
@ -753,7 +754,22 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
|
||||||
return;
|
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),
|
fCommandFactory.createMITraceStatus(context),
|
||||||
new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {
|
new DataRequestMonitor<MITraceStatusInfo>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1120,6 +1136,6 @@ public class GDBTraceControl_7_2 extends AbstractDsfService implements IGDBTrace
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void flushCache(IDMContext context) {
|
public void flushCache(IDMContext context) {
|
||||||
fTraceCache.reset(context);
|
fTraceStatusCache.reset(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue