package org.lex.perf.sensor;


import org.lex.perf.api.factory.IndexSeries;
import org.lex.perf.api.factory.IndexType;
import org.lex.perf.api.index.GaugeIndex;
import org.lex.perf.api.index.GaugeSensorImpl;

import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.math.BigDecimal;

/**
 */
public class CPUSensor extends GaugeSensorImpl {

    @Override
    public BigDecimal[] getValues() {
        BigDecimal[] result = new BigDecimal[1];
        final OperatingSystemMXBean operatingSystem = ManagementFactory.getOperatingSystemMXBean();
        if (operatingSystem.getSystemLoadAverage() >= 0) {
            result[0] = new BigDecimal(operatingSystem.getSystemLoadAverage());
        } else {
            result[0] = BigDecimal.ZERO;
        }
        return result;
    }

    @Override
    public String[] getItems() {
        return new String[]{"CPU"};
    }

    @Override
    public String getName() {
        return "CPU";
    }
}

@@ -31,141 +31,8 @@
 %0D%0A%0D%0A
-import org.lex.perf.api.factory.IndexSeries;%0D%0Aimport org.lex.perf.api.factory.IndexType;%0D%0Aimport org.lex.perf.api.index.GaugeIndex;%0D%0A
 impo
@@ -559,20 +559,16 @@
 ult%5B0%5D =
- new
  BigDeci
@@ -570,16 +570,24 @@
 gDecimal
+.valueOf
 (operati

fix errors