Search in sources :

Example 1 with CpuSection

use of org.talend.designer.runtime.visualization.internal.ui.properties.cpu.CpuSection in project tdi-studio-se by Talend.

the class ConfigureCpuProfilerAction method doConfigure.

/**
     * Configures the profiler.
     * 
     * @param monitor The progress monitor
     * @param dialog The configuration dialog
     * @return The status
     */
IStatus doConfigure(IProgressMonitor monitor, ConfigurationDialog dialog) {
    IActiveJvm jvm = cpuSection.getJvm();
    if (jvm == null) {
        return Status.CANCEL_STATUS;
    }
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(CpuSection.class.getName());
    ProfilerType type = dialog.getProfilerType();
    if (jvm.getCpuProfiler().getProfilerType() != type) {
        if (jvm.getCpuProfiler().getState() == ProfilerState.RUNNING) {
            new SuspendCpuProfilingAction(cpuSection).run();
        }
        new ClearCpuProfilingDataAction(cpuSection).run();
        jvm.getCpuProfiler().setProfilerType(type);
    }
    if (type == ProfilerType.SAMPLING) {
        int samplingPeriod = dialog.getSamplingPeriod();
        jvm.getCpuProfiler().setSamplingPeriod(samplingPeriod);
        dialogSettings.put(IConstants.PROFILER_SAMPLING_PERIOD_KEY, samplingPeriod);
    }
    String packageString = setPackages(dialog.getPackages(), monitor);
    dialogSettings.put(IConstants.PACKAGES_KEY, packageString);
    dialogSettings.put(IConstants.PROFILER_TYPE_KEY, type.name());
    return Status.OK_STATUS;
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) CpuSection(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.CpuSection) ProfilerType(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerType)

Aggregations

IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 IActiveJvm (org.talend.designer.runtime.visualization.IActiveJvm)1 ProfilerType (org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerType)1 CpuSection (org.talend.designer.runtime.visualization.internal.ui.properties.cpu.CpuSection)1