Search in sources :

Example 1 with ProfilerType

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

Example 2 with ProfilerType

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);
}
Also used : IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) ProfilerType(org.talend.designer.runtime.visualization.internal.core.cpu.ICpuProfiler.ProfilerType)

Aggregations

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