懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 package com.jcdm.framework.web.domain.server;
2
3 import com.jcdm.common.utils.Arith;
4
5 /**
6  * 內存相关信息
7  * 
8  * @author jc
9  */
10 public class Mem
11 {
12     /**
13      * 内存总量
14      */
15     private double total;
16
17     /**
18      * 已用内存
19      */
20     private double used;
21
22     /**
23      * 剩余内存
24      */
25     private double free;
26
27     public double getTotal()
28     {
29         return Arith.div(total, (1024 * 1024 * 1024), 2);
30     }
31
32     public void setTotal(long total)
33     {
34         this.total = total;
35     }
36
37     public double getUsed()
38     {
39         return Arith.div(used, (1024 * 1024 * 1024), 2);
40     }
41
42     public void setUsed(long used)
43     {
44         this.used = used;
45     }
46
47     public double getFree()
48     {
49         return Arith.div(free, (1024 * 1024 * 1024), 2);
50     }
51
52     public void setFree(long free)
53     {
54         this.free = free;
55     }
56
57     public double getUsage()
58     {
59         return Arith.mul(Arith.div(used, total, 4), 100);
60     }
61 }