Search in sources :

Example 1 with CpuDumpParser

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
            }
        }
    }
}
Also used : CpuDumpParser(org.talend.designer.runtime.visualization.core.dump.CpuDumpParser) ByteArrayInputStream(java.io.ByteArrayInputStream) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) IOException(java.io.IOException) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException) SAXException(org.xml.sax.SAXException)

Example 2 with CpuDumpParser

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();
}
Also used : CpuDumpParser(org.talend.designer.runtime.visualization.core.dump.CpuDumpParser) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) IOException(java.io.IOException) Job(org.eclipse.core.runtime.jobs.Job) File(java.io.File) SAXException(org.xml.sax.SAXException)

Aggregations

IOException (java.io.IOException)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 CpuDumpParser (org.talend.designer.runtime.visualization.core.dump.CpuDumpParser)2 SAXException (org.xml.sax.SAXException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Job (org.eclipse.core.runtime.jobs.Job)1 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)1