Search in sources :

Example 1 with ICallTreeNode

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

the class CallTreeLabelProvider 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) treeViewer.getInput();
    if (cpuModel == null) {
        //$NON-NLS-1$
        return "";
    }
    if (element instanceof ICallTreeNode) {
        long totalTime = ((ICallTreeNode) element).getSelfTime();
        int length = String.valueOf(cpuModel.getMaxSelfTime() * 1000).length();
        length = (length > 10) ? 10 : length;
        return getMillisecondsText(totalTime, length);
    }
    //$NON-NLS-1$
    return "";
}
Also used : ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 2 with ICallTreeNode

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

the class CallTreeLabelProvider method getTimeInMsColumnText.

/**
     * Gets the time in milliseconds column text.
     * 
     * @param element the element
     * @return the time column text
     */
private String getTimeInMsColumnText(Object element) {
    ICpuModel cpuModel = (ICpuModel) treeViewer.getInput();
    if (cpuModel == null) {
        //$NON-NLS-1$
        return "";
    }
    int length = String.valueOf(cpuModel.getMaxTotalTime() * 1000).length();
    length = (length > 10) ? 10 : length;
    if (element instanceof IThreadNode) {
        String milliseconds = getMillisecondsText(((IThreadNode) element).getTotalTime(), length);
        return milliseconds;
    } else if (element instanceof ICallTreeNode) {
        long totalTime = ((ICallTreeNode) element).getTotalTime();
        return getMillisecondsText(totalTime, length);
    }
    //$NON-NLS-1$
    return "";
}
Also used : IThreadNode(org.talend.designer.runtime.visualization.internal.core.cpu.IThreadNode) ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Example 3 with ICallTreeNode

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

the class CallTreeTabPage method refreshContentDescription.

/**
     * Refreshes the content description.
     */
private void refreshContentDescription() {
    if (jvm == null) {
        return;
    }
    ICallTreeNode focusedNode = jvm.getCpuProfiler().getCpuModel().getFocusTarget();
    StringBuilder description = new StringBuilder();
    if (focusedNode != null) {
        description.append(NLS.bind(Messages.focusTargetIndicator, focusedNode.getNonqualifiedName())).append(NLS.bind(Messages.threadIndicator, focusedNode.getThread()));
    }
    setContentDescription(description.toString());
}
Also used : ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode)

Example 4 with ICallTreeNode

use of org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode 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 ICallTreeNode

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

the class FocusOnAction method aboutToShow.

/**
     * Notifies when menu is about to be shown.
     */
public void aboutToShow() {
    ICpuModel cpuModel = (ICpuModel) filteredTree.getViewer().getInput();
    boolean focused = cpuModel.getFocusTarget() != null;
    setChecked(focused);
    Object element = ((TreeSelection) filteredTree.getViewer().getSelection()).getFirstElement();
    // frame is selected on call tree
    if (element instanceof ICallTreeNode) {
        selectedNode = (ICallTreeNode) element;
        setEnabled(true);
        if (!focused) {
            updateMenu();
        }
        return;
    }
    if (filteredTree.getViewerType() == ViewerType.CallTree) {
        // thread node is selected on call tree
        selectedNode = null;
    } else {
        selectedNode = cpuModel.getFocusTarget();
    }
    setEnabled(focused);
    updateMenu();
}
Also used : ICallTreeNode(org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)

Aggregations

ICallTreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode)7 ICpuModel (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)4 IMethodNode (org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 IThreadNode (org.talend.designer.runtime.visualization.internal.core.cpu.IThreadNode)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