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