Search in sources :

Example 1 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart in project linuxtools by eclipse.

the class BasicMassifTest method testNumSnapshots.

@Test
public void testNumSnapshots() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testNumSnapshots");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifSnapshot[] snapshots = view.getSnapshots();
    assertEquals(14, snapshots.length);
    checkSnapshots(snapshots, 40, 16);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 2 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart in project linuxtools by eclipse.

the class ExpandCollapseTest method testExpand.

@Test
public void testExpand() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testDefaults");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    viewer = view.getTreeViewer().getViewer();
    contextMenu = viewer.getTree().getMenu();
    // Select first snapshot and expand it
    MassifHeapTreeNode[] snapshots = (MassifHeapTreeNode[]) viewer.getInput();
    MassifHeapTreeNode snapshot = snapshots[0];
    TreeSelection selection = new TreeSelection(new TreePath(new Object[] { snapshot }));
    viewer.setSelection(selection);
    contextMenu.notifyListeners(SWT.Show, null);
    contextMenu.getItem(0).notifyListeners(SWT.Selection, null);
    checkExpanded(snapshot, true);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreePath(org.eclipse.jface.viewers.TreePath) TreeSelection(org.eclipse.jface.viewers.TreeSelection) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 3 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart in project linuxtools by eclipse.

the class MultiProcessTest method testExec.

@Test
public void testExec() throws CoreException, URISyntaxException, IOException {
    ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy();
    config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true);
    config.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testExec");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifOutput output = view.getOutput();
    Integer[] pids = output.getPids();
    assertEquals(2, pids.length);
    // child not necessarily higher PID than parent
    MassifSnapshot[] snapshots1 = output.getSnapshots(pids[0]);
    assertTrue(snapshots1.length == 8 || snapshots1.length == 14);
    MassifSnapshot[] snapshots2 = output.getSnapshots(pids[1]);
    assertTrue(snapshots2.length == 8 || snapshots2.length == 14);
    assertNotEquals(snapshots1.length, snapshots2.length);
    if (snapshots1.length == 8) {
        checkSnapshots(snapshots1, 400, 8);
        checkSnapshots(snapshots2, 40, 16);
    } else {
        checkSnapshots(snapshots1, 40, 16);
        checkSnapshots(snapshots2, 400, 8);
    }
}
Also used : MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifOutput(org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 4 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart in project linuxtools by eclipse.

the class ChartTests method testChartLocationsDialog.

@Test
public void testChartLocationsDialog() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testChartCallback");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    // peak
    MassifSnapshot snapshot = view.getSnapshots()[7];
    assertTrue(snapshot.isDetailed());
    Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    ChartLocationsDialog dialog = new ChartLocationsDialog(parent);
    dialog.setInput(snapshot);
    dialog.setBlockOnOpen(false);
    dialog.open();
    MassifHeapTreeNode element = snapshot.getRoot().getChildren()[1];
    dialog.getTableViewer().setSelection(new StructuredSelection(element));
    dialog.getOkButton().notifyListeners(SWT.Selection, null);
    dialog.openEditorForResult();
    checkFile(proj.getProject(), element);
    checkLine(element);
}
Also used : ChartLocationsDialog(org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartLocationsDialog) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) Shell(org.eclipse.swt.widgets.Shell) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 5 with MassifViewPart

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart in project linuxtools by eclipse.

the class DoubleClickTest method doDoubleClick.

private void doDoubleClick() {
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifTreeViewer treeViewer = view.getTreeViewer();
    MassifSnapshot[] snapshots = view.getSnapshots();
    // first detailed
    node = snapshots[1].getRoot();
    TreePath path = new TreePath(new Object[] { node });
    while (node.getChildren().length > 0 && !node.hasSourceFile()) {
        node = node.getChildren()[0];
        path = path.createChildPath(node);
    }
    assertTrue(node.hasSourceFile());
    treeViewer.getViewer().expandToLevel(node, AbstractTreeViewer.ALL_LEVELS);
    TreeSelection selection = new TreeSelection(path);
    // do double click
    IDoubleClickListener listener = treeViewer.getDoubleClickListener();
    listener.doubleClick(new DoubleClickEvent(treeViewer.getViewer(), selection));
}
Also used : MassifTreeViewer(org.eclipse.linuxtools.internal.valgrind.massif.MassifTreeViewer) TreePath(org.eclipse.jface.viewers.TreePath) TreeSelection(org.eclipse.jface.viewers.TreeSelection) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)

Aggregations

MassifViewPart (org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)10 Test (org.junit.Test)9 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)6 MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)6 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)4 MassifHeapTreeNode (org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode)4 MassifOutput (org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput)3 TreePath (org.eclipse.jface.viewers.TreePath)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 Shell (org.eclipse.swt.widgets.Shell)2 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 MassifPidMenuAction (org.eclipse.linuxtools.internal.valgrind.massif.MassifPidMenuAction)1 MassifTreeViewer (org.eclipse.linuxtools.internal.valgrind.massif.MassifTreeViewer)1