Search in sources :

Example 1 with ICpuModel

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

the class CpuDumpEditor method createHotSpotsPage.

/**
     * Creates the hot spots page.
     */
private void createHotSpotsPage() {
    Composite panel = new Composite(getContainer(), SWT.NONE);
    panel.setLayout(new FillLayout());
    final HotSpotsFilteredTree hotSpotsFilteredTree = new HotSpotsFilteredTree(panel, getEditorSite().getActionBars());
    TreeViewer hotSpotsViewer = hotSpotsFilteredTree.getViewer();
    hotSpotsViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getHotSpotRoots();
            }
            return new Object[0];
        }
    });
    hotSpotsViewer.setLabelProvider(new HotSpotsLabelProvider(hotSpotsFilteredTree));
    hotSpotsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            hotSpotsFilteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    hotSpotsViewer.setUseHashlookup(true);
    hotSpotsViewer.setInput(cpuModel);
    hotSpotsFilteredTree.sortColumn(hotSpotsViewer.getTree().getColumn(1));
    int page = addPage(panel);
    trees.put(hotSpotsFilteredTree, page);
    setPageText(page, Messages.hotSpotsPageLabel);
    setPageImage(page, getHotSpotsImage());
}
Also used : Composite(org.eclipse.swt.widgets.Composite) HotSpotsFilteredTree(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsFilteredTree) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) HotSpotsLabelProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) AbstractContentProvider(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractContentProvider)

Example 2 with ICpuModel

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

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

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

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

the class HotSpotsTabPage method createHotSpotsViewer.

/**
     * Creates the hot spots viewer.
     * 
     * @param composite The parent composite
     * @param propertySheet The property sheet
     */
private void createHotSpotsViewer(Composite composite, PropertySheet propertySheet) {
    filteredTree = new HotSpotsFilteredTree(composite, propertySheet.getViewSite().getActionBars()) {

        @Override
        protected void addMenus(IMenuManager manager) {
            manager.add(new Separator());
            manager.add(new ConfigureCpuProfilerAction(cpuSection));
        }
    };
    TreeViewer hotSpotsViewer = filteredTree.getViewer();
    hotSpotsViewer.setContentProvider(new AbstractContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof ICpuModel) {
                return ((ICpuModel) inputElement).getHotSpotRoots();
            }
            return new Object[0];
        }
    });
    hotSpotsViewer.setLabelProvider(new HotSpotsLabelProvider(filteredTree));
    hotSpotsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            filteredTree.updateStatusLine((IStructuredSelection) event.getSelection());
        }
    });
    filteredTree.sortColumn(hotSpotsViewer.getTree().getColumn(1));
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICpuModel(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel) ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Aggregations

ICpuModel (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuModel)14 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 ICallTreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ICallTreeNode)4 IMenuManager (org.eclipse.jface.action.IMenuManager)3 Separator (org.eclipse.jface.action.Separator)3 AbstractContentProvider (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractContentProvider)3 HotSpotsFilteredTree (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsFilteredTree)3 HotSpotsLabelProvider (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.HotSpotsLabelProvider)3 ConfigureCpuProfilerAction (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction)3 IMethodNode (org.talend.designer.runtime.visualization.internal.core.cpu.IMethodNode)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 IThreadNode (org.talend.designer.runtime.visualization.internal.core.cpu.IThreadNode)1 ITreeNode (org.talend.designer.runtime.visualization.internal.core.cpu.ITreeNode)1 ViewerType (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.AbstractFilteredTree.ViewerType)1