Search in sources :

Example 1 with IHeapElement

use of org.talend.designer.runtime.visualization.IHeapElement in project tdi-studio-se by Talend.

the class HeapDumpEditor method createMemoryPage.

/**
     * Creates the memory page.
     */
private void createMemoryPage() {
    heapHistogramPage = new HeapHistogramPage(getContainer(), getEditorSite().getActionBars());
    heapHistogramPage.setInput(new IHeapInput() {

        @Override
        public IHeapElement[] getHeapListElements() {
            return heapListElements.toArray(new IHeapElement[0]);
        }
    });
    int page = addPage(heapHistogramPage);
    setPageText(page, Messages.memoryTabLabel);
    setPageImage(page, getMemoryImage());
    heapHistogramPage.refresh();
}
Also used : IHeapElement(org.talend.designer.runtime.visualization.IHeapElement) HeapHistogramPage(org.talend.designer.runtime.visualization.internal.ui.properties.memory.HeapHistogramPage) IHeapInput(org.talend.designer.runtime.visualization.internal.ui.properties.memory.IHeapInput)

Example 2 with IHeapElement

use of org.talend.designer.runtime.visualization.IHeapElement in project tdi-studio-se by Talend.

the class MBeanServer method getHeapCache.

/*
     * @see IMBeanServer#getHeapCache()
     */
@Override
public IHeapElement[] getHeapCache() {
    IHeapElement[] result = new IHeapElement[heapListElements.size()];
    int i = 0;
    for (HeapElement heapElement : heapListElements.values()) {
        result[i++] = heapElement;
    }
    return result;
}
Also used : IHeapElement(org.talend.designer.runtime.visualization.IHeapElement) IHeapElement(org.talend.designer.runtime.visualization.IHeapElement)

Example 3 with IHeapElement

use of org.talend.designer.runtime.visualization.IHeapElement in project tdi-studio-se by Talend.

the class HeapDumpSaxEventHandler method startElement.

/*
     * @see DefaultHandler#startElement(String, String, String, Attributes)
     */
@Override
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
    if (monitor.isCanceled()) {
        throw new OperationCanceledException();
    }
    // memory-profile
    if ("heap-profile".equals(name)) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        String date = attributes.getValue("date");
        //$NON-NLS-1$
        String runtime = attributes.getValue("runtime");
        //$NON-NLS-1$
        String mainClass = attributes.getValue("mainClass");
        //$NON-NLS-1$
        String arguments = attributes.getValue("arguments");
        //$NON-NLS-1$
        String comments = attributes.getValue("comments");
        info = new ProfileInfo(date, runtime, mainClass, arguments, comments);
    }
    // class
    if ("class".equals(name)) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        String className = attributes.getValue("name");
        //$NON-NLS-1$
        String size = attributes.getValue("size");
        //$NON-NLS-1$
        String count = attributes.getValue("count");
        //$NON-NLS-1$
        String baseSize = attributes.getValue("baseSize");
        HeapElement element = new HeapElement(className, Long.parseLong(size), Long.parseLong(count), Long.parseLong(baseSize));
        heapListElements.add((IHeapElement) element);
    }
}
Also used : OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IHeapElement(org.talend.designer.runtime.visualization.IHeapElement) IProfileInfo(org.talend.designer.runtime.visualization.core.dump.IProfileInfo)

Example 4 with IHeapElement

use of org.talend.designer.runtime.visualization.IHeapElement in project tdi-studio-se by Talend.

the class HeapComparator method compare.

/*
     * @see ViewerComparator#compare(Viewer, Object, Object)
     */
@Override
public int compare(Viewer treeViewer, Object e1, Object e2) {
    int result = 0;
    if (!(e1 instanceof IHeapElement) || !(e2 instanceof IHeapElement) || !(treeViewer instanceof TreeViewer)) {
        return result;
    }
    IHeapElement element1 = (IHeapElement) e1;
    IHeapElement element2 = (IHeapElement) e2;
    Tree tree = ((TreeViewer) treeViewer).getTree();
    if (columnIndex == getColumnIndex(tree, HeapColumn.CLASS)) {
        result = super.compare(treeViewer, element1.getClassName(), element2.getClassName());
    } else if (columnIndex == getColumnIndex(tree, HeapColumn.SIZE)) {
        long size1 = element1.getSize();
        long size2 = element2.getSize();
        result = (size1 > size2) ? 1 : -1;
    } else if (columnIndex == getColumnIndex(tree, HeapColumn.COUNT)) {
        long count1 = element1.getCount();
        long count2 = element2.getCount();
        result = (count1 > count2) ? 1 : -1;
    } else if (columnIndex == getColumnIndex(tree, HeapColumn.DELTA)) {
        long delta1 = element1.getSize() - element1.getBaseSize();
        long delta2 = element2.getSize() - element2.getBaseSize();
        result = (delta1 > delta2) ? 1 : -1;
    }
    if (sortDirection == SWT.DOWN) {
        result *= -1;
    }
    return result;
}
Also used : IHeapElement(org.talend.designer.runtime.visualization.IHeapElement) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Tree(org.eclipse.swt.widgets.Tree)

Aggregations

IHeapElement (org.talend.designer.runtime.visualization.IHeapElement)4 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 Tree (org.eclipse.swt.widgets.Tree)1 IProfileInfo (org.talend.designer.runtime.visualization.core.dump.IProfileInfo)1 HeapHistogramPage (org.talend.designer.runtime.visualization.internal.ui.properties.memory.HeapHistogramPage)1 IHeapInput (org.talend.designer.runtime.visualization.internal.ui.properties.memory.IHeapInput)1