Search in sources :

Example 1 with IMethodNode

use of org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode in project tdi-studio-se by Talend.

the class AbstractFilteredTree method updateStatusLine.

/**
     * Updates the status line.
     * 
     * @param selection the selection
     */
public void updateStatusLine(IStructuredSelection selection) {
    IStatusLineManager manager = actionBars.getStatusLineManager();
    IContributionItem[] items = manager.getItems();
    StatusLineContributionItem selfTimeStatusLineItem = null;
    for (IContributionItem item : items) {
        if (item instanceof StatusLineContributionItem) {
            selfTimeStatusLineItem = (StatusLineContributionItem) item;
        }
    }
    // create the status line
    if (selfTimeStatusLineItem == null) {
        //$NON-NLS-1$
        selfTimeStatusLineItem = new StatusLineContributionItem("SelfTimeContributionItem");
        manager.add(selfTimeStatusLineItem);
    }
    // clear the status line
    if (selection == null) {
        selfTimeStatusLineItem.setText(Util.ZERO_LENGTH_STRING);
        return;
    }
    // set text on status line
    double percentage = 0;
    double time = 0;
    for (Object object : selection.toArray()) {
        if (object instanceof IMethodNode) {
            percentage += ((IMethodNode) object).getSelfTimeInPercentage();
            time += ((IMethodNode) object).getSelfTime();
        }
    }
    String text = Util.ZERO_LENGTH_STRING;
    if (percentage != 0) {
        //$NON-NLS-1$
        text = String.format("Self Time: %.0fms  %.1f", time, percentage) + '%';
    }
    selfTimeStatusLineItem.setText(text);
}
Also used : StatusLineContributionItem(org.eclipse.jface.action.StatusLineContributionItem) IMethodNode(org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IContributionItem(org.eclipse.jface.action.IContributionItem)

Example 2 with IMethodNode

use of org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode in project tdi-studio-se by Talend.

the class HotSpotsLabelProvider method getSelfTimeInMsColumnText.

/**
     * Gets the self time in milliseconds column text.
     * 
     * @param element the element
     * @return the self time column text
     */
private String getSelfTimeInMsColumnText(Object element) {
    ICpuModel cpuModel = (ICpuModel) filteredTree.getViewer().getInput();
    if (cpuModel == null) {
        //$NON-NLS-1$
        return "";
    }
    if (element instanceof IMethodNode) {
        long selfTime = ((IMethodNode) element).getSelfTime();
        int length = String.valueOf(cpuModel.getMaxSelfTime() * 1000).length();
        length = (length > 10) ? 10 : length;
        return getMillisecondsText(selfTime, length);
    }
    //$NON-NLS-1$
    return "";
}
Also used : IMethodNode(org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 3 with IMethodNode

use of org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode in project tdi-studio-se by Talend.

the class ShowCallersCalleesAction method selectionChanged.

/*
     * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
     */
@Override
public void selectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (!(selection instanceof StructuredSelection)) {
        return;
    }
    Object element = ((StructuredSelection) selection).getFirstElement();
    if (element instanceof IMethodNode) {
        callesCalleesTargetNode = (IMethodNode) element;
        setEnabled(true);
    } else {
        setEnabled(false);
    }
}
Also used : IMethodNode(org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 4 with IMethodNode

use of org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode in project tdi-studio-se by Talend.

the class CallerCalleeTabPage method refreshContentDescription.

/**
     * Refreshes the content description.
     */
private void refreshContentDescription() {
    if (jvm == null) {
        return;
    }
    StringBuilder description = new StringBuilder();
    IMethodNode callersCalleesTarget = jvm.getCpuProfiler().getCpuModel().getCallersCalleesTarget();
    if (callersCalleesTarget != null) {
        description.append(NLS.bind(Messages.callersCalleesTargetIndicator, callersCalleesTarget.getName()));
    }
    ICpuModel cpuModel = jvm.getCpuProfiler().getCpuModel();
    ICallTreeNode focusedNode = cpuModel.getFocusTarget();
    if (focusedNode != null) {
        if (callersCalleesTarget != null) {
            description.append(NLS.bind(Messages.focusTargetIndicator, focusedNode.getNonqualifiedName()));
        }
    }
    String thread = null;
    if (focusedNode != null) {
        thread = focusedNode.getThread();
    } else if (callersCalleesTarget != null) {
        thread = callersCalleesTarget.getThread();
    }
    if (description.length() > 0 && thread != null) {
        description.append(NLS.bind(Messages.threadIndicator, thread));
    }
    setContentDescription(description.toString());
}
Also used : IMethodNode(org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode) ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 5 with IMethodNode

use of org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode in project tdi-studio-se by Talend.

the class HotSpotsComparator method compare.

/*
     * @see ViewerComparator#compare(Viewer, Object, Object)
     */
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    int result = 0;
    if (!(e1 instanceof IMethodNode) || !(e2 instanceof IMethodNode)) {
        return result;
    }
    IMethodNode method1 = (IMethodNode) e1;
    IMethodNode method2 = (IMethodNode) e2;
    if (columnType == ColumnType.Methods) {
        result = method1.getName().compareTo(method2.getName());
    } else if (columnType == ColumnType.TimeMs) {
        result = (method1.getSelfTime() > method2.getSelfTime()) ? 1 : -1;
    } else if (columnType == ColumnType.TimePercentage) {
        result = (method1.getSelfTimeInPercentage() > method2.getSelfTimeInPercentage()) ? 1 : -1;
    } else if (columnType == ColumnType.Count) {
        result = (method1.getInvocationCount() > method2.getInvocationCount()) ? 1 : -1;
    }
    if (sortDirection == SWT.DOWN) {
        result *= -1;
    }
    return result;
}
Also used : IMethodNode(org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode)

Aggregations

IMethodNode (org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode)6 ICallTreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode)2 ICpuModel (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)2 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)1 StatusLineContributionItem (org.eclipse.jface.action.StatusLineContributionItem)1 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 AbstractFilteredTree (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree)1 ViewerType (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree.ViewerType)1