From 2b8ab9cc4d538e2f02e6882b0bfa7934ae7bdbb4 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期五, 12 三月 2021 18:02:23 +0800 Subject: [PATCH] update 使用hutool重写系统监控 --- ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java | 189 ++++++++++++++++++++++------------------------- 1 files changed, 88 insertions(+), 101 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java index cf7b46e..4295f6e 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java @@ -1,101 +1,88 @@ -package com.ruoyi.framework.web.domain.server; - -import com.ruoyi.common.utils.Arith; - -/** - * CPU鐩稿叧淇℃伅 - * - * @author ruoyi - */ -public class Cpu -{ - /** - * 鏍稿績鏁� - */ - private int cpuNum; - - /** - * CPU鎬荤殑浣跨敤鐜� - */ - private double total; - - /** - * CPU绯荤粺浣跨敤鐜� - */ - private double sys; - - /** - * CPU鐢ㄦ埛浣跨敤鐜� - */ - private double used; - - /** - * CPU褰撳墠绛夊緟鐜� - */ - private double wait; - - /** - * CPU褰撳墠绌洪棽鐜� - */ - private double free; - - public int getCpuNum() - { - return cpuNum; - } - - public void setCpuNum(int cpuNum) - { - this.cpuNum = cpuNum; - } - - public double getTotal() - { - return Arith.round(Arith.mul(total, 100), 2); - } - - public void setTotal(double total) - { - this.total = total; - } - - public double getSys() - { - return Arith.round(Arith.mul(sys / total, 100), 2); - } - - public void setSys(double sys) - { - this.sys = sys; - } - - public double getUsed() - { - return Arith.round(Arith.mul(used / total, 100), 2); - } - - public void setUsed(double used) - { - this.used = used; - } - - public double getWait() - { - return Arith.round(Arith.mul(wait / total, 100), 2); - } - - public void setWait(double wait) - { - this.wait = wait; - } - - public double getFree() - { - return Arith.round(Arith.mul(free / total, 100), 2); - } - - public void setFree(double free) - { - this.free = free; - } -} +package com.ruoyi.framework.web.domain.server; + +import cn.hutool.core.util.NumberUtil; + +/** + * CPU鐩稿叧淇℃伅 + * + * @author ruoyi + */ +public class Cpu { + /** + * 鏍稿績鏁� + */ + private int cpuNum; + + /** + * CPU鎬荤殑浣跨敤鐜� + */ + private double total; + + /** + * CPU绯荤粺浣跨敤鐜� + */ + private double sys; + + /** + * CPU鐢ㄦ埛浣跨敤鐜� + */ + private double used; + + /** + * CPU褰撳墠绛夊緟鐜� + */ + private double wait; + + /** + * CPU褰撳墠绌洪棽鐜� + */ + private double free; + + public int getCpuNum() { + return cpuNum; + } + + public void setCpuNum(int cpuNum) { + this.cpuNum = cpuNum; + } + + public double getTotal() { + return NumberUtil.round(NumberUtil.mul(total, 100), 2).doubleValue(); + } + + public void setTotal(double total) { + this.total = total; + } + + public double getSys() { + return NumberUtil.round(NumberUtil.mul(sys / total, 100), 2).doubleValue(); + } + + public void setSys(double sys) { + this.sys = sys; + } + + public double getUsed() { + return NumberUtil.round(NumberUtil.mul(used / total, 100), 2).doubleValue(); + } + + public void setUsed(double used) { + this.used = used; + } + + public double getWait() { + return NumberUtil.round(NumberUtil.mul(wait / total, 100), 2).doubleValue(); + } + + public void setWait(double wait) { + this.wait = wait; + } + + public double getFree() { + return NumberUtil.round(NumberUtil.mul(free / total, 100), 2).doubleValue(); + } + + public void setFree(double free) { + this.free = free; + } +} -- Gitblit v1.9.3