mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 459114 - [visualizer] Make it possible to override the construction of the data model
Change-Id: Ib2af550136fa3ca638fd970e3c2e40ddf597ba80
This commit is contained in:
parent
275feb6874
commit
384e9759c4
4 changed files with 302 additions and 311 deletions
|
@ -22,6 +22,7 @@
|
||||||
* Marc Dumais (Ericsson) - Bug 451392
|
* Marc Dumais (Ericsson) - Bug 451392
|
||||||
* Marc Dumais (Ericsson) - Bug 453206
|
* Marc Dumais (Ericsson) - Bug 453206
|
||||||
* Marc Dumais (Ericsson) - Bug 458076
|
* Marc Dumais (Ericsson) - Bug 458076
|
||||||
|
* Alvaro Sanchez-Leon (Ericsson) - Bug 459114 - override construction of the data model
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
||||||
|
@ -33,7 +34,10 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
||||||
|
@ -54,14 +58,15 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerL
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerModel;
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerModel;
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerThread;
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerThread;
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFDebugModel;
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFDebugModel;
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFDebugModelListener;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFSessionState;
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DSFSessionState;
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DebugViewUtils;
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.DebugViewUtils;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils.IDSFTargetDataProxy;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICPUDMContext;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICPUDMContext;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICoreDMContext;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICoreDMContext;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||||
import org.eclipse.cdt.visualizer.ui.canvas.GraphicCanvas;
|
import org.eclipse.cdt.visualizer.ui.canvas.GraphicCanvas;
|
||||||
import org.eclipse.cdt.visualizer.ui.canvas.GraphicCanvasVisualizer;
|
import org.eclipse.cdt.visualizer.ui.canvas.GraphicCanvasVisualizer;
|
||||||
|
@ -102,9 +107,7 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
* This visualizer uses the CDT Visualizer framework.
|
* This visualizer uses the CDT Visualizer framework.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
public class MulticoreVisualizer extends GraphicCanvasVisualizer implements IPinnable {
|
||||||
implements DSFDebugModelListener, IPinnable
|
|
||||||
{
|
|
||||||
// --- constants ---
|
// --- constants ---
|
||||||
|
|
||||||
/** Eclipse ID for this view */
|
/** Eclipse ID for this view */
|
||||||
|
@ -118,6 +121,11 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
*/
|
*/
|
||||||
protected VisualizerModel fDataModel;
|
protected VisualizerModel fDataModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy to the target data needed to build the model
|
||||||
|
*/
|
||||||
|
protected IDSFTargetDataProxy fTargetData;
|
||||||
|
|
||||||
/** Downcast reference to canvas. */
|
/** Downcast reference to canvas. */
|
||||||
protected MulticoreVisualizerCanvas m_canvas;
|
protected MulticoreVisualizerCanvas m_canvas;
|
||||||
|
|
||||||
|
@ -226,6 +234,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
/** Constructor. */
|
/** Constructor. */
|
||||||
public MulticoreVisualizer()
|
public MulticoreVisualizer()
|
||||||
{
|
{
|
||||||
|
fTargetData = new DSFDebugModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Dispose method. */
|
/** Dispose method. */
|
||||||
|
@ -259,7 +268,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
*/
|
*/
|
||||||
protected void initializeLoadMeterTimer() {
|
protected void initializeLoadMeterTimer() {
|
||||||
if (!m_loadMetersEnabled) return;
|
if (!m_loadMetersEnabled) return;
|
||||||
m_updateLoadMeterTimer = DSFDebugModel.getLoadTimer(m_sessionState, m_loadMeterTimerPeriod, this);
|
m_updateLoadMeterTimer = getLoadTimer(m_sessionState, m_loadMeterTimerPeriod);
|
||||||
// one-shot timer (re-scheduled upon successful triggering)
|
// one-shot timer (re-scheduled upon successful triggering)
|
||||||
m_updateLoadMeterTimer.setRepeating(false);
|
m_updateLoadMeterTimer.setRepeating(false);
|
||||||
}
|
}
|
||||||
|
@ -1119,8 +1128,19 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
*/
|
*/
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getVisualizerModel() {
|
public void getVisualizerModel() {
|
||||||
fDataModel = new VisualizerModel(m_sessionState.getSessionID());
|
String sessionId = m_sessionState.getSessionID();
|
||||||
DSFDebugModel.getCPUs(m_sessionState, this, fDataModel);
|
DsfSession session = DsfSession.getSession(sessionId);
|
||||||
|
|
||||||
|
if (session != null) {
|
||||||
|
fDataModel = new VisualizerModel(sessionId);
|
||||||
|
fTargetData.getCPUs(m_sessionState, new DataRequestMonitor<ICPUDMContext[]>(session.getExecutor(), null) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
ICPUDMContext[] cpuContexts = isSuccess() ? getData() : null;
|
||||||
|
getCPUsDone(cpuContexts, fDataModel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Invoked when getModel() request completes. */
|
/** Invoked when getModel() request completes. */
|
||||||
|
@ -1136,9 +1156,8 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
// --- DSFDebugModelListener implementation ---
|
// --- DSFDebugModelListener implementation ---
|
||||||
|
|
||||||
/** Invoked when DSFDebugModel.getCPUs() completes. */
|
/** Invoked when DSFDebugModel.getCPUs() completes. */
|
||||||
@Override
|
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getCPUsDone(ICPUDMContext[] cpuContexts, Object arg)
|
public void getCPUsDone(ICPUDMContext[] cpuContexts, final Object arg)
|
||||||
{
|
{
|
||||||
VisualizerModel model = (VisualizerModel) arg;
|
VisualizerModel model = (VisualizerModel) arg;
|
||||||
|
|
||||||
|
@ -1152,7 +1171,24 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
model.getTodo().add(1);
|
model.getTodo().add(1);
|
||||||
|
|
||||||
// Collect core data.
|
// Collect core data.
|
||||||
DSFDebugModel.getCores(m_sessionState, this, model);
|
fTargetData.getCores(m_sessionState, new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
// Get Cores
|
||||||
|
ICoreDMContext[] coreContexts = isSuccess() ? getData() : null;
|
||||||
|
|
||||||
|
ICPUDMContext cpu = null;
|
||||||
|
if (coreContexts != null && coreContexts.length > 0) {
|
||||||
|
// TODO: This keeps the functionality to the same level before change: 459114,
|
||||||
|
// although it's noted that this does not cover the possibility to have multiple CPU's
|
||||||
|
// within the list of resolved cores
|
||||||
|
cpu = DMContexts.getAncestorOfType(coreContexts[0], ICPUDMContext.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Continue
|
||||||
|
getCoresDone(cpu, coreContexts, arg);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// save CPU contexts
|
// save CPU contexts
|
||||||
m_cpuCoreContextsCache.addAll(Arrays.asList(cpuContexts));
|
m_cpuCoreContextsCache.addAll(Arrays.asList(cpuContexts));
|
||||||
|
@ -1161,24 +1197,25 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
int count = cpuContexts.length;
|
int count = cpuContexts.length;
|
||||||
model.getTodo().add(count);
|
model.getTodo().add(count);
|
||||||
|
|
||||||
for (ICPUDMContext cpuContext : cpuContexts) {
|
for (final ICPUDMContext cpuContext : cpuContexts) {
|
||||||
int cpuID = Integer.parseInt(cpuContext.getId());
|
int cpuID = Integer.parseInt(cpuContext.getId());
|
||||||
model.addCPU(new VisualizerCPU(cpuID));
|
model.addCPU(new VisualizerCPU(cpuID));
|
||||||
|
|
||||||
// Collect core data.
|
// Collect core data.
|
||||||
DSFDebugModel.getCores(m_sessionState, cpuContext, this, model);
|
fTargetData.getCores(m_sessionState, cpuContext, new ImmediateDataRequestMonitor<ICoreDMContext[]>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
ICoreDMContext[] coreContexts = isSuccess() ? getData() : null;
|
||||||
|
getCoresDone(cpuContext, coreContexts, arg);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Invoked when getCores() request completes. */
|
/** Invoked when getCores() request completes. */
|
||||||
@Override
|
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getCoresDone(ICPUDMContext cpuContext,
|
public void getCoresDone(final ICPUDMContext cpuContext, ICoreDMContext[] coreContexts, final Object arg)
|
||||||
ICoreDMContext[] coreContexts,
|
|
||||||
Object arg)
|
|
||||||
{
|
{
|
||||||
VisualizerModel model = (VisualizerModel) arg;
|
VisualizerModel model = (VisualizerModel) arg;
|
||||||
|
|
||||||
|
@ -1196,12 +1233,19 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
int count = coreContexts.length;
|
int count = coreContexts.length;
|
||||||
model.getTodo().add(count);
|
model.getTodo().add(count);
|
||||||
|
|
||||||
for (ICoreDMContext coreContext : coreContexts) {
|
for (final ICoreDMContext coreContext : coreContexts) {
|
||||||
int coreID = Integer.parseInt(coreContext.getId());
|
int coreID = Integer.parseInt(coreContext.getId());
|
||||||
cpu.addCore(new VisualizerCore(cpu, coreID));
|
cpu.addCore(new VisualizerCore(cpu, coreID));
|
||||||
|
|
||||||
// Collect thread data
|
// Collect thread data
|
||||||
DSFDebugModel.getThreads(m_sessionState, cpuContext, coreContext, this, model);
|
fTargetData.getThreads(m_sessionState, cpuContext, coreContext, new ImmediateDataRequestMonitor<IDMContext[]>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
IDMContext[] threadContexts = isSuccess() ? getData() : null;
|
||||||
|
|
||||||
|
getThreadsDone(cpuContext, coreContext, threadContexts, arg);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,12 +1256,11 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
|
|
||||||
|
|
||||||
/** Invoked when getThreads() request completes. */
|
/** Invoked when getThreads() request completes. */
|
||||||
@Override
|
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getThreadsDone(ICPUDMContext cpuContext,
|
public void getThreadsDone(final ICPUDMContext cpuContext,
|
||||||
ICoreDMContext coreContext,
|
final ICoreDMContext coreContext,
|
||||||
IDMContext[] threadContexts,
|
IDMContext[] threadContexts,
|
||||||
Object arg)
|
final Object arg)
|
||||||
{
|
{
|
||||||
VisualizerModel model = (VisualizerModel) arg;
|
VisualizerModel model = (VisualizerModel) arg;
|
||||||
|
|
||||||
|
@ -1230,11 +1273,17 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
model.getTodo().add(count);
|
model.getTodo().add(count);
|
||||||
|
|
||||||
for (IDMContext threadContext : threadContexts) {
|
for (IDMContext threadContext : threadContexts) {
|
||||||
IMIExecutionDMContext execContext =
|
final IMIExecutionDMContext execContext =
|
||||||
DMContexts.getAncestorOfType(threadContext, IMIExecutionDMContext.class);
|
DMContexts.getAncestorOfType(threadContext, IMIExecutionDMContext.class);
|
||||||
// Don't add the thread to the model just yet, let's wait until we have its data and execution state.
|
// Don't add the thread to the model just yet, let's wait until we have its data and execution state.
|
||||||
// Collect thread data
|
// Collect thread data
|
||||||
DSFDebugModel.getThreadData(m_sessionState, cpuContext, coreContext, execContext, this, model);
|
fTargetData.getThreadData(m_sessionState, cpuContext, coreContext, execContext, new ImmediateDataRequestMonitor<IThreadDMData>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
IThreadDMData threadData = isSuccess() ? getData() : null;
|
||||||
|
getThreadDataDone(cpuContext, coreContext, execContext, threadData, arg);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,22 +1293,40 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Invoked when getThreads() request completes. */
|
/** Invoked when getThreads() request completes. */
|
||||||
@Override
|
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getThreadDataDone(ICPUDMContext cpuContext,
|
public void getThreadDataDone(final ICPUDMContext cpuContext,
|
||||||
ICoreDMContext coreContext,
|
final ICoreDMContext coreContext,
|
||||||
IMIExecutionDMContext execContext,
|
final IMIExecutionDMContext execContext,
|
||||||
IThreadDMData threadData,
|
final IThreadDMData threadData,
|
||||||
Object arg)
|
final Object arg)
|
||||||
{
|
{
|
||||||
|
// Get the execution state
|
||||||
// Don't add the thread to the model just yet, let's wait until we have its execution state.
|
fTargetData.getThreadExecutionState(m_sessionState, cpuContext, coreContext, execContext,
|
||||||
DSFDebugModel.getThreadExecutionState(m_sessionState, cpuContext, coreContext, execContext, threadData, this, arg);
|
threadData, new ImmediateDataRequestMonitor<VisualizerExecutionState>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
final VisualizerExecutionState state = isSuccess() ? getData() : null;
|
||||||
|
if (state != null && !(state.equals(VisualizerExecutionState.RUNNING)) ) {
|
||||||
|
// Get the frame data
|
||||||
|
fTargetData.getTopFrameData(m_sessionState, execContext, new ImmediateDataRequestMonitor<IFrameDMData>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
IFrameDMData frameData = isSuccess() ? getData() : null;
|
||||||
|
getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData,
|
||||||
|
frameData, state, arg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// frame data is not valid
|
||||||
|
getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData,
|
||||||
|
null, state, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Invoked when getThreadExecutionState() request completes. */
|
/** Invoked when getThreadExecutionState() request completes. */
|
||||||
@Override
|
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getThreadExecutionStateDone(ICPUDMContext cpuContext,
|
public void getThreadExecutionStateDone(ICPUDMContext cpuContext,
|
||||||
ICoreDMContext coreContext,
|
ICoreDMContext coreContext,
|
||||||
|
@ -1311,7 +1378,6 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
|
|
||||||
/** Updates the loads for all cpus and cores */
|
/** Updates the loads for all cpus and cores */
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
@Override
|
|
||||||
public void updateLoads() {
|
public void updateLoads() {
|
||||||
if (m_cpuCoreContextsCache.isEmpty()) {
|
if (m_cpuCoreContextsCache.isEmpty()) {
|
||||||
// not ready to get load info yet
|
// not ready to get load info yet
|
||||||
|
@ -1322,20 +1388,25 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualizerModel model = fDataModel;
|
final VisualizerModel model = fDataModel;
|
||||||
|
|
||||||
model.getLoadTodo().dispose();
|
model.getLoadTodo().dispose();
|
||||||
// keep track of how many loads we expect
|
// keep track of how many loads we expect
|
||||||
model.getLoadTodo().add(m_cpuCoreContextsCache.size());
|
model.getLoadTodo().add(m_cpuCoreContextsCache.size());
|
||||||
|
|
||||||
// ask load for each CPU and core
|
// ask load for each CPU and core
|
||||||
for (IDMContext context : m_cpuCoreContextsCache) {
|
for (final IDMContext context : m_cpuCoreContextsCache) {
|
||||||
DSFDebugModel.getLoad(m_sessionState, context, this, model);
|
fTargetData.getLoad(m_sessionState, context, new ImmediateDataRequestMonitor<ILoadInfo>() {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
ILoadInfo loadInfo = isSuccess() ? getData() : null;
|
||||||
|
getLoadDone(context, loadInfo, model);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Invoked when a getLoad() request completes. */
|
/** Invoked when a getLoad() request completes. */
|
||||||
@Override
|
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void getLoadDone(IDMContext context, ILoadInfo load, Object arg)
|
public void getLoadDone(IDMContext context, ILoadInfo load, Object arg)
|
||||||
{
|
{
|
||||||
|
@ -1386,5 +1457,30 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Timer getLoadTimer(final DSFSessionState sessionState, final int timeout) {
|
||||||
|
Timer t = new Timer(timeout) {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (sessionState != null) {
|
||||||
|
DsfSession session = DsfSession.getSession(sessionState.getSessionID());
|
||||||
|
if (session != null) {
|
||||||
|
DsfExecutor executor = session.getExecutor();
|
||||||
|
if (executor != null) {
|
||||||
|
executor.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateLoads();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012, 2014 Tilera Corporation and others.
|
* Copyright (c) 2012, 2015 Tilera Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
* William R. Swanson (Tilera Corporation) - initial API and implementation
|
* William R. Swanson (Tilera Corporation) - initial API and implementation
|
||||||
* Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
|
* Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
|
||||||
* Xavier Raynaud (Kalray) - Bug 431935
|
* Xavier Raynaud (Kalray) - Bug 431935
|
||||||
|
* Alvaro Sanchez-Leon (Ericsson) - Bug 459114 - override construction of the data model
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
|
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
|
||||||
|
@ -16,7 +17,7 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateCountingRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateCountingRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
|
||||||
|
@ -44,98 +45,73 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
|
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
|
||||||
import org.eclipse.cdt.visualizer.ui.util.Timer;
|
|
||||||
|
|
||||||
|
|
||||||
/** Debugger state information accessors.
|
/** Debugger state information accessors.</br>
|
||||||
*
|
*
|
||||||
* NOTE: The methods on this class perform asynchronous operations,
|
* NOTE: The methods on this class perform asynchronous operations
|
||||||
* and call back to a method on a provided DSFDebugModelListener instance
|
* and the result is reported back via the received request monitor
|
||||||
* when the operation is completed.
|
|
||||||
*
|
|
||||||
* The "arg" argument to each method can be used by the caller to
|
|
||||||
* pass through information (partial state, etc.) that will be needed
|
|
||||||
* by the callback method. This argument is ignored by the methods
|
|
||||||
* on this class, and is allowed to be null.
|
|
||||||
*/
|
*/
|
||||||
public class DSFDebugModel {
|
public class DSFDebugModel implements IDSFTargetDataProxy {
|
||||||
|
|
||||||
// --- static methods ---
|
// --- static methods ---
|
||||||
|
@Override
|
||||||
/** Requests list of CPUs.
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
* Calls back to getCPUsDone() on listener. */
|
public void getCPUs(DSFSessionState sessionState, final DataRequestMonitor<ICPUDMContext[]> rm) {
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
|
||||||
public static void getCPUs(DSFSessionState sessionState,
|
|
||||||
final DSFDebugModelListener listener,
|
|
||||||
final Object arg)
|
|
||||||
{
|
|
||||||
ICommandControlService controlService = sessionState.getService(ICommandControlService.class);
|
ICommandControlService controlService = sessionState.getService(ICommandControlService.class);
|
||||||
IGDBHardwareAndOS hwService = sessionState.getService(IGDBHardwareAndOS.class);
|
IGDBHardwareAndOS hwService = sessionState.getService(IGDBHardwareAndOS.class);
|
||||||
if (controlService == null || hwService == null) {
|
if (controlService == null || hwService == null) {
|
||||||
listener.getCPUsDone(null, arg);
|
rm.done(new ICPUDMContext[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IHardwareTargetDMContext contextToUse = DMContexts.getAncestorOfType(controlService.getContext(),
|
IHardwareTargetDMContext contextToUse = DMContexts.getAncestorOfType(controlService.getContext(), IHardwareTargetDMContext.class);
|
||||||
IHardwareTargetDMContext.class);
|
hwService.getCPUs(contextToUse, new ImmediateDataRequestMonitor<ICPUDMContext[]>(rm) {
|
||||||
hwService.getCPUs(contextToUse,
|
@Override
|
||||||
new ImmediateDataRequestMonitor<ICPUDMContext[]>() {
|
protected void handleCompleted() {
|
||||||
@Override
|
ICPUDMContext[] cpuContexts;
|
||||||
protected void handleCompleted() {
|
if (isSuccess()) {
|
||||||
ICPUDMContext[] cpuContexts = getData();
|
cpuContexts = getData();
|
||||||
if (! isSuccess()) cpuContexts = null;
|
} else {
|
||||||
listener.getCPUsDone(cpuContexts, arg);
|
cpuContexts = new ICPUDMContext[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rm.done(cpuContexts);
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
/** Request load information for a single CPU or core */
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
public void getLoad(DSFSessionState sessionState,
|
||||||
public static void getLoad(DSFSessionState sessionState,
|
|
||||||
final IDMContext context,
|
final IDMContext context,
|
||||||
final DSFDebugModelListener listener,
|
final DataRequestMonitor<ILoadInfo> rm)
|
||||||
final Object arg)
|
|
||||||
{
|
{
|
||||||
IGDBHardwareAndOS2 hwService = sessionState.getService(IGDBHardwareAndOS2.class);
|
IGDBHardwareAndOS2 hwService = sessionState.getService(IGDBHardwareAndOS2.class);
|
||||||
if (hwService == null) {
|
if (hwService == null) {
|
||||||
listener.getLoadDone(context, null, arg);
|
rm.setData(null);
|
||||||
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwService.getLoadInfo(context,
|
hwService.getLoadInfo(context, rm);
|
||||||
new ImmediateDataRequestMonitor<ILoadInfo>() {
|
|
||||||
@Override
|
|
||||||
protected void handleCompleted() {
|
|
||||||
listener.getLoadDone(context, getData(), arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Requests list of Cores.
|
@Override
|
||||||
* Calls back to getCoresDone() on listener. */
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
public void getCores(DSFSessionState sessionState, final DataRequestMonitor<ICoreDMContext[]> rm) {
|
||||||
public static void getCores(DSFSessionState sessionState,
|
getCores(sessionState, null, rm);
|
||||||
DSFDebugModelListener listener,
|
|
||||||
Object arg)
|
|
||||||
{
|
|
||||||
getCores(sessionState, null, listener, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Requests list of Cores.
|
@Override
|
||||||
* Calls back to getCoresDone() on listener. */
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
public void getCores(DSFSessionState sessionState,
|
||||||
public static void getCores(DSFSessionState sessionState,
|
|
||||||
final ICPUDMContext cpuContext,
|
final ICPUDMContext cpuContext,
|
||||||
final DSFDebugModelListener listener,
|
final DataRequestMonitor<ICoreDMContext[]> rm)
|
||||||
final Object arg)
|
|
||||||
{
|
{
|
||||||
IGDBHardwareAndOS hwService = sessionState.getService(IGDBHardwareAndOS.class);
|
IGDBHardwareAndOS hwService = sessionState.getService(IGDBHardwareAndOS.class);
|
||||||
if (hwService == null) {
|
if (hwService == null) {
|
||||||
listener.getCoresDone(cpuContext, null, arg);
|
rm.done(new ICoreDMContext[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,29 +132,21 @@ public class DSFDebugModel {
|
||||||
|
|
||||||
if (!isSuccess() || coreContexts == null || coreContexts.length < 1) {
|
if (!isSuccess() || coreContexts == null || coreContexts.length < 1) {
|
||||||
// Unable to get any core data
|
// Unable to get any core data
|
||||||
listener.getCoresDone(cpuContext, null, arg);
|
rm.done(new ICoreDMContext[0]);
|
||||||
return;
|
} else {
|
||||||
|
rm.done(coreContexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
ICPUDMContext cpuContextToUse = cpuContext;
|
|
||||||
if (cpuContextToUse == null) {
|
|
||||||
// If we didn't have a CPU context, lets use the ancestor of the first core context
|
|
||||||
cpuContextToUse = DMContexts.getAncestorOfType(coreContexts[0], ICPUDMContext.class);
|
|
||||||
}
|
|
||||||
listener.getCoresDone(cpuContextToUse, coreContexts, arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Requests list of Threads.
|
@Override
|
||||||
* Calls back to getThreadsDone() on listener. */
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
public void getThreads(DSFSessionState sessionState,
|
||||||
public static void getThreads(DSFSessionState sessionState,
|
|
||||||
final ICPUDMContext cpuContext,
|
final ICPUDMContext cpuContext,
|
||||||
final ICoreDMContext coreContext,
|
final ICoreDMContext coreContext,
|
||||||
final DSFDebugModelListener listener,
|
final DataRequestMonitor<IDMContext[]> rm)
|
||||||
final Object arg)
|
|
||||||
{
|
{
|
||||||
// Get control DM context associated with the core
|
// Get control DM context associated with the core
|
||||||
// Process/Thread Info service (GDBProcesses_X_Y_Z)
|
// Process/Thread Info service (GDBProcesses_X_Y_Z)
|
||||||
|
@ -187,7 +155,7 @@ public class DSFDebugModel {
|
||||||
ICommandControlDMContext controlContext =
|
ICommandControlDMContext controlContext =
|
||||||
DMContexts.getAncestorOfType(coreContext, ICommandControlDMContext.class);
|
DMContexts.getAncestorOfType(coreContext, ICommandControlDMContext.class);
|
||||||
if (procService == null || controlContext == null) {
|
if (procService == null || controlContext == null) {
|
||||||
listener.getThreadsDone(cpuContext, coreContext, null, arg);
|
rm.done(new IDMContext[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,18 +170,18 @@ public class DSFDebugModel {
|
||||||
if (!isSuccess() || processContexts == null || processContexts.length < 1) {
|
if (!isSuccess() || processContexts == null || processContexts.length < 1) {
|
||||||
// Unable to get any process data for this core
|
// Unable to get any process data for this core
|
||||||
// Is this an issue? A core may have no processes/threads, right?
|
// Is this an issue? A core may have no processes/threads, right?
|
||||||
listener.getThreadsDone(cpuContext, coreContext, null, arg);
|
rm.done(new IDMContext[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<IDMContext> threadContextsList = new ArrayList<IDMContext>();
|
final ArrayList<IDMContext> threadContextsList = new ArrayList<>();
|
||||||
|
|
||||||
final ImmediateCountingRequestMonitor crm1 = new ImmediateCountingRequestMonitor(
|
final ImmediateCountingRequestMonitor crm1 = new ImmediateCountingRequestMonitor(
|
||||||
new ImmediateRequestMonitor() {
|
new ImmediateRequestMonitor() {
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
IDMContext[] threadContexts = threadContextsList.toArray(new IDMContext[threadContextsList.size()]);
|
IDMContext[] threadContexts = threadContextsList.toArray(new IDMContext[threadContextsList.size()]);
|
||||||
listener.getThreadsDone(cpuContext, coreContext, threadContexts, arg);
|
rm.done(threadContexts);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
crm1.setDoneCount(processContexts.length);
|
crm1.setDoneCount(processContexts.length);
|
||||||
|
@ -272,104 +240,82 @@ public class DSFDebugModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Requests data of a thread.
|
@Override
|
||||||
* Calls back to getThreadDataDone() on listener. */
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
public void getThreadData(DSFSessionState sessionState,
|
||||||
public static void getThreadData(DSFSessionState sessionState,
|
|
||||||
final ICPUDMContext cpuContext,
|
final ICPUDMContext cpuContext,
|
||||||
final ICoreDMContext coreContext,
|
final ICoreDMContext coreContext,
|
||||||
final IMIExecutionDMContext execContext,
|
final IMIExecutionDMContext execContext, final DataRequestMonitor<IThreadDMData> rm)
|
||||||
final DSFDebugModelListener listener,
|
|
||||||
final Object arg)
|
|
||||||
{
|
{
|
||||||
IProcesses procService = sessionState.getService(IProcesses.class);
|
IProcesses procService = sessionState.getService(IProcesses.class);
|
||||||
|
|
||||||
if (procService == null) {
|
if (procService == null) {
|
||||||
listener.getThreadDataDone(cpuContext, coreContext, execContext, null, arg);
|
rm.setData(null);
|
||||||
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final IThreadDMContext threadContext = DMContexts.getAncestorOfType(execContext, IThreadDMContext.class);
|
final IThreadDMContext threadContext = DMContexts.getAncestorOfType(execContext, IThreadDMContext.class);
|
||||||
procService.getExecutionData(threadContext,
|
procService.getExecutionData(threadContext, rm);
|
||||||
new ImmediateDataRequestMonitor<IThreadDMData>() {
|
|
||||||
@Override
|
|
||||||
protected void handleCompleted() {
|
|
||||||
IThreadDMData threadData = isSuccess() ? getData() : null;
|
|
||||||
listener.getThreadDataDone(cpuContext, coreContext, execContext, threadData, arg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Requests execution state of a thread.
|
@Override
|
||||||
* Calls back to getThreadExecutionStateDone() on listener. */
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
public void getTopFrameData(final DSFSessionState sessionState, final IMIExecutionDMContext execContext, final DataRequestMonitor<IFrameDMData> rm) {
|
||||||
public static void getThreadExecutionState(final DSFSessionState sessionState,
|
final IFrameDMData nullFrameData = null;
|
||||||
final ICPUDMContext cpuContext,
|
// For a suspended thread, retrieve the current stack
|
||||||
final ICoreDMContext coreContext,
|
final IStack stackService = sessionState.getService(IStack.class);
|
||||||
final IMIExecutionDMContext execContext,
|
if (stackService != null) {
|
||||||
final IThreadDMData threadData,
|
stackService.getTopFrame(execContext, new ImmediateDataRequestMonitor<IFrameDMContext>(null) {
|
||||||
final DSFDebugModelListener listener,
|
@Override
|
||||||
final Object arg)
|
protected void handleCompleted() {
|
||||||
{
|
IFrameDMContext targetFrameContext = isSuccess() ? getData() : null;
|
||||||
|
if (targetFrameContext != null) {
|
||||||
|
stackService.getFrameData(targetFrameContext, new ImmediateDataRequestMonitor<IFrameDMData>(null) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
IFrameDMData frameData = isSuccess() ? getData() : null;
|
||||||
|
rm.done(frameData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
rm.done(nullFrameData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
rm.done(nullFrameData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
|
public void getThreadExecutionState(final DSFSessionState sessionState, final ICPUDMContext cpuContext, final ICoreDMContext coreContext,
|
||||||
|
final IMIExecutionDMContext execContext, final IThreadDMData threadData, final DataRequestMonitor<VisualizerExecutionState> rm) {
|
||||||
IRunControl runControl = sessionState.getService(IRunControl.class);
|
IRunControl runControl = sessionState.getService(IRunControl.class);
|
||||||
|
|
||||||
if (runControl == null) {
|
if (runControl == null) {
|
||||||
listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null, null, arg);
|
rm.setData(null);
|
||||||
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runControl.isSuspended(execContext) == false) {
|
if (runControl.isSuspended(execContext) == false) {
|
||||||
// The thread is running
|
// The thread is running
|
||||||
listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null,
|
rm.done(VisualizerExecutionState.RUNNING);
|
||||||
VisualizerExecutionState.RUNNING, arg);
|
|
||||||
} else {
|
} else {
|
||||||
// For a suspended thread, retrieve the current stack
|
getThreadSuspendReason(sessionState, execContext, rm);
|
||||||
final IStack stackService = sessionState.getService(IStack.class);
|
|
||||||
if (stackService != null) {
|
|
||||||
stackService.getTopFrame(execContext, new ImmediateDataRequestMonitor<IFrameDMContext>(null) {
|
|
||||||
@Override
|
|
||||||
protected void handleCompleted() {
|
|
||||||
IFrameDMContext targetFrameContext = null;
|
|
||||||
if (isSuccess()) {
|
|
||||||
targetFrameContext = getData();
|
|
||||||
}
|
|
||||||
if (targetFrameContext!= null) {
|
|
||||||
stackService.getFrameData(targetFrameContext, new ImmediateDataRequestMonitor<IFrameDMData>(null) {
|
|
||||||
@Override
|
|
||||||
protected void handleCompleted() {
|
|
||||||
IFrameDMData frameData = null;
|
|
||||||
if (isSuccess()) {
|
|
||||||
frameData = getData();
|
|
||||||
}
|
|
||||||
getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, frameData, listener, arg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, null, listener, arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, null, listener, arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For a suspended thread, let's see why it is suspended,
|
/** For a suspended thread, let's see why it is suspended,
|
||||||
* to find out if the thread is crashed */
|
* to find out if the thread is crashed */
|
||||||
private static void getThreadSuspendReason(DSFSessionState sessionState,
|
@ConfinedToDsfExecutor("sessionState.getDsfSession().getExecutor()")
|
||||||
final ICPUDMContext cpuContext,
|
private static void getThreadSuspendReason(DSFSessionState sessionState, IMIExecutionDMContext execContext,
|
||||||
final ICoreDMContext coreContext,
|
final DataRequestMonitor<VisualizerExecutionState> rm) {
|
||||||
final IMIExecutionDMContext execContext,
|
|
||||||
final IThreadDMData threadData,
|
|
||||||
final IFrameDMData frameData,
|
|
||||||
final DSFDebugModelListener listener,
|
|
||||||
final Object arg) {
|
|
||||||
IRunControl runControl = sessionState.getService(IRunControl.class);
|
IRunControl runControl = sessionState.getService(IRunControl.class);
|
||||||
if (runControl != null) {
|
if (runControl != null) {
|
||||||
runControl.getExecutionData(execContext,
|
runControl.getExecutionData(execContext, new ImmediateDataRequestMonitor<IExecutionDMData>() {
|
||||||
new ImmediateDataRequestMonitor<IExecutionDMData>() {
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
IExecutionDMData executionData = getData();
|
IExecutionDMData executionData = getData();
|
||||||
|
@ -378,7 +324,7 @@ public class DSFDebugModel {
|
||||||
if (isSuccess() && executionData != null) {
|
if (isSuccess() && executionData != null) {
|
||||||
if (executionData.getStateChangeReason() == StateChangeReason.SIGNAL) {
|
if (executionData.getStateChangeReason() == StateChangeReason.SIGNAL) {
|
||||||
if (executionData instanceof IExecutionDMData2) {
|
if (executionData instanceof IExecutionDMData2) {
|
||||||
String details = ((IExecutionDMData2)executionData).getDetails();
|
String details = ((IExecutionDMData2) executionData).getDetails();
|
||||||
if (details != null) {
|
if (details != null) {
|
||||||
if (isCrashSignal(details)) {
|
if (isCrashSignal(details)) {
|
||||||
state = VisualizerExecutionState.CRASHED;
|
state = VisualizerExecutionState.CRASHED;
|
||||||
|
@ -387,11 +333,13 @@ public class DSFDebugModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, frameData, state, arg);
|
|
||||||
|
rm.done(state);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, frameData, null, arg);
|
rm.setData(null);
|
||||||
|
rm.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,32 +360,4 @@ public class DSFDebugModel {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates and returns a timer that refreshes the load meters */
|
|
||||||
public static Timer getLoadTimer(final DSFSessionState sessionState,
|
|
||||||
final int timeout,
|
|
||||||
final DSFDebugModelListener listener)
|
|
||||||
{
|
|
||||||
Timer t = new Timer(timeout) {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (sessionState != null) {
|
|
||||||
DsfSession session = DsfSession.getSession(sessionState.getSessionID());
|
|
||||||
if (session != null) {
|
|
||||||
DsfExecutor executor = session.getExecutor();
|
|
||||||
if (executor != null) {
|
|
||||||
executor.execute(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
listener.updateLoads();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2012, 2014 Tilera Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* William R. Swanson (Tilera Corporation) - initial API and implementation
|
|
||||||
* Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
|
|
||||||
* Xavier Raynaud (Kalray) - Bug 431935
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMData;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerExecutionState;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICPUDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICoreDMContext;
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
|
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
|
||||||
|
|
||||||
/** Interface for classes that interact with DSFDebugModel.
|
|
||||||
*
|
|
||||||
* An instance of this interface is passed as
|
|
||||||
* an argument to a method of DSFDebugModel, and
|
|
||||||
* the corresponding callback on this interface is
|
|
||||||
* invoked when the method completes.
|
|
||||||
*
|
|
||||||
* The "arg" argument is the value (if any) passed
|
|
||||||
* through the corresponding "arg" argument of the
|
|
||||||
* DSFDebugModel method.
|
|
||||||
*
|
|
||||||
* TODO: we intend to refactor this API and make this
|
|
||||||
* a base class rather than an instance.
|
|
||||||
*/
|
|
||||||
public interface DSFDebugModelListener {
|
|
||||||
|
|
||||||
/** Invoked when getCPUs() request completes. */
|
|
||||||
public void getCPUsDone(ICPUDMContext[] cpuContexts,
|
|
||||||
Object arg);
|
|
||||||
|
|
||||||
/** Invoked when getCores() request completes. */
|
|
||||||
public void getCoresDone(ICPUDMContext cpuContext,
|
|
||||||
ICoreDMContext[] coreContexts,
|
|
||||||
Object arg);
|
|
||||||
|
|
||||||
/** Invoked when getThreads() request completes. */
|
|
||||||
public void getThreadsDone(ICPUDMContext cpuContext,
|
|
||||||
ICoreDMContext coreContext,
|
|
||||||
IDMContext[] threadContexts,
|
|
||||||
Object arg);
|
|
||||||
|
|
||||||
/** Invoked when getThreadDataState() request completes. */
|
|
||||||
public void getThreadDataDone(ICPUDMContext cpuContext,
|
|
||||||
ICoreDMContext coreContext,
|
|
||||||
IMIExecutionDMContext threadContext,
|
|
||||||
IThreadDMData data,
|
|
||||||
Object arg);
|
|
||||||
|
|
||||||
/** Invoked when getThreadExecutionState() request completes. */
|
|
||||||
public void getThreadExecutionStateDone(ICPUDMContext cpuContext,
|
|
||||||
ICoreDMContext coreContext,
|
|
||||||
IMIExecutionDMContext threadContext,
|
|
||||||
IThreadDMData threadData,
|
|
||||||
IFrameDMData frame,
|
|
||||||
VisualizerExecutionState state,
|
|
||||||
Object arg);
|
|
||||||
|
|
||||||
/** Invoked when getLoad() request completes. */
|
|
||||||
public void getLoadDone(IDMContext context, ILoadInfo loads, Object arg);
|
|
||||||
|
|
||||||
/** Invoked when the load timer triggers. */
|
|
||||||
public void updateLoads();
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 Ericsson AB and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Alvaro Sanchez-Leon (Ericsson) - Bug 459114 - override construction of the data model
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.utils;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMData;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model.VisualizerExecutionState;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICPUDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS.ICoreDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.service.IGDBHardwareAndOS2.ILoadInfo;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the methods to query data from a target system under debug
|
||||||
|
*/
|
||||||
|
public interface IDSFTargetDataProxy {
|
||||||
|
|
||||||
|
/** Requests list of CPUs. */
|
||||||
|
public void getCPUs(DSFSessionState sessionState, DataRequestMonitor<ICPUDMContext[]> rm);
|
||||||
|
|
||||||
|
/** Requests list of Cores. */
|
||||||
|
public void getCores(DSFSessionState sessionState, DataRequestMonitor<ICoreDMContext[]> rm);
|
||||||
|
|
||||||
|
/** Requests list of Cores */
|
||||||
|
public void getCores(DSFSessionState sessionState, ICPUDMContext cpuContext, DataRequestMonitor<ICoreDMContext[]> rm);
|
||||||
|
|
||||||
|
/** Requests list of Threads Related to the specified CPU and Core */
|
||||||
|
public void getThreads(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext, DataRequestMonitor<IDMContext[]> rm);
|
||||||
|
|
||||||
|
/** Requests data for the thread associated to the give execution context */
|
||||||
|
public void getThreadData(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext, IMIExecutionDMContext execContext,
|
||||||
|
DataRequestMonitor<IThreadDMData> rm);
|
||||||
|
|
||||||
|
/** Requests frame data for a given thread */
|
||||||
|
public void getTopFrameData(DSFSessionState sessionState, IMIExecutionDMContext execContext, DataRequestMonitor<IFrameDMData> rm);
|
||||||
|
|
||||||
|
/** Requests execution state of a thread. */
|
||||||
|
public void getThreadExecutionState(DSFSessionState sessionState, ICPUDMContext cpuContext, ICoreDMContext coreContext,
|
||||||
|
IMIExecutionDMContext execContext, IThreadDMData threadData, DataRequestMonitor<VisualizerExecutionState> rm);
|
||||||
|
|
||||||
|
/** Request load information for a single CPU or core */
|
||||||
|
public void getLoad(DSFSessionState sessionState, IDMContext context, DataRequestMonitor<ILoadInfo> rm);
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue