首页>代码>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;
    }
}
最近下载更多
dcdc12  LV6 2023年12月18日
最代码官方  LV167 2023年3月18日
最近浏览更多
chengjun  LV10 1月10日
zhaozhiqi  LV5 2023年10月10日
漫步的海星  LV4 2023年9月21日
陆程江  LV2 2023年5月29日
neuwxr2015  LV8 2023年5月29日
best2018  LV46 2023年4月11日
zhuiqiu  LV4 2023年4月6日
dawang  LV2 2023年4月6日
欠踹de背影  LV25 2023年4月6日
444105047  LV6 2023年4月4日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友