All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.common.caching.statistics.customcounters.systemcounters.SystemCpuUsage Maven / Gradle / Ivy

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.alachisoft.ncache.common.caching.statistics.customcounters.systemcounters;

import org.hyperic.sigar.SigarException;

/**
 * @author Muneeb Shahid
 */
public class SystemCpuUsage extends SystemCounter {

    public SystemCpuUsage(String name, String instance) {
        super(name, instance);
    }

    @Override
    protected void calculate(double value) {
        try {
            if (getSigar() != null) {
                setValue(getSigar().getCpuPerc().getCombined() * 100);
            }
        } catch (SigarException sigarException) {
            //System.err.println(sigarException.getMessage());
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy