1
2
3
4
5
6
7
8
9
10
11 package psiprobe.model.jmx;
12
13 import java.util.Locale;
14
15
16
17
18 public class MemoryPool {
19
20
21 private String name;
22
23
24 private long init;
25
26
27 private long max;
28
29
30 private long used;
31
32
33 private long committed;
34
35
36 private String type;
37
38
39 private String id;
40
41
42
43
44
45
46 public String getName() {
47 return name;
48 }
49
50
51
52
53
54
55 public void setName(String name) {
56 this.name = name;
57 this.id = name != null ? name.replace(' ', '_').toLowerCase(Locale.ENGLISH) : null;
58 }
59
60
61
62
63
64
65 public long getInit() {
66 return init;
67 }
68
69
70
71
72
73
74 public void setInit(long init) {
75 this.init = init;
76 }
77
78
79
80
81
82
83 public long getMax() {
84 return max;
85 }
86
87
88
89
90
91
92 public void setMax(long max) {
93 this.max = max;
94 }
95
96
97
98
99
100
101 public long getUsed() {
102 return used;
103 }
104
105
106
107
108
109
110 public void setUsed(long used) {
111 this.used = used;
112 }
113
114
115
116
117
118
119 public long getCommitted() {
120 return committed;
121 }
122
123
124
125
126
127
128 public void setCommitted(long committed) {
129 this.committed = committed;
130 }
131
132
133
134
135
136
137 public String getType() {
138 return type;
139 }
140
141
142
143
144
145
146 public void setType(String type) {
147 this.type = type;
148 }
149
150
151
152
153
154
155 public int getUsageScore() {
156 long div;
157 if (max == -1) {
158
159
160
161
162 div = committed;
163 } else {
164 div = max;
165 }
166 return div == 0 ? 0 : (int) (used * 100 / div);
167 }
168
169
170
171
172
173
174 public String getId() {
175 return id;
176 }
177
178 }