mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Multicore visualizer cosmetic changes - mostly regarding comments and
some other small non-functional improvements Change-Id: I93e49b7158c916f349ad65ab3ba7d34e193b56c9 Reviewed-on: https://git.eclipse.org/r/35144 Reviewed-by: Marc Dumais <marc.dumais@ericsson.com> Tested-by: Marc Dumais <marc.dumais@ericsson.com>
This commit is contained in:
parent
6542690eff
commit
88a494349a
20 changed files with 163 additions and 228 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013, 2014 Ericsson 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
|
||||
|
@ -16,7 +16,7 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVis
|
|||
import org.eclipse.cdt.visualizer.ui.VisualizerAction;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* Action that enables or disables load meters
|
||||
*/
|
||||
public class EnableLoadMetersAction extends VisualizerAction {
|
||||
|
||||
|
@ -25,6 +25,7 @@ public class EnableLoadMetersAction extends VisualizerAction {
|
|||
|
||||
boolean m_enabled = false;
|
||||
|
||||
/** Constructor */
|
||||
public EnableLoadMetersAction(boolean enable) {
|
||||
m_enabled = enable;
|
||||
setText(getTextToDisplay());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013, 2014 Ericsson 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
|
||||
|
@ -15,22 +15,22 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualiz
|
|||
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer;
|
||||
import org.eclipse.cdt.visualizer.ui.VisualizerAction;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Action that creates or clears a canvas filter */
|
||||
public class FilterCanvasAction extends VisualizerAction {
|
||||
|
||||
/** Visualizer instance we're associated with. */
|
||||
MulticoreVisualizer m_visualizer = null;
|
||||
boolean m_haveFilter = false;
|
||||
|
||||
/** Does this action enable or disable the filter mechanism? */
|
||||
boolean m_createFilter = false;
|
||||
|
||||
/**
|
||||
* @param filterType: the type of canvas object the filter applies-to. If null, reset filter
|
||||
* Constructor
|
||||
* @param create : Controls whether this action will create or clear the filter
|
||||
*/
|
||||
public FilterCanvasAction(boolean enable) {
|
||||
m_haveFilter = enable;
|
||||
if (m_haveFilter) {
|
||||
public FilterCanvasAction(boolean create) {
|
||||
m_createFilter = create;
|
||||
if (m_createFilter) {
|
||||
setText(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.SetFilter.text")); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
|
@ -61,7 +61,7 @@ public class FilterCanvasAction extends VisualizerAction {
|
|||
@Override
|
||||
public void run() {
|
||||
if (m_visualizer != null) {
|
||||
if (m_haveFilter) {
|
||||
if (m_createFilter) {
|
||||
m_visualizer.applyCanvasFilter();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 Tilera Corporation and others.
|
||||
* 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
|
||||
|
@ -16,7 +16,7 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVis
|
|||
import org.eclipse.cdt.visualizer.ui.VisualizerAction;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
||||
/** Select All action for Visualizer context menu. */
|
||||
/** Action that refreshes the Visualizer canvas. */
|
||||
public class RefreshAction extends VisualizerAction
|
||||
{
|
||||
// --- members ---
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013, 2014 Ericsson 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
|
||||
|
@ -16,7 +16,7 @@ import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVis
|
|||
import org.eclipse.cdt.visualizer.ui.VisualizerAction;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* Action that sets the load meter refresh period
|
||||
*/
|
||||
public class SetLoadMeterPeriodAction extends VisualizerAction {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013 Ericsson 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2013 Tilera Corporation and others.
|
||||
* 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
|
||||
|
@ -31,9 +31,7 @@ public class VisualizerCPU
|
|||
/** ID of this core. */
|
||||
public int m_id;
|
||||
|
||||
/** Contains load information
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Load object associated to this cpu */
|
||||
protected VisualizerLoadInfo m_loadinfo;
|
||||
|
||||
/** List of cores */
|
||||
|
@ -90,20 +88,17 @@ public class VisualizerCPU
|
|||
return null;
|
||||
}
|
||||
|
||||
/** sets the load info for this CPU
|
||||
* @since 1.1*/
|
||||
/** Sets the load object associated to this CPU */
|
||||
public synchronized void setLoadInfo (VisualizerLoadInfo info) {
|
||||
m_loadinfo = info;
|
||||
}
|
||||
|
||||
/** Gets the CPU usage load of this CPU.
|
||||
* @since 1.1*/
|
||||
/** Gets the load value associated to this CPU */
|
||||
public synchronized Integer getLoad() {
|
||||
return (m_loadinfo == null) ? null : m_loadinfo.getLoad();
|
||||
}
|
||||
|
||||
/** get the highest recorded load for this CPU
|
||||
* @since 1.1*/
|
||||
/** get the highest recorded load value for this CPU*/
|
||||
public synchronized Integer getHighLoadWatermark() {
|
||||
return (m_loadinfo == null) ? null : m_loadinfo.getHighLoadWaterMark();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2013 Tilera Corporation and others.
|
||||
* 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
|
||||
|
@ -26,9 +26,7 @@ public class VisualizerCore
|
|||
/** Linux CPU ID of this core. */
|
||||
public int m_id = 0;
|
||||
|
||||
/** Contains load information
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Load information associated to this core */
|
||||
protected VisualizerLoadInfo m_loadinfo;
|
||||
|
||||
// --- constructors/destructors ---
|
||||
|
@ -73,20 +71,17 @@ public class VisualizerCore
|
|||
return getCPU();
|
||||
}
|
||||
|
||||
/** sets the load info for this core
|
||||
* @since 1.1*/
|
||||
/** Sets the load object associated to this core */
|
||||
public synchronized void setLoadInfo (VisualizerLoadInfo info) {
|
||||
m_loadinfo = info;
|
||||
}
|
||||
|
||||
/** Gets the CPU usage load of this core.
|
||||
* @since 1.1*/
|
||||
/** Gets the load value of this core */
|
||||
public synchronized Integer getLoad() {
|
||||
return (m_loadinfo == null) ? null : m_loadinfo.getLoad();
|
||||
}
|
||||
|
||||
/** get the highest recorded load for this core
|
||||
* @since 1.1*/
|
||||
/** Get the highest recorded load value for this core */
|
||||
public synchronized Integer getHighLoadWatermark() {
|
||||
return (m_loadinfo == null) ? null : m_loadinfo.getHighLoadWaterMark();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013, 2014 Ericsson 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
|
||||
|
@ -16,13 +16,13 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.model;
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* Object that represents the load of a CPU or core
|
||||
*/
|
||||
public class VisualizerLoadInfo {
|
||||
|
||||
// --- members ---
|
||||
|
||||
/** load */
|
||||
/** load */
|
||||
protected Integer m_load = null;
|
||||
|
||||
/** the high load water-mark */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2013 Ericsson and others.
|
||||
* Copyright (c) 2012, 2014 Ericsson 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
|
||||
|
@ -52,28 +52,23 @@ public class IMulticoreVisualizerConstants
|
|||
|
||||
// Colors for drawing CPUs
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Foreground color for cpu */
|
||||
public static final Color COLOR_CPU_FG = Colors.GREEN;
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Background color for cpu */
|
||||
public static final Color COLOR_CPU_BG = Colors.getColor(0,64,0);
|
||||
|
||||
// Colors for text
|
||||
|
||||
/** Color to be used to draw a the text for a thread */
|
||||
public static final Color COLOR_THREAD_TEXT_FG = Colors.WHITE;
|
||||
/** Foreground color to be used to draw a the text for a thread */
|
||||
public static final Color COLOR_THREAD_TEXT_FG = Colors.WHITE;
|
||||
/** Background color to be used to draw a the text for a thread */
|
||||
public static final Color COLOR_THREAD_TEXT_BG = Colors.BLACK;
|
||||
|
||||
/** Color to be used to draw a the text for a core */
|
||||
public static final Color COLOR_CORE_TEXT_FG = Colors.WHITE;
|
||||
public static final Color COLOR_CORE_TEXT_BG = Colors.BLACK;
|
||||
|
||||
/** Color to be used to draw the load text
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Color to be used to draw the load text */
|
||||
public static final Color COLOR_LOAD_TEXT = Colors.GREEN;
|
||||
|
||||
/** Color used to draw text to the status bar */
|
||||
|
@ -81,20 +76,12 @@ public class IMulticoreVisualizerConstants
|
|||
|
||||
// Colors for load meters
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Color used to draw the bar representing load, under normal load */
|
||||
public static final Color COLOR_LOAD_LOADBAR_NORMAL = Colors.GREEN;
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Color used to draw the bar representing load, under high load */
|
||||
public static final Color COLOR_LOAD_LOADBAR_OVERLOAD = Colors.RED;
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Color used to draw the load meter foreground */
|
||||
public static final Color COLOR_LOAD_UNDERBAR_FG = Colors.getColor(0,200,0);
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Color used to draw the load meter background */
|
||||
public static final Color COLOR_LOAD_UNDERBAR_BG_DEFAULT = Colors.getColor(0,64,0);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012 IBM Corporation and others.
|
||||
* Copyright (c) 2012, 2014 IBM 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
|
||||
|
@ -12,9 +12,6 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
|||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
public class Messages extends NLS {
|
||||
public static String MulticoreVisualizer_name;
|
||||
public static String MulticoreVisualizer_tooltip;
|
||||
|
|
|
@ -132,33 +132,24 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
// contexts, each time the model is recreated. This way
|
||||
// we can avoid asking the backend for the CPU/core
|
||||
// geometry each time we want to update the load information.
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
protected ICPUDMContext[] m_cpuContextsCache = null;
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
protected ICoreDMContext[] m_coreContextsCache = null;
|
||||
|
||||
/**
|
||||
* Main switch that determines if we should display the load meters
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Main switch that determines if we should display the load meters */
|
||||
protected boolean m_loadMetersEnabled = false;
|
||||
/**
|
||||
* Timer used to trigger the update of the CPU/core load meters
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Timer used to trigger the update of the CPU/core load meters */
|
||||
protected Timer m_updateLoadMeterTimer = null;
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** update period for the load meters */
|
||||
protected int m_loadMeterTimerPeriod = LOAD_METER_TIMER_MEDIUM; // default 1000ms
|
||||
|
||||
// Load meters refresh periods, in ms
|
||||
/** constant for the very short load meters update period */
|
||||
private static final int LOAD_METER_TIMER_MIN = 100;
|
||||
/** constant for the short load meters update period */
|
||||
private static final int LOAD_METER_TIMER_FAST = 500;
|
||||
private static final int LOAD_METER_TIMER_MEDIUM = 1000;
|
||||
/** constant for the medium load meters update period */
|
||||
private static final int LOAD_METER_TIMER_MEDIUM = 1000;
|
||||
/** constant for the long load meters update period */
|
||||
private static final int LOAD_METER_TIMER_SLOW = 5000;
|
||||
|
||||
/** Currently pinned session id, if any */
|
||||
|
@ -202,6 +193,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
|
||||
/** Sub-menu */
|
||||
IMenuManager m_loadMetersSubMenu = null;
|
||||
|
||||
/** Sub-sub menu */
|
||||
IMenuManager m_loadMetersRefreshSubSubmenu = null;
|
||||
|
||||
|
@ -248,7 +240,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* Sets-up the timer associated to load meters refresh
|
||||
*/
|
||||
protected void initializeLoadMeterTimer() {
|
||||
if (!m_loadMetersEnabled) return;
|
||||
|
@ -258,7 +250,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* disposes of the load meter timer
|
||||
*/
|
||||
protected void disposeLoadMeterTimer() {
|
||||
if(m_updateLoadMeterTimer != null) {
|
||||
|
@ -297,7 +289,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* takes care of the details of changing the load meter timer period
|
||||
*/
|
||||
public void setLoadMeterTimerPeriod(int p) {
|
||||
assert (p > LOAD_METER_TIMER_MIN);
|
||||
|
@ -308,7 +300,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* enables or disables the load meters
|
||||
*/
|
||||
public void setLoadMetersEnabled(boolean enabled) {
|
||||
if (m_loadMetersEnabled == enabled) return;
|
||||
|
@ -555,7 +547,6 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
m_refreshAction = null;
|
||||
}
|
||||
|
||||
|
||||
if (m_loadMetersSubMenu != null) {
|
||||
m_loadMetersSubMenu.dispose();
|
||||
m_loadMetersSubMenu = null;
|
||||
|
@ -635,7 +626,6 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
createActions();
|
||||
|
||||
// TODO: Anything we want to hide on the toolbar menu?
|
||||
|
||||
updateActions();
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1193,6 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
// Collect thread data
|
||||
DSFDebugModel.getThreadData(m_sessionState, cpuContext, coreContext, execContext, this, model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// keep track of cores visited
|
||||
|
@ -1277,9 +1266,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Updates the loads for all cpus and cores */
|
||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
@Override
|
||||
public void updateLoads() {
|
||||
|
@ -1309,9 +1296,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when a getLoad() request completes.
|
||||
* @since 1.1*/
|
||||
/** Invoked when a getLoad() request completes. */
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
public void getLoadDone(IDMContext context, ILoadInfo load, Object arg)
|
||||
|
|
|
@ -34,20 +34,13 @@ public class MulticoreVisualizerCPU extends MulticoreVisualizerGraphicObject
|
|||
/** Child cores. */
|
||||
protected ArrayList<MulticoreVisualizerCore> m_cores;
|
||||
|
||||
/**
|
||||
* Load meter associated to this CPU
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Load meter associated to this CPU */
|
||||
protected MulticoreVisualizerLoadMeter m_loadMeter;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Background color used to draw cpu */
|
||||
protected static final Color BG_COLOR = IMulticoreVisualizerConstants.COLOR_CPU_BG;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Foreground coloe used to draw cpu */
|
||||
protected static final Color FG_COLOR = IMulticoreVisualizerConstants.COLOR_CPU_FG;
|
||||
|
||||
|
||||
|
@ -101,16 +94,12 @@ public class MulticoreVisualizerCPU extends MulticoreVisualizerGraphicObject
|
|||
return m_cores;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Sets the load meter associated to this CPU */
|
||||
public void setLoadMeter (MulticoreVisualizerLoadMeter meter) {
|
||||
m_loadMeter = meter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Gets the load meter associated to this CPU */
|
||||
public MulticoreVisualizerLoadMeter getLoadMeter() {
|
||||
return m_loadMeter;
|
||||
}
|
||||
|
|
|
@ -76,20 +76,13 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
/** Whether we need to recache graphic objects. */
|
||||
protected boolean m_recache = true;
|
||||
|
||||
/**
|
||||
* Whether we need to recache objects that depend on target state.
|
||||
*/
|
||||
/** Whether we need to recache objects that depend on target state */
|
||||
protected boolean m_recacheState = true;
|
||||
|
||||
/**
|
||||
* Whether view size has changed, requiring us to recalculate object sizes.
|
||||
*/
|
||||
/** Whether view size has changed, requiring us to recalculate object sizes */
|
||||
protected boolean m_recacheSizes = true;
|
||||
|
||||
/**
|
||||
* Whether the load information has changed and we need to update the load meters
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Whether the load information has changed and we need to update the load meters */
|
||||
protected boolean m_recacheLoadMeters = true;
|
||||
|
||||
/** Whether we need to repaint the canvas */
|
||||
|
@ -327,10 +320,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
requestUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* only update the load meters
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Requests that next paint call should update the load meters */
|
||||
public void refreshLoadMeters() {
|
||||
requestRecache(false, false, true);
|
||||
}
|
||||
|
@ -377,8 +367,7 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
}
|
||||
|
||||
/**
|
||||
* Requests that the next paing call should recache state and/or size and/or load information
|
||||
* @since 1.1
|
||||
* Requests that the next paint call should recache state and/or size and/or load information
|
||||
*/
|
||||
// synchronized so we don't change recache flags while doing a recache
|
||||
public synchronized void requestRecache(boolean state, boolean sizes, boolean load) {
|
||||
|
@ -393,9 +382,11 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
m_canvasFilterManager.updateCurrentFilter();
|
||||
}
|
||||
|
||||
/** Fits n square items into a rectangle of the specified size.
|
||||
/**
|
||||
* Fits n square items into a rectangle of the specified size.
|
||||
* Returns largest edge of one of the square items that allows
|
||||
* them all to pack neatly in rows/columns in the specified area. */
|
||||
* them all to pack neatly in rows/columns in the specified area.
|
||||
*/
|
||||
public int fitSquareItems(int nitems, int width, int height) {
|
||||
int max_edge = 0;
|
||||
if (width > height) {
|
||||
|
@ -438,15 +429,9 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
m_cpuMap.clear();
|
||||
m_coreMap.clear();
|
||||
m_threadMap.clear();
|
||||
|
||||
// For debugging purposes only, allows us to force a CPU count.
|
||||
//int cpu_count = 0;
|
||||
//int force_cpu_count = 2;
|
||||
|
||||
if (m_model != null) {
|
||||
for (VisualizerCPU cpu : m_model.getCPUs()) {
|
||||
//if (force_cpu_count >= cpu_count) break;
|
||||
//cpu_count++;
|
||||
// current filter permits displaying this CPU?
|
||||
if (m_canvasFilterManager.displayObject(cpu)) {
|
||||
MulticoreVisualizerCPU mcpu = new MulticoreVisualizerCPU(cpu.getID());
|
||||
|
@ -463,13 +448,6 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
while (cpu_count < force_cpu_count) {
|
||||
MulticoreVisualizerCPU mcpu = new MulticoreVisualizerCPU(cpu_count);
|
||||
m_cpus.add(mcpu);
|
||||
cpu_count++;
|
||||
}
|
||||
*/
|
||||
|
||||
// we've recached state, which implies recacheing sizes and load meters
|
||||
m_recacheState = false;
|
||||
|
@ -549,7 +527,10 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
int height = bounds.height + cpu_separation - statusBarHeight;
|
||||
|
||||
// put status bar at the bottom of the canvas area
|
||||
m_statusBar.setBounds(cpu_margin, bounds.y + bounds.height - 2 * cpu_margin , width , statusBarHeight);
|
||||
m_statusBar.setBounds(cpu_margin,
|
||||
bounds.y + bounds.height - 2 * cpu_margin,
|
||||
width ,
|
||||
statusBarHeight);
|
||||
|
||||
int cpu_edge = fitSquareItems(ncpus, width, height);
|
||||
int cpu_size = cpu_edge - cpu_separation;
|
||||
|
@ -577,7 +558,10 @@ public class MulticoreVisualizerCanvas extends GraphicCanvas
|
|||
for (MulticoreVisualizerCPU cpu : m_cpus) {
|
||||
cpu.setBounds(x, y, cpu_size-1, cpu_size-1);
|
||||
// put cpu meter in the right margin of the CPU
|
||||
cpu.getLoadMeter().setBounds(x + cpu_size - 2*cpu_margin, y + 2*core_margin, loadMeterWidth, cpu_size-3*core_margin);
|
||||
cpu.getLoadMeter().setBounds(x + cpu_size - 2*cpu_margin,
|
||||
y + 2*core_margin,
|
||||
loadMeterWidth,
|
||||
cpu_size-3*core_margin);
|
||||
|
||||
int left = x + core_margin;
|
||||
int cx = left, cy = y + core_margin;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013, 2014 Ericsson 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
|
||||
|
@ -31,41 +31,59 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
*/
|
||||
public class MulticoreVisualizerCanvasFilter {
|
||||
|
||||
/** The white list */
|
||||
/** white list of objects on which the filter is based */
|
||||
List<IVisualizerModelObject> m_filterList = null;
|
||||
/** the dynamically expanded list, containing elements in the */
|
||||
/** white list and their parents - recalculated as required */
|
||||
/** since some elements can move around and change parent */
|
||||
|
||||
/**
|
||||
* the dynamically expanded list, containing elements in the
|
||||
* white list and their parents - recalculated as required
|
||||
* since some elements can move around and change parent
|
||||
*/
|
||||
List<IVisualizerModelObject> m_dynamicFilterList = null;
|
||||
|
||||
/** reference to the canvas */
|
||||
private MulticoreVisualizerCanvas m_canvas = null;
|
||||
|
||||
/** is the filter is active/set */
|
||||
/** whether the filter is active */
|
||||
private boolean m_filterActive = false;
|
||||
|
||||
/** for stats */
|
||||
/** counter that reflects the number of CPUs shown once the filter is applied */
|
||||
private int m_shownCpu = 0;
|
||||
/** for stats */
|
||||
|
||||
/** counter that reflects the number of cores shown once the filter is applied */
|
||||
private int m_shownCore = 0;
|
||||
/** for stats */
|
||||
|
||||
/** counter that reflects the number of threads shown once the filter is applied */
|
||||
private int m_shownThread = 0;
|
||||
/** for stats */
|
||||
|
||||
/** total number of CPUs in the current MV model */
|
||||
private int m_totalCpu = 0;
|
||||
/** for stats */
|
||||
|
||||
/** total number of cores in the current MV model */
|
||||
private int m_totalCore = 0;
|
||||
/** for stats */
|
||||
|
||||
/** total number of threads in the current MV model */
|
||||
private int m_totalThread = 0;
|
||||
|
||||
/** String constant used in this class */
|
||||
private static final String STR_FILTER_NOT_ACTIVE = MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.NotActive.text"); //$NON-NLS-1$
|
||||
/** String constant used in this class */
|
||||
private static final String STR_FILTER_ACTIVE = MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.Active.text"); //$NON-NLS-1$
|
||||
/** String constant used in this class */
|
||||
private static final String STR_CPU = MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.cpu.text"); //$NON-NLS-1$
|
||||
/** String constant used in this class */
|
||||
private static final String STR_CORE = MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.core.text"); //$NON-NLS-1$
|
||||
/** String constant used in this class */
|
||||
private static final String STR_THREAD = MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.thread.text"); //$NON-NLS-1$
|
||||
/** String constant used to denote that the filter is not active */
|
||||
private static final String STR_FILTER_NOT_ACTIVE =
|
||||
MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.NotActive.text"); //$NON-NLS-1$
|
||||
|
||||
/** String constant used to denote that the filter is active */
|
||||
private static final String STR_FILTER_ACTIVE =
|
||||
MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.Active.text"); //$NON-NLS-1$
|
||||
|
||||
/** String constant used to represent CPUs */
|
||||
private static final String STR_CPU =
|
||||
MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.cpu.text"); //$NON-NLS-1$
|
||||
|
||||
/** String constant used to represent cores */
|
||||
private static final String STR_CORE =
|
||||
MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.core.text"); //$NON-NLS-1$
|
||||
|
||||
/** String constant used to represent threads */
|
||||
private static final String STR_THREAD =
|
||||
MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.view.CanvasFilter.thread.text"); //$NON-NLS-1$
|
||||
|
||||
// --- constructors/destructors ---
|
||||
|
||||
|
@ -84,8 +102,8 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
// --- filter methods ---
|
||||
|
||||
/**
|
||||
* Set-up a canvas white-list filter. Any applicable selected object is added to
|
||||
* the filter.
|
||||
* Sets-up a canvas white-list filter from the current canvas selection.
|
||||
* Any applicable selected objects are added to the filter.
|
||||
*/
|
||||
public void applyFilter() {
|
||||
// replace current filter? Clear old one first.
|
||||
|
@ -125,14 +143,13 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
|
||||
}
|
||||
|
||||
/** tells if a canvas filter is currently in place */
|
||||
/** returns whether a canvas filter is currently in place */
|
||||
public boolean isFilterActive() {
|
||||
return m_filterActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the filter to contain the up-to-date parent objects,
|
||||
* for all filter objects.
|
||||
* Updates the dynamic filter so it contains the up-to-date parent objects
|
||||
*/
|
||||
public void updateFilter() {
|
||||
if (m_filterList == null || m_canvas == null)
|
||||
|
@ -169,8 +186,8 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tells if a candidate model object should be displayed, according to the
|
||||
* filter in place.
|
||||
* returns whether a candidate model object should be displayed,
|
||||
* according to the current filter.
|
||||
*/
|
||||
public boolean displayObject(final IVisualizerModelObject candidate) {
|
||||
// filter not active? Let anything be displayed
|
||||
|
@ -191,7 +208,7 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
|
||||
/**
|
||||
* Adds an element to the dynamic filter list, if an equivalent
|
||||
* element is not already there.
|
||||
* element is not already in there.
|
||||
*/
|
||||
private void addElementToFilterList(final IVisualizerModelObject elem) {
|
||||
if (!isElementInFilterList(elem)) {
|
||||
|
@ -201,7 +218,7 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if an element already has an equivalent in the
|
||||
* Returns whether an element already has an equivalent in the
|
||||
* dynamic filter list.
|
||||
*/
|
||||
private boolean isElementInFilterList(final IVisualizerModelObject candidate) {
|
||||
|
@ -216,7 +233,9 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
}
|
||||
|
||||
|
||||
/** Used to check if model elements in the filter still exist in the current model. */
|
||||
/** returns whether a model object currently in the filter still exists in
|
||||
* the current model.
|
||||
*/
|
||||
private boolean isElementInCurrentModel(IVisualizerModelObject element) {
|
||||
VisualizerModel model = m_canvas.getModel();
|
||||
if (model != null) {
|
||||
|
@ -254,8 +273,7 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
// --- Stats counters ---
|
||||
|
||||
/**
|
||||
* Used to step the filtered counters for a given type of
|
||||
* model object.
|
||||
* Steps the filter counters for a given type of model object.
|
||||
*/
|
||||
private void stepStatsCounter(IVisualizerModelObject modelObj) {
|
||||
if (modelObj instanceof VisualizerCPU) {
|
||||
|
@ -269,7 +287,7 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
}
|
||||
}
|
||||
|
||||
/** Reset the filtering counters */
|
||||
/** Resets the filter counters */
|
||||
private void resetCounters() {
|
||||
m_shownCpu = 0;
|
||||
m_shownCore = 0;
|
||||
|
@ -286,10 +304,8 @@ public class MulticoreVisualizerCanvasFilter {
|
|||
}
|
||||
|
||||
|
||||
/** returns a String giving the current filtering stats */
|
||||
/** returns a String giving the current filtering stats */
|
||||
private String getStats() {
|
||||
|
||||
|
||||
return STR_FILTER_ACTIVE + " " + STR_CPU + " " + m_shownCpu + "/" + m_totalCpu + ", " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
STR_CORE + " " + m_shownCore + "/" + m_totalCore + ", " + //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
|
||||
STR_THREAD + " " + m_shownThread + "/" + m_totalThread; //$NON-NLS-1$//$NON-NLS-2$
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Ericsson
|
||||
* Copyright (c) 2013, 2014 Ericsson 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
|
||||
|
@ -57,8 +57,8 @@ public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListe
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns existing filter for a given debug session or creates a new
|
||||
* filter if it doesn't exist yet.
|
||||
* Returns the filter for a given debug session if it exists, or else
|
||||
* creates a new filter for that session.
|
||||
*/
|
||||
public MulticoreVisualizerCanvasFilter getFilter(String sessionId) {
|
||||
MulticoreVisualizerCanvasFilter filter = null;
|
||||
|
@ -82,28 +82,28 @@ public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListe
|
|||
}
|
||||
}
|
||||
|
||||
/** Re-computes the current filter to reflect latest model changes */
|
||||
/** Re-computes the current filter to reflect latest model changes */
|
||||
public void updateCurrentFilter() {
|
||||
if( m_currentFilter != null) {
|
||||
m_currentFilter.updateFilter();
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets-up a filter, based on the current canvas selection */
|
||||
/** Sets-up a filter, based on the current canvas selection */
|
||||
public void applyFilter() {
|
||||
if( m_currentFilter != null) {
|
||||
m_currentFilter.applyFilter();
|
||||
}
|
||||
}
|
||||
|
||||
/** Clears the current filter */
|
||||
/** Clears the current filter */
|
||||
public void clearFilter() {
|
||||
if( m_currentFilter != null) {
|
||||
m_currentFilter.clearFilter();
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the current filter for a given model/session */
|
||||
/** Sets the current filter for a given model/session */
|
||||
public void setCurrentFilter(String sessionId) {
|
||||
if (sessionId == null) {
|
||||
m_currentFilter = null;
|
||||
|
@ -113,12 +113,12 @@ public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListe
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the current filter */
|
||||
/** Returns the current filter */
|
||||
public MulticoreVisualizerCanvasFilter getCurrentFilter() {
|
||||
return m_currentFilter;
|
||||
}
|
||||
|
||||
/** Checks if the current filter is active */
|
||||
/** Checks if the current filter is active */
|
||||
public boolean isCurrentFilterActive() {
|
||||
if( m_currentFilter != null) {
|
||||
return m_currentFilter.isFilterActive();
|
||||
|
@ -126,7 +126,7 @@ public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListe
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Checks if the current filter permits the display of an object */
|
||||
/** Checks if the current filter permits the display of an object */
|
||||
public boolean displayObject(final IVisualizerModelObject obj) {
|
||||
if( m_currentFilter != null) {
|
||||
return m_currentFilter.displayObject(obj);
|
||||
|
@ -136,6 +136,7 @@ public class MulticoreVisualizerCanvasFilterManager implements SessionEndedListe
|
|||
|
||||
@Override
|
||||
public void sessionEnded(DsfSession session) {
|
||||
// session has ended - remove corresponding filter
|
||||
removeFilter(session.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,7 @@ public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
|
|||
/** List of threads currently on this core. */
|
||||
protected ArrayList<MulticoreVisualizerThread> m_threads;
|
||||
|
||||
/**
|
||||
* Load meter associated to this core
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Load meter associated to this core */
|
||||
protected MulticoreVisualizerLoadMeter m_loadMeter;
|
||||
|
||||
// --- constructors/destructors ---
|
||||
|
@ -111,16 +108,12 @@ public class MulticoreVisualizerCore extends MulticoreVisualizerGraphicObject
|
|||
return m_threads;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Sets the load meter associated to this core */
|
||||
public void setLoadMeter (MulticoreVisualizerLoadMeter meter) {
|
||||
m_loadMeter = meter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Gets the load meter associated to this core */
|
||||
public MulticoreVisualizerLoadMeter getLoadMeter() {
|
||||
return m_loadMeter;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.swt.graphics.GC;
|
|||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
/**
|
||||
* @since 1.1
|
||||
* Load meter graphic object
|
||||
*/
|
||||
public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObject {
|
||||
|
||||
|
@ -53,7 +53,6 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
|
|||
// --- constructors/destructors ---
|
||||
|
||||
/** Constructor */
|
||||
|
||||
public MulticoreVisualizerLoadMeter(Integer load) {
|
||||
m_currentLoad = load;
|
||||
}
|
||||
|
@ -73,14 +72,17 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
|
|||
|
||||
// --- accessors ---
|
||||
|
||||
public void setEnabled (boolean enabled) {
|
||||
/** Sets whether the load meter is enabled */
|
||||
public void setEnabled(boolean enabled) {
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
/** Gets whether the load meter is enabled */
|
||||
public boolean getEnabled() {
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
/** Sets the load associated to this load meter */
|
||||
public void setLoad(Integer load) {
|
||||
m_currentLoad = load;
|
||||
}
|
||||
|
@ -106,6 +108,7 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
|
|||
m_highLoadWatermark = wm;
|
||||
}
|
||||
|
||||
/** Sets the load value over which the load is considered overload */
|
||||
public void setOverloadThreshold (int t) {
|
||||
m_overloadThreshold = t;
|
||||
}
|
||||
|
@ -121,8 +124,7 @@ public class MulticoreVisualizerLoadMeter extends MulticoreVisualizerGraphicObje
|
|||
// --- paint methods ---
|
||||
|
||||
/** get a color that corresponds to the current load */
|
||||
private Color getLoadColor() {
|
||||
|
||||
private Color getLoadColor() {
|
||||
if (getLoad() < m_overloadThreshold) {
|
||||
return IMulticoreVisualizerConstants.COLOR_LOAD_LOADBAR_NORMAL;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
|||
import org.eclipse.cdt.visualizer.ui.util.GUIUtils;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
|
||||
/** Status bar graphic object */
|
||||
public class MulticoreVisualizerStatusBar extends MulticoreVisualizerGraphicObject {
|
||||
|
||||
// --- members ---
|
||||
|
|
|
@ -92,8 +92,7 @@ public class DSFDebugModel {
|
|||
}
|
||||
|
||||
|
||||
/** Request load information for a single CPU or core
|
||||
* @since 1.1*/
|
||||
/** Request load information for a single CPU or core */
|
||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
public static void getLoad(DSFSessionState sessionState,
|
||||
final IDMContext context,
|
||||
|
@ -357,8 +356,8 @@ public class DSFDebugModel {
|
|||
}
|
||||
}
|
||||
|
||||
// For a suspended thread, let's see why it is suspended,
|
||||
// to find out if the thread is crashed
|
||||
/** For a suspended thread, let's see why it is suspended,
|
||||
* to find out if the thread is crashed */
|
||||
private static void getThreadSuspendReason(DSFSessionState sessionState,
|
||||
final ICPUDMContext cpuContext,
|
||||
final ICoreDMContext coreContext,
|
||||
|
@ -414,15 +413,11 @@ public class DSFDebugModel {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a timer that refreshes the load meters
|
||||
* @since 1.1
|
||||
*/
|
||||
/** 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() {
|
||||
|
|
|
@ -70,16 +70,10 @@ public interface DSFDebugModelListener {
|
|||
VisualizerExecutionState state,
|
||||
Object arg);
|
||||
|
||||
/**
|
||||
* Invoked when getLoad() request completes.
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Invoked when getLoad() request completes. */
|
||||
public void getLoadDone(IDMContext context, ILoadInfo loads, Object arg);
|
||||
|
||||
/**
|
||||
* Invoked when the load timer triggers
|
||||
* @since 1.1
|
||||
*/
|
||||
/** Invoked when the load timer triggers. */
|
||||
public void updateLoads();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue