首页>代码>spring boot集成oshi极简入门实例>/springboot-oshi/src/main/java/com/simon/springbootoshi/domain/Cpu.java
package com.simon.springbootoshi.domain;
import com.simon.springbootoshi.util.MathUtils;
/**
* CPU相关信息
*
* @author Simon
*/
public class Cpu {
/**
* 核心数
*/
private int cpuLogicalNum;
private int cpuPhysicalNum;
/**
* CPU总的使用率
*/
private double total;
/**
* CPU系统使用率
*/
private double sys;
/**
* CPU用户使用率
*/
private double used;
/**
* CPU当前等待率
*/
private double wait;
/**
* CPU当前空闲率
*/
private double free;
public int getCpuLogicalNum() {
return cpuLogicalNum;
}
public void setCpuLogicalNum(int cpuLogicalNum) {
this.cpuLogicalNum = cpuLogicalNum;
}
public int getCpuPhysicalNum() {
return cpuPhysicalNum;
}
public void setCpuPhysicalNum(int cpuPhysicalNum) {
this.cpuPhysicalNum = cpuPhysicalNum;
}
public double getTotal() {
return MathUtils.round(MathUtils.mul(total, 100), 2);
}
public void setTotal(double total) {
this.total = total;
}
public double getSys() {
return MathUtils.round(MathUtils.mul(sys / total, 100), 2);
}
public void setSys(double sys) {
this.sys = sys;
}
public double getUsed() {
return MathUtils.round(MathUtils.mul(used / total, 100), 2);
}
public void setUsed(double used) {
this.used = used;
}
public double getWait() {
return MathUtils.round(MathUtils.mul(wait / total, 100), 2);
}
public void setWait(double wait) {
this.wait = wait;
}
public double getFree() {
return MathUtils.round(MathUtils.mul(free / total, 100), 2);
}
public void setFree(double free) {
this.free = free;
}
}

最近下载
最近浏览