Search in sources :

Example 1 with CachegrindFile

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile 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 CachegrindFile

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

the class DoubleClickTest method checkFile.

private IEditorPart checkFile(CachegrindFile file) {
    IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    IEditorInput input = editor.getEditorInput();
    IFileEditorInput fileInput = (IFileEditorInput) input;
    IResource expectedResource = proj.getProject().findMember(file.getName());
    File expectedFile = expectedResource.getLocation().toFile();
    File actualFile = fileInput.getFile().getLocation().toFile();
    assertEquals(expectedFile, actualFile);
    return editor;
}
Also used : IFileEditorInput(org.eclipse.ui.IFileEditorInput) IEditorPart(org.eclipse.ui.IEditorPart) File(java.io.File) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) IEditorInput(org.eclipse.ui.IEditorInput) IResource(org.eclipse.core.resources.IResource)

Example 3 with CachegrindFile

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile 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 4 with CachegrindFile

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile 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 CachegrindFile

use of org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile 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

CachegrindFile (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile)16 CachegrindOutput (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput)13 CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)12 Test (org.junit.Test)12 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)10 CachegrindFunction (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction)8 CachegrindLine (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindLine)4 TreePath (org.eclipse.jface.viewers.TreePath)3 IEditorPart (org.eclipse.ui.IEditorPart)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 ICachegrindElement (org.eclipse.linuxtools.internal.valgrind.cachegrind.model.ICachegrindElement)2 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)2 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 CModelException (org.eclipse.cdt.core.model.CModelException)1