Skip to content

Commit 61eb4c0

Browse files
debonzi-xxAndrew Overholt
authored and
Andrew Overholt
committed
Valgrind 3.6 massif new options included.
1 parent ba34c1c commit 61eb4c0

File tree

5 files changed

+100
-4
lines changed

5 files changed

+100
-4
lines changed

valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifCommandConstants.java

+2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ public final class MassifCommandConstants {
1616
public static final String OPT_HEAP = "--heap"; //$NON-NLS-1$
1717
public static final String OPT_HEAPADMIN = "--heap-admin"; //$NON-NLS-1$
1818
public static final String OPT_STACKS = "--stacks"; //$NON-NLS-1$
19+
public static final String OPT_PAGESASHEAP = "--pages-as-heap"; //no|yes $NON-NLS-1$
1920
public static final String OPT_DEPTH = "--depth"; //$NON-NLS-1$
2021
public static final String OPT_ALLOCFN = "--alloc-fn"; //$NON-NLS-1$
22+
public static final String OPT_IGNOREFN = "--ignore-fn"; //<name> $NON-NLS-1$
2123
public static final String OPT_THRESHOLD = "--threshold"; //$NON-NLS-1$
2224
public static final String OPT_PEAKINACCURACY = "--peak-inaccuracy"; //$NON-NLS-1$
2325
public static final String OPT_TIMEUNIT = "--time-unit"; //$NON-NLS-1$

valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifLaunchConstants.java

+4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ public final class MassifLaunchConstants {
1919
public static final String ATTR_MASSIF_HEAP = MassifPlugin.PLUGIN_ID + ".MASSIF_HEAP"; //$NON-NLS-1$
2020
public static final String ATTR_MASSIF_HEAPADMIN = MassifPlugin.PLUGIN_ID + ".MASSIF_HEAPADMIN"; //$NON-NLS-1$
2121
public static final String ATTR_MASSIF_STACKS = MassifPlugin.PLUGIN_ID + ".MASSIF_STACKS"; //$NON-NLS-1$
22+
public static final String ATTR_MASSIF_PAGESASHEAP = MassifPlugin.PLUGIN_ID + ".MASSIF_PAGEASHEAP"; //$NON-NLS-1$
2223
public static final String ATTR_MASSIF_DEPTH = MassifPlugin.PLUGIN_ID + ".MASSIF_DEPTH"; //$NON-NLS-1$
2324
public static final String ATTR_MASSIF_ALLOCFN = MassifPlugin.PLUGIN_ID + ".MASSIF_ALLOCFN"; //$NON-NLS-1$
25+
public static final String ATTR_MASSIF_IGNOREFN = MassifPlugin.PLUGIN_ID + ".MASSIF_IGNOREFN"; //$NON-NLS-1$
2426
public static final String ATTR_MASSIF_THRESHOLD = MassifPlugin.PLUGIN_ID + ".MASSIF_THRESHOLD"; //$NON-NLS-1$
2527
public static final String ATTR_MASSIF_PEAKINACCURACY = MassifPlugin.PLUGIN_ID + ".MASSIF_PEAKINACCURACY"; //$NON-NLS-1$
2628
public static final String ATTR_MASSIF_TIMEUNIT = MassifPlugin.PLUGIN_ID + ".MASSIF_TIMEUNIT"; //$NON-NLS-1$
@@ -36,8 +38,10 @@ public final class MassifLaunchConstants {
3638
public static final boolean DEFAULT_MASSIF_HEAP = true;
3739
public static final int DEFAULT_MASSIF_HEAPADMIN = 8;
3840
public static final boolean DEFAULT_MASSIF_STACKS = false;
41+
public static final boolean DEFAULT_MASSIF_PAGESASHEAP = false;
3942
public static final int DEFAULT_MASSIF_DEPTH = 30;
4043
public static final List<?> DEFAULT_MASSIF_ALLOCFN = Collections.EMPTY_LIST;
44+
public static final List<?> DEFAULT_MASSIF_IGNOREFN = Collections.EMPTY_LIST;
4145
public static final int DEFAULT_MASSIF_THRESHOLD = 10;
4246
public static final int DEFAULT_MASSIF_PEAKINACCURACY = 10;
4347
public static final String DEFAULT_MASSIF_TIMEUNIT = TIME_I;

valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifLaunchDelegate.java

+5
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,16 @@ public String[] getCommandArray(ILaunchConfiguration config, Version ver, IPath
8383
opts.add(MassifCommandConstants.OPT_HEAP + EQUALS + (config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, MassifLaunchConstants.DEFAULT_MASSIF_HEAP) ? YES : NO));
8484
opts.add(MassifCommandConstants.OPT_HEAPADMIN + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, MassifLaunchConstants.DEFAULT_MASSIF_HEAPADMIN));
8585
opts.add(MassifCommandConstants.OPT_STACKS + EQUALS + (config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, MassifLaunchConstants.DEFAULT_MASSIF_STACKS) ? YES : NO));
86+
opts.add(MassifCommandConstants.OPT_PAGESASHEAP + EQUALS + (config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_PAGESASHEAP, MassifLaunchConstants.DEFAULT_MASSIF_PAGESASHEAP) ? YES : NO));
8687
opts.add(MassifCommandConstants.OPT_DEPTH + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, MassifLaunchConstants.DEFAULT_MASSIF_DEPTH));
8788
List<String> allocFns = config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, MassifLaunchConstants.DEFAULT_MASSIF_ALLOCFN);
8889
for (String func : allocFns) {
8990
opts.add(MassifCommandConstants.OPT_ALLOCFN + EQUALS + func);
9091
}
92+
List<String> ignoreFns = config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_IGNOREFN, MassifLaunchConstants.DEFAULT_MASSIF_IGNOREFN);
93+
for (String func : ignoreFns) {
94+
opts.add(MassifCommandConstants.OPT_IGNOREFN + EQUALS + func);
95+
}
9196
opts.add(MassifCommandConstants.OPT_THRESHOLD + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, MassifLaunchConstants.DEFAULT_MASSIF_THRESHOLD) / 10.0);
9297
opts.add(MassifCommandConstants.OPT_PEAKINACCURACY + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, MassifLaunchConstants.DEFAULT_MASSIF_PEAKINACCURACY) / 10.0);
9398
opts.add(MassifCommandConstants.OPT_TIMEUNIT + EQUALS + config.getAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, MassifLaunchConstants.DEFAULT_MASSIF_TIMEUNIT));

valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/MassifToolPage.java

+86-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ public class MassifToolPage extends AbstractLaunchConfigurationTab
4747

4848
// Massif controls
4949
protected Button heapButton;
50+
protected Button pagesasheapButton;
5051
protected Spinner heapAdminSpinner;
5152
protected Button stacksButton;
5253
protected Spinner depthSpinner;
5354
protected List allocFnList;
55+
protected List ignoreFnList;
5456
protected Spinner thresholdSpinner;
5557
protected Spinner peakInaccuracySpinner;
5658
protected Combo timeUnitCombo;
@@ -102,7 +104,14 @@ public void createControl(Composite parent) {
102104
stacksButton = new Button(stacksTop, SWT.CHECK);
103105
stacksButton.setText(Messages.getString("MassifToolPage.profile_stack")); //$NON-NLS-1$
104106
stacksButton.addSelectionListener(selectListener);
107+
108+
Composite pagesasheapTop = new Composite(top, SWT.NONE);
109+
pagesasheapTop.setLayout(new GridLayout(2, false));
105110

111+
pagesasheapButton = new Button(pagesasheapTop, SWT.CHECK);
112+
pagesasheapButton.setText(Messages.getString("MassifToolPage.profile_pagesasheap")); //$NON-NLS-1$
113+
pagesasheapButton.addSelectionListener(selectListener);
114+
106115
Composite depthTop = new Composite(top, SWT.NONE);
107116
depthTop.setLayout(new GridLayout(2, false));
108117

@@ -199,6 +208,18 @@ public void widgetSelected(SelectionEvent e) {
199208
allocFnLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
200209

201210
createAllocFnControls(allocFnTop);
211+
212+
Composite ignoreFnTop = new Composite(top, SWT.NONE);
213+
ignoreFnTop.setLayout(new GridLayout(3, false));
214+
ignoreFnTop.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
215+
216+
Label ignoreFnLabel = new Label(ignoreFnTop, SWT.NONE);
217+
ignoreFnLabel.setText(Messages.getString("MassifToolPage.ignore_functions")); //$NON-NLS-1$
218+
ignoreFnLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
219+
220+
createIgnoreFnControls(ignoreFnTop);
221+
222+
202223
}
203224

204225
private void checkAlignmentEnablement() {
@@ -222,7 +243,7 @@ private void createAllocFnControls(Composite top) {
222243
newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
223244
newButton.addSelectionListener(new SelectionAdapter() {
224245
public void widgetSelected(SelectionEvent e) {
225-
handleNewButtonPressed();
246+
handleAllocNewButtonPressed();
226247
updateLaunchConfigurationDialog();
227248
}
228249
});
@@ -232,13 +253,46 @@ public void widgetSelected(SelectionEvent e) {
232253
removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
233254
removeButton.addSelectionListener(new SelectionAdapter() {
234255
public void widgetSelected(SelectionEvent e) {
235-
handleRemoveButtonPressed();
256+
handleAllocRemoveButtonPressed();
257+
updateLaunchConfigurationDialog();
258+
}
259+
});
260+
}
261+
262+
private void createIgnoreFnControls(Composite top) {
263+
264+
ignoreFnList = new List(top, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
265+
FontMetrics fm = MassifPlugin.getFontMetrics(ignoreFnList);
266+
ignoreFnList.setLayoutData(new GridData(Dialog.convertWidthInCharsToPixels(fm, 50), Dialog.convertHeightInCharsToPixels(fm, 5)));
267+
268+
Composite ignoreButtons = new Composite(top, SWT.NONE);
269+
GridLayout ignoreButtonsLayout = new GridLayout();
270+
ignoreButtonsLayout.marginWidth = ignoreButtonsLayout.marginHeight = 0;
271+
ignoreButtons.setLayout(ignoreButtonsLayout);
272+
ignoreButtons.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
273+
274+
Button newButton = new Button(ignoreButtons, SWT.PUSH);
275+
newButton.setText(Messages.getString("MassifToolPage.New")); //$NON-NLS-1$
276+
newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
277+
newButton.addSelectionListener(new SelectionAdapter() {
278+
public void widgetSelected(SelectionEvent e) {
279+
handleIgnoreNewButtonPressed();
280+
updateLaunchConfigurationDialog();
281+
}
282+
});
283+
284+
Button removeButton = new Button(ignoreButtons, SWT.PUSH);
285+
removeButton.setText(Messages.getString("MassifToolPage.Remove")); //$NON-NLS-1$
286+
removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
287+
removeButton.addSelectionListener(new SelectionAdapter() {
288+
public void widgetSelected(SelectionEvent e) {
289+
handleIgnoreRemoveButtonPressed();
236290
updateLaunchConfigurationDialog();
237291
}
238292
});
239293
}
240294

241-
protected void handleNewButtonPressed() {
295+
protected void handleAllocNewButtonPressed() {
242296
InputDialog dialog = new InputDialog(getShell(), Messages.getString("MassifToolPage.New_Allocation_Function"), Messages.getString("MassifToolPage.Function_name"), "", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
243297
if (dialog.open() == Window.OK) {
244298
String function = dialog.getValue();
@@ -248,11 +302,26 @@ protected void handleNewButtonPressed() {
248302
}
249303
}
250304

251-
protected void handleRemoveButtonPressed() {
305+
protected void handleAllocRemoveButtonPressed() {
252306
int[] selections = allocFnList.getSelectionIndices();
253307
allocFnList.remove(selections);
254308
}
255309

310+
protected void handleIgnoreNewButtonPressed() {
311+
InputDialog dialog = new InputDialog(getShell(), Messages.getString("MassifToolPage.New_Ignore_Function"), Messages.getString("MassifToolPage.Function_name"), "", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
312+
if (dialog.open() == Window.OK) {
313+
String function = dialog.getValue();
314+
if (!function.equals("")) { //$NON-NLS-1$
315+
ignoreFnList.add(function);
316+
}
317+
}
318+
}
319+
320+
protected void handleIgnoreRemoveButtonPressed() {
321+
int[] selections = ignoreFnList.getSelectionIndices();
322+
ignoreFnList.remove(selections);
323+
}
324+
256325
public String getName() {
257326
return Messages.getString("MassifToolPage.Massif_Options"); //$NON-NLS-1$
258327
}
@@ -264,9 +333,12 @@ public void initializeFrom(ILaunchConfiguration configuration) {
264333
heapButton.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, MassifLaunchConstants.DEFAULT_MASSIF_HEAP));
265334
heapAdminSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, MassifLaunchConstants.DEFAULT_MASSIF_HEAPADMIN));
266335
stacksButton.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, MassifLaunchConstants.DEFAULT_MASSIF_STACKS));
336+
pagesasheapButton.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_PAGESASHEAP, MassifLaunchConstants.DEFAULT_MASSIF_PAGESASHEAP));
267337
depthSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, MassifLaunchConstants.DEFAULT_MASSIF_DEPTH));
268338
java.util.List<String> allocFns = configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, MassifLaunchConstants.DEFAULT_MASSIF_ALLOCFN);
269339
allocFnList.setItems(allocFns.toArray(new String[allocFns.size()]));
340+
java.util.List<String> ignoreFns = configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_IGNOREFN, MassifLaunchConstants.DEFAULT_MASSIF_IGNOREFN);
341+
ignoreFnList.setItems(ignoreFns.toArray(new String[ignoreFns.size()]));
270342
thresholdSpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, MassifLaunchConstants.DEFAULT_MASSIF_THRESHOLD));
271343
peakInaccuracySpinner.setSelection(configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, MassifLaunchConstants.DEFAULT_MASSIF_PEAKINACCURACY));
272344
String timeUnit = configuration.getAttribute(MassifLaunchConstants.ATTR_MASSIF_TIMEUNIT, MassifLaunchConstants.DEFAULT_MASSIF_TIMEUNIT);
@@ -295,8 +367,10 @@ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
295367
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAP, heapButton.getSelection());
296368
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_HEAPADMIN, heapAdminSpinner.getSelection());
297369
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_STACKS, stacksButton.getSelection());
370+
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_PAGESASHEAP, pagesasheapButton.getSelection());
298371
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DEPTH, depthSpinner.getSelection());
299372
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_ALLOCFN, Arrays.asList(allocFnList.getItems()));
373+
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_IGNOREFN, Arrays.asList(ignoreFnList.getItems()));
300374
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_THRESHOLD, thresholdSpinner.getSelection());
301375
configuration.setAttribute(MassifLaunchConstants.ATTR_MASSIF_PEAKINACCURACY, peakInaccuracySpinner.getSelection());
302376
int ix = timeUnitCombo.getSelectionIndex();
@@ -379,6 +453,10 @@ public Spinner getHeapAdminSpinner() {
379453
public Button getStacksButton() {
380454
return stacksButton;
381455
}
456+
457+
public Button getPageasheapButton() {
458+
return pagesasheapButton;
459+
}
382460

383461
public Spinner getDepthSpinner() {
384462
return depthSpinner;
@@ -388,6 +466,10 @@ public List getAllocFnList() {
388466
return allocFnList;
389467
}
390468

469+
public List getIgnoreFnList() {
470+
return ignoreFnList;
471+
}
472+
391473
public Spinner getThresholdSpinner() {
392474
return thresholdSpinner;
393475
}

valgrind/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/internal/valgrind/massif/messages.properties

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ MassifPidMenuAction.Select_Process_ID=Select Process ID
88
MassifToolPage.administrative_bytes=administrative bytes per block:
99
MassifToolPage.Alignment_must_be_power_2=Alignment must be a power of 2 between 8 and 4096 inclusive
1010
MassifToolPage.allocation_functions=allocation functions:
11+
MassifToolPage.ignore_functions=ignore functions:
1112
MassifToolPage.allocation_peak_inaccuracy=allocation peak inaccuracy:
1213
MassifToolPage.allocation_tree_depth=allocation tree depth:
1314
MassifToolPage.bytes=bytes
@@ -22,7 +23,9 @@ MassifToolPage.milliseconds=milliseconds
2223
MassifToolPage.minimum_heap_block=minimum heap block alignment:
2324
MassifToolPage.New=N&ew
2425
MassifToolPage.New_Allocation_Function=New Allocation Function
26+
MassifToolPage.New_Ignore_Function=New Ignore Function
2527
MassifToolPage.profile_heap=profile heap
28+
MassifToolPage.profile_pagesasheap=profile memory at page level
2629
MassifToolPage.profile_stack=profile stack
2730
MassifToolPage.Remove=Rem&ove
2831
MassifToolPage.time_unit=time unit:

0 commit comments

Comments
 (0)