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();
}
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;
}
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);
}
}
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;
}
Aggregations