}
memory.start();
cpu = new CPU(config, SystemWatchID.PROC_CPU, true);
ProcessCPUHandler cpuMonitor = (ProcessCPUHandler)cpu.getMeasurableMonitor();
cpuMonitor.setPID(pidToUse);
OperatingSystemMXBean opSys =
getPlatformMXBeanProxy(mbsc,
ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
OperatingSystemMXBean.class);
cpuMonitor.setMXBean(opSys);
RuntimeMXBean runtime =
getPlatformMXBeanProxy(mbsc,
ManagementFactory.RUNTIME_MXBEAN_NAME,
RuntimeMXBean.class);
cpuMonitor.setStartTime(runtime.getStartTime());
cpu.start();
context.getWatchRegistry().register(memory, cpu);
}
}