* @return profiler context, or null if controller cannot be created
*/
public static YourKitContext startProfile(boolean enableStackTelemetry,
boolean enableCPUProfilling,
boolean enableAllocationRecording) {
Controller controller;
try {
controller = new Controller();
// CHECKSTYLE: stop IllegalCatch
} catch (Exception e) {
// CHECKSTYLE: resume IllegalCatch
LOG.info("Failed to set up YourKit controller", e);
return null;
}
try {
if (enableStackTelemetry) {
controller.enableStackTelemetry();
LOG.info("Enabled Yourkit stack telemetry");
}
// CHECKSTYLE: stop IllegalCatch
} catch (Exception e) {
// CHECKSTYLE: resume IllegalCatch
LOG.info("Failed to enable YourKit stack telemetry", e);
}
try {
if (enableCPUProfilling) {
controller.startCPUProfiling(ProfilingModes.CPU_SAMPLING,
Controller.DEFAULT_FILTERS, Controller.DEFAULT_WALLTIME_SPEC);
LOG.info("Started YourKit CPU profiling");
}
// CHECKSTYLE: stop IllegalCatch
} catch (Exception e) {
// CHECKSTYLE: resume IllegalCatch
LOG.info("Failed to start YourKit CPU profiling", e);
}
try {
if (enableAllocationRecording) {
controller.startAllocationRecording(true, ALLOCATION_RECORDING_INTERVAL,
false, -1, true, false);
LOG.info("Started YourKit allocation recording");
}
// CHECKSTYLE: stop IllegalCatch
} catch (Exception e) {