class CpuMetricsCaptor implements Runnable {

    private double currProcessCpuUsage = -1;

    private long prevProcessCpuTime = 0;

    private long prevUpTime = 0;

    public double getProcessCpuUsage() {
        return currProcessCpuUsage;
    }

    @Override
    public void run() {<FILL_FUNCTION_BODY>}
}

        try {
            OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
            int cpuCores = osBean.getAvailableProcessors();

            long newProcessCpuTime = OperatingSystemBeanManager.getProcessCpuTime();
            RuntimeMXBean runtimeBean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
            long newUpTime = runtimeBean.getUptime();
            long elapsedCpu = TimeUnit.NANOSECONDS.toMillis(newProcessCpuTime - prevProcessCpuTime);
            long elapsedTime = newUpTime - prevUpTime;
            double processCpuUsage = (double) elapsedCpu / elapsedTime / cpuCores;
            prevProcessCpuTime = newProcessCpuTime;
            prevUpTime = newUpTime;
            currProcessCpuUsage = processCpuUsage;
        } catch (Throwable e) {
            log.error("Get system metrics error.", e);
        }
    
<no_super_class>