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