Search in sources :

Example 16 with CachegrindOutput

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

the class CachegrindLabelProvider method update.

@Override
public void update(ViewerCell cell) {
    ICachegrindElement element = ((ICachegrindElement) cell.getElement());
    int index = cell.getColumnIndex();
    if (index == 0) {
        if (element instanceof CachegrindFile) {
            // Try to use the CElementLabelProvider
            IAdaptable model = ((CachegrindFile) element).getModel();
            if (model != null) {
                cell.setText(cLabelProvider.getText(model));
                cell.setImage(cLabelProvider.getImage(model));
            } else {
                // Fall back
                String name = ((CachegrindFile) element).getName();
                cell.setText(name);
                cell.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE));
            }
        } else if (element instanceof CachegrindFunction) {
            // Try to use the CElementLabelProvider
            IAdaptable model = ((CachegrindFunction) element).getModel();
            if (model != null) {
                cell.setText(cLabelProvider.getText(model));
                cell.setImage(cLabelProvider.getImage(model));
            } else {
                // Fall back
                String name = ((CachegrindFunction) element).getName();
                cell.setText(name);
                cell.setImage(FUNC_IMG);
            }
        } else if (element instanceof CachegrindLine) {
            // $NON-NLS-1$
            cell.setText(NLS.bind(Messages.getString("CachegrindViewPart.line"), ((CachegrindLine) element).getLine()));
            cell.setImage(DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_INSTRUCTION_POINTER_TOP));
        } else if (element instanceof CachegrindOutput) {
            // $NON-NLS-1$
            cell.setText(NLS.bind(Messages.getString("CachegrindViewPart.Total_PID"), ((CachegrindOutput) element).getPid()));
            cell.setImage(DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_REGISTER));
        }
    } else if (element instanceof CachegrindFunction) {
        cell.setText(df.format(((CachegrindFunction) element).getTotals()[index - 1]));
    } else if (element instanceof CachegrindLine) {
        cell.setText(df.format(((CachegrindLine) element).getValues()[index - 1]));
    } else if (element instanceof CachegrindOutput) {
        cell.setText(df.format(((CachegrindOutput) element).getSummary()[index - 1]));
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) ICachegrindElement(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.ICachegrindElement) CachegrindFile(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFile) CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput) CachegrindFunction(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindFunction) CachegrindLine(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindLine)

Example 17 with CachegrindOutput

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

the class CachegrindLaunchDelegate method parseOutput.

private void parseOutput(File[] cachegrindOutputs, IProgressMonitor monitor) throws IOException {
    outputs = new CachegrindOutput[cachegrindOutputs.length];
    for (int i = 0; i < cachegrindOutputs.length; i++) {
        outputs[i] = new CachegrindOutput();
        CachegrindParser.getParser().parse(outputs[i], cachegrindOutputs[i]);
    }
    monitor.worked(2);
}
Also used : CachegrindOutput(org.eclipse.linuxtools.internal.valgrind.cachegrind.model.CachegrindOutput)

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