Search in sources :

Example 1 with CachegrindOutput

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.

the class CModelLabelsTest method testNestedMethodLabel.

@Test
public void testNestedMethodLabel() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testNestedMethodLabel");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    CachegrindOutput output = view.getOutputs()[0];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    // $NON-NLS-1$
    CachegrindFunction func = getFunctionByName(file, "A::B::e()");
    assertTrue(func.getModel() instanceof IMethod);
    checkLabelProvider(func, file);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindFunction(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) IMethod(org.eclipse.cdt.core.model.IMethod) Test(org.junit.Test)

Example 2 with CachegrindOutput

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.

the class DoubleClickTest method testDoubleClickFile.

@Test
public void testDoubleClickFile() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testDoubleClickFile");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    CachegrindOutput output = view.getOutputs()[0];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    TreePath path = new TreePath(new Object[] { output, file });
    doDoubleClick(path);
    checkFile(file);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) TreePath(org.eclipse.jface.viewers.TreePath) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) Test(org.junit.Test)

Example 3 with CachegrindOutput

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.

the class ExpandCollapseTest method testCollapse.

@Test
public void testCollapse() throws Exception {
    // Expand the element first
    testExpand();
    // Then collapse it
    CachegrindOutput[] outputs = (CachegrindOutput[]) viewer.getInput();
    CachegrindOutput output = outputs[0];
    TreeSelection selection = new TreeSelection(new TreePath(new Object[] { output }));
    viewer.setSelection(selection);
    contextMenu.notifyListeners(SWT.Show, null);
    contextMenu.getItem(1).notifyListeners(SWT.Selection, null);
    checkExpanded(output, false);
}
Also used : TreePath(org.eclipse.jface.viewers.TreePath) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) TreeSelection(org.eclipse.jface.viewers.TreeSelection) Test(org.junit.Test)

Example 4 with CachegrindOutput

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.

the class MultiProcessTest method testNumFunctions.

@Test
public void testNumFunctions() throws Exception {
    ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy();
    config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true);
    config.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testExec");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    int pidIx = 0;
    CachegrindOutput output = view.getOutputs()[pidIx];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    if (file == null) {
        pidIx = 1;
        output = view.getOutputs()[pidIx];
        // $NON-NLS-1$
        file = getFileByName(output, "cpptest.cpp");
    }
    assertNotNull(file);
    assertEquals(8, file.getFunctions().length);
    // test other pid
    pidIx = (pidIx + 1) % 2;
    output = view.getOutputs()[pidIx];
    // $NON-NLS-1$
    file = getFileByName(output, "parent.cpp");
    assertNotNull(file);
    assertEquals(6, file.getFunctions().length);
}
Also used : CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) Test(org.junit.Test)

Example 5 with CachegrindOutput

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput in project linuxtools by eclipse.

the class MultiProcessTest method testFileNames.

@Test
public void testFileNames() throws Exception {
    ILaunchConfigurationWorkingCopy config = createConfiguration(proj.getProject()).getWorkingCopy();
    config.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, true);
    config.doSave();
    // $NON-NLS-1$
    doLaunch(config, "testExec");
    CachegrindViewPart view = (CachegrindViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    int pidIx = 0;
    CachegrindOutput output = view.getOutputs()[pidIx];
    // $NON-NLS-1$
    CachegrindFile file = getFileByName(output, "cpptest.cpp");
    if (file == null) {
        pidIx = 1;
        output = view.getOutputs()[pidIx];
        // $NON-NLS-1$
        file = getFileByName(output, "cpptest.cpp");
    }
    assertNotNull(file);
    // $NON-NLS-1$
    file = getFileByName(output, "cpptest.h");
    assertNotNull(file);
    // test other pid
    pidIx = (pidIx + 1) % 2;
    output = view.getOutputs()[pidIx];
    // $NON-NLS-1$
    file = getFileByName(output, "parent.cpp");
    assertNotNull(file);
}
Also used : CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) CachegrindViewPart(org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart) Test(org.junit.Test)

Aggregations

CachegrindOutput (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput)17 Test (org.junit.Test)14 CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)13 CachegrindFile (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile)13 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)11 CachegrindFunction (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction)7 TreePath (org.eclipse.jface.viewers.TreePath)5 CachegrindLine (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindLine)3 IMethod (org.eclipse.cdt.core.model.IMethod)2 ITranslationUnit (org.eclipse.cdt.core.model.ITranslationUnit)2 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)2 TextSelection (org.eclipse.jface.text.TextSelection)2 ISelection (org.eclipse.jface.viewers.ISelection)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 ICachegrindElement (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.ICachegrindElement)2 IEditorPart (org.eclipse.ui.IEditorPart)2 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)2 IFunction (org.eclipse.cdt.core.model.IFunction)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1