首页>代码>spring boot集成oshi极简入门实例>/springboot-oshi/src/main/java/com/simon/springbootoshi/domain/Mem.java
package com.simon.springbootoshi.domain;

import com.simon.springbootoshi.util.MathUtils;

/**
 * 內存相关信息
 *
 * @author Simon
 */
public class Mem {
    /**
     * 内存总量
     */
    private double total;

    /**
     * 已用内存
     */
    private double used;

    /**
     * 剩余内存
     */
    private double free;

    public double getTotal() {
        return MathUtils.div(total, (1024 * 1024 * 1024), 2);
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public double getUsed() {
        return MathUtils.div(used, (1024 * 1024 * 1024), 2);
    }

    public void setUsed(long used) {
        this.used = used;
    }

    public double getFree() {
        return MathUtils.div(free, (1024 * 1024 * 1024), 2);
    }

    public void setFree(long free) {
        this.free = free;
    }

    public double getUsage() {
        return MathUtils.mul(MathUtils.div(used, total, 4), 100);
    }
}
最近下载更多
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日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友