Search in sources :

Example 6 with MassifSnapshot

use of org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot 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)

Example 7 with MassifSnapshot

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

the class MultiProcessTest method testNoExec.

@Test
public void testNoExec() throws CoreException, URISyntaxException, IOException {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testNoExec");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifOutput output = view.getOutput();
    assertEquals(1, output.getPids().length);
    MassifSnapshot[] snapshots = view.getSnapshots();
    assertEquals(8, snapshots.length);
    checkSnapshots(snapshots, 400, 8);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) MassifOutput(org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Example 8 with MassifSnapshot

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

the class SortTest method checkOrder.

private void checkOrder(TableViewer viewer, int column, boolean ascending) {
    TableItem[] items = viewer.getTable().getItems();
    for (int i = 0; i < items.length - 1; i++) {
        MassifSnapshot first = (MassifSnapshot) items[i].getData();
        MassifSnapshot second = (MassifSnapshot) items[i + 1].getData();
        switch(column) {
            case 0:
                assertTrue(ascending ? first.getNumber() <= second.getNumber() : first.getNumber() >= second.getNumber());
                break;
            case 1:
                assertTrue(ascending ? first.getTime() <= second.getTime() : first.getTime() >= second.getTime());
                break;
            case 2:
                assertTrue(ascending ? first.getTotal() <= second.getTotal() : first.getTotal() >= second.getTotal());
                break;
            case 3:
                assertTrue(ascending ? first.getHeapBytes() <= second.getHeapBytes() : first.getHeapBytes() >= second.getHeapBytes());
                break;
            case 4:
                assertTrue(ascending ? first.getHeapExtra() <= second.getHeapExtra() : first.getHeapExtra() >= second.getHeapExtra());
                break;
            case 5:
                assertTrue(ascending ? first.getStacks() <= second.getStacks() : first.getStacks() >= second.getStacks());
                break;
            default:
                fail();
        }
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)

Example 9 with MassifSnapshot

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

the class TreeTest method testTreeNodes.

@Test
public void testTreeNodes() throws CoreException, URISyntaxException, IOException {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
    wc.setAttribute(MassifLaunchConstants.ATTR_MASSIF_DETAILEDFREQ, 2);
    wc.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testTreeNodes");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    TreeViewer treeViewer = view.getTreeViewer().getViewer();
    MassifSnapshot[] snapshots = view.getSnapshots();
    MassifHeapTreeNode[] nodes = (MassifHeapTreeNode[]) treeViewer.getInput();
    for (int i = 0; i < nodes.length; i++) {
        // every odd snapshot should be detailed with --detailed-freq=2
        // and thus in the tree
        assertEquals(snapshots[2 * i + 1].getRoot(), nodes[i]);
    }
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifHeapTreeNode(org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Aggregations

MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)9 MassifViewPart (org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart)6 Test (org.junit.Test)5 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)4 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 MassifHeapTreeNode (org.eclipse.linuxtools.internal.valgrind.massif.MassifHeapTreeNode)2 MassifOutput (org.eclipse.linuxtools.internal.valgrind.massif.MassifOutput)2 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TreePath (org.eclipse.jface.viewers.TreePath)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 MassifTreeViewer (org.eclipse.linuxtools.internal.valgrind.massif.MassifTreeViewer)1 ChartLocationsDialog (org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartLocationsDialog)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 Color (org.eclipse.swt.graphics.Color)1 Font (org.eclipse.swt.graphics.Font)1