aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Fraxino Araujo2012-06-29 15:59:10 (EDT)
committerDaniel Henrique Barboza2012-06-29 16:23:16 (EDT)
commit1c10397fc9dfb87d647f54a6afb64f8e8ead9af4 (patch)
tree68d8ab894c7413d7dda86acb5090c098f1c5445b
parent803c5f2dee202cb2a726fc642b30b0ca257c8d95 (diff)
downloadorg.eclipse.linuxtools-1c10397fc9dfb87d647f54a6afb64f8e8ead9af4.zip
org.eclipse.linuxtools-1c10397fc9dfb87d647f54a6afb64f8e8ead9af4.tar.gz
org.eclipse.linuxtools-1c10397fc9dfb87d647f54a6afb64f8e8ead9af4.tar.bz2
Fixed duplicated events on remote perf
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfEventsTab.java236
1 files changed, 119 insertions, 117 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfEventsTab.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfEventsTab.java
index 45c34c8..6c9290a 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfEventsTab.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfEventsTab.java
@@ -38,8 +38,9 @@ import org.eclipse.swt.widgets.Text;
public class PerfEventsTab extends org.eclipse.linuxtools.internal.perf.launch.PerfEventsTab {
private int rawTabIndex = 0;
private int bpTabIndex = 0;
+ private String[] tabNames = null;
private Composite top;
-
+
//Function adapted from org.eclipse.linuxtools.oprofile.launch.configuration.OprofileSetupTab.java
@Override
public void createControl(Composite parent) {
@@ -48,7 +49,7 @@ public class PerfEventsTab extends org.eclipse.linuxtools.internal.perf.launch.P
top.setLayout(new GridLayout());
createVerticalSpacer(top, 1);
-
+
//Default event checkbox
_chkDefaultEvent = new Button(top, SWT.CHECK);
_chkDefaultEvent.setText("Default Event"); //$NON-NLS-1$
@@ -68,127 +69,128 @@ public class PerfEventsTab extends org.eclipse.linuxtools.internal.perf.launch.P
public void initializeFrom(ILaunchConfiguration config) {
//Maybe not the best place to load the event list but we'll see.
HashMap<String,ArrayList<String>> events = PerfCore.getEventList(config);
-
- //tabs for each of the counters
- //String[] tabNames = new String[]{"Hardware Event","Software Event","Hardware Cache Event","Tracepoint Event", "Raw hardware event descriptor","Hardware breakpoint"};
- String[] tabNames = events.keySet().toArray(new String[events.keySet().size()]);
- _eventTabItems = new TabItem[tabNames.length];
- _eventTabLists = new Table[tabNames.length];
-
- _tabFolder = new TabFolder(top, SWT.NONE);
- _tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- //Initialize each tab.
- for (int i = 0; i < tabNames.length; i++) {
-
- _eventTabItems[i] = new TabItem(_tabFolder, SWT.NONE);
- _eventTabItems[i].setText(tabNames[i]);
-
- if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS) || tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
- //These are for the two special tabs for custom events.
-
- //Composite to contain it all
- Composite c = new Composite(_tabFolder, SWT.NONE);
- c.setLayout(new GridLayout(2, false));
-
- //A list to check off existing custom events (or show the new ones added)
- Table eventList = new Table(c, SWT.CHECK | SWT.MULTI);
- _eventTabLists[i] = eventList;
- eventList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- eventList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent se) {
- updateLaunchConfigurationDialog();
- }
- });
- /* Snippet to insert static items
+ if (tabNames==null) {
+ //tabs for each of the counters
+ //String[] tabNames = new String[]{"Hardware Event","Software Event","Hardware Cache Event","Tracepoint Event", "Raw hardware event descriptor","Hardware breakpoint"};
+ tabNames = events.keySet().toArray(new String[events.keySet().size()]);
+ _eventTabItems = new TabItem[tabNames.length];
+ _eventTabLists = new Table[tabNames.length];
+
+ _tabFolder = new TabFolder(top, SWT.NONE);
+ _tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ //Initialize each tab.
+ for (int i = 0; i < tabNames.length; i++) {
+
+ _eventTabItems[i] = new TabItem(_tabFolder, SWT.NONE);
+ _eventTabItems[i].setText(tabNames[i]);
+
+ if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS) || tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
+ //These are for the two special tabs for custom events.
+
+ //Composite to contain it all
+ Composite c = new Composite(_tabFolder, SWT.NONE);
+ c.setLayout(new GridLayout(2, false));
+
+ //A list to check off existing custom events (or show the new ones added)
+ Table eventList = new Table(c, SWT.CHECK | SWT.MULTI);
+ _eventTabLists[i] = eventList;
+ eventList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ eventList.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+ /* Snippet to insert static items
TableItem x = new TableItem(eventList, SWT.NONE);
x.setText("hello1");
x = new TableItem(eventList, SWT.NONE);
x.setText("hello2");*/
-
- //Right side to enter new events and delete old ones
- Composite right = new Composite(c, SWT.NONE);
- right.setLayout(new GridLayout(2,false));
- right.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true));
-
- //for adding
- Label l = new Label(right, SWT.NONE);
- l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,2,1));
- Text t = new Text(right, SWT.SINGLE | SWT.BORDER);
- t.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS)) {
- bpTabIndex = i;
- _bpText = t;
- l.setText("Please enter the hardware breakpoint in the form mem:<addr>[:access].");
- }
- if (tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
- rawTabIndex = i;
- _rawText = t;
- l.setText("Please enter the raw register encoding in the form rNNN.");
- }
-
- Button b = new Button(right, SWT.PUSH);
- b.setText(" Add ");
- b.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
- b.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent se) {
- int i = _tabFolder.getSelectionIndex();
- if (rawTabIndex == i) {
- new TableItem(_eventTabLists[i], SWT.NONE).setText(_rawText.getText());
- } else if(bpTabIndex == i) {
- new TableItem(_eventTabLists[i], SWT.NONE).setText(_bpText.getText());
+
+ //Right side to enter new events and delete old ones
+ Composite right = new Composite(c, SWT.NONE);
+ right.setLayout(new GridLayout(2,false));
+ right.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true));
+
+ //for adding
+ Label l = new Label(right, SWT.NONE);
+ l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,2,1));
+ Text t = new Text(right, SWT.SINGLE | SWT.BORDER);
+ t.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS)) {
+ bpTabIndex = i;
+ _bpText = t;
+ l.setText("Please enter the hardware breakpoint in the form mem:<addr>[:access].");
+ }
+ if (tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
+ rawTabIndex = i;
+ _rawText = t;
+ l.setText("Please enter the raw register encoding in the form rNNN.");
+ }
+
+ Button b = new Button(right, SWT.PUSH);
+ b.setText(" Add ");
+ b.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
+ b.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ int i = _tabFolder.getSelectionIndex();
+ if (rawTabIndex == i) {
+ new TableItem(_eventTabLists[i], SWT.NONE).setText(_rawText.getText());
+ } else if(bpTabIndex == i) {
+ new TableItem(_eventTabLists[i], SWT.NONE).setText(_bpText.getText());
+ }
+ updateLaunchConfigurationDialog();
}
- updateLaunchConfigurationDialog();
+ });
+ l = new Label(right, SWT.NONE);
+ l.setForeground(new Color(right.getDisplay(), 100,100,100));
+ if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS)) {
+ l.setText("For example, .........");
}
- });
- l = new Label(right, SWT.NONE);
- l.setForeground(new Color(right.getDisplay(), 100,100,100));
- if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS)) {
- l.setText("For example, .........");
- }
- if (tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
- l.setText("For example, r1a8");
- }
- l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,2,1));
-
- //spacer label.
- l = new Label(right, SWT.NONE);
- l.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,2,1));
-
- //for removing
- b = new Button(right, SWT.PUSH);
- b.setText("Remove Selected Events");
- b.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false,2,1));
- b.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent se) {
- _eventTabLists[_tabFolder.getSelectionIndex()].remove(_eventTabLists[_tabFolder.getSelectionIndex()].getSelectionIndices());
- updateLaunchConfigurationDialog();
+ if (tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
+ l.setText("For example, r1a8");
+ }
+ l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,2,1));
+
+ //spacer label.
+ l = new Label(right, SWT.NONE);
+ l.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,2,1));
+
+ //for removing
+ b = new Button(right, SWT.PUSH);
+ b.setText("Remove Selected Events");
+ b.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false,2,1));
+ b.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _eventTabLists[_tabFolder.getSelectionIndex()].remove(_eventTabLists[_tabFolder.getSelectionIndex()].getSelectionIndices());
+ updateLaunchConfigurationDialog();
+ }
+ });
+ l = new Label(right, SWT.NONE);
+ l.setForeground(new Color(right.getDisplay(), 100,100,100));
+ l.setText("Note: Select by highlighting, not by checking.");
+ l.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false,2,1));
+
+ _eventTabItems[i].setControl(c);
+ } else {
+ //This loads all the events 'perf list' gives into their respective tabs.
+ Table eventList = new Table(_tabFolder, SWT.CHECK);
+ _eventTabLists[i] = eventList;
+
+ ArrayList<String> evlist = events.get(tabNames[i]);
+ for (String e : evlist) {
+ TableItem x = new TableItem(eventList, SWT.NONE);
+ x.setText(e);
}
- });
- l = new Label(right, SWT.NONE);
- l.setForeground(new Color(right.getDisplay(), 100,100,100));
- l.setText("Note: Select by highlighting, not by checking.");
- l.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false,2,1));
-
- _eventTabItems[i].setControl(c);
- } else {
- //This loads all the events 'perf list' gives into their respective tabs.
- Table eventList = new Table(_tabFolder, SWT.CHECK);
- _eventTabLists[i] = eventList;
-
- ArrayList<String> evlist = events.get(tabNames[i]);
- for (String e : evlist) {
- TableItem x = new TableItem(eventList, SWT.NONE);
- x.setText(e);
+
+ eventList.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ _eventTabItems[i].setControl(eventList);
}
-
- eventList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent se) {
- updateLaunchConfigurationDialog();
- }
- });
-
- _eventTabItems[i].setControl(eventList);
}
}
//if (PerfPlugin.DEBUG_ON) System.out.println("Initializing eventsTab from previous config.");
@@ -196,7 +198,7 @@ public class PerfEventsTab extends org.eclipse.linuxtools.internal.perf.launch.P
//restore whether things are default event/enabled or not.
_chkDefaultEvent.setSelection(config.getAttribute(PerfPlugin.ATTR_DefaultEvent, PerfPlugin.ATTR_DefaultEvent_default));
refreshDefaultEnabled();
-
+
//restore custom hw breakpoints
List<String> hwbps = config.getAttribute(PerfPlugin.ATTR_HwBreakpointEvents, PerfPlugin.ATTR_HwBreakpointEvents_default);
if (hwbps != null) {
@@ -210,7 +212,7 @@ public class PerfEventsTab extends org.eclipse.linuxtools.internal.perf.launch.P
}
}
}
-
+
//restore custom raw hw events
List<String> rawhe = config.getAttribute(PerfPlugin.ATTR_RawHwEvents, PerfPlugin.ATTR_RawHwEvents_default);
if (rawhe != null) {