use of org.talend.designer.runtime.visualization.core.dump.CpuDumpParser in project tdi-studio-se by Talend.
the class CpuProfiler method refreshBciProfileCache.
/*
* @see ICpuProfiler#refreshBciProfileCache(IProgressMonitor)
*/
@Override
public void refreshBciProfileCache(IProgressMonitor monitor) throws JvmCoreException {
if (type != ProfilerType.BCI) {
return;
}
validateAgent();
if (!isBciProfilerRunning()) {
return;
}
String dumpString = (String) invokeCpuProfilerMXBeanMethod(DUMP, null, null);
if (dumpString == null) {
return;
}
ByteArrayInputStream input = null;
try {
input = new ByteArrayInputStream(dumpString.getBytes());
CpuDumpParser parser = new CpuDumpParser(input, cpuModel, monitor);
parser.parse();
} catch (ParserConfigurationException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.parseCpuDumpFailedMsg, e);
} catch (SAXException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.parseCpuDumpFailedMsg, e);
} catch (IOException e) {
throw new JvmCoreException(IStatus.ERROR, Messages.parseCpuDumpFailedMsg, e);
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
// do nothing
}
}
}
}
use of org.talend.designer.runtime.visualization.core.dump.CpuDumpParser in project tdi-studio-se by Talend.
the class CpuDumpEditor method loadDumpFile.
/**
* Loads the dump file.
*
* @param filePath The file path
*/
private void loadDumpFile(final String filePath) {
Job job = new Job(Messages.parseCpuDumpFileJobLabel) {
@Override
protected IStatus run(IProgressMonitor monitor) {
CpuDumpParser parser = new CpuDumpParser(new File(filePath), cpuModel, monitor);
try {
parser.parse();
} catch (ParserConfigurationException e) {
//$NON-NLS-1$
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not load CPU dump file.", e);
} catch (SAXException e) {
//$NON-NLS-1$
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not load CPU dump file.", e);
} catch (IOException e) {
//$NON-NLS-1$
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not load CPU dump file.", e);
}
setProfileInfo(parser.getProfileInfo());
return Status.OK_STATUS;
}
};
job.schedule();
}
Aggregations