use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerType 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;
}
use of org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerType in project tdi-studio-se by Talend.
the class CpuSection method setProfilerType.
/**
* Sets the profiler type.
*/
void setProfilerType() {
IActiveJvm jvm = getJvm();
if (jvm == null) {
return;
}
ProfilerType type = null;
String typeString = Activator.getDefault().getDialogSettings(CpuSection.class.getName()).get(IConstants.PROFILER_TYPE_KEY);
if (typeString != null) {
for (ProfilerType profilerType : ProfilerType.values()) {
if (profilerType.name().equals(typeString)) {
type = profilerType;
break;
}
}
}
if (type == null) {
type = DEFAULT_PROFILER_TYPE;
}
jvm.getCpuProfiler().setProfilerType(type);
}
Aggregations