1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package ohos.devtools.services.memory.agentbean; 17 18 import java.io.Serializable; 19 import java.util.Objects; 20 21 /** 22 * Memory Heap Info 23 * 24 * @since 2021/5/19 16:39 25 */ 26 public class MemoryHeapInfo implements Serializable { 27 private static final long serialVersionUID = -4742624779850639424L; 28 29 /** 30 * heapId 31 */ 32 private Integer id; 33 34 /** 35 * class Id 36 */ 37 private Integer cId; 38 39 /** 40 * heapId: app、zygote、image、JNI 41 */ 42 private Integer heapId; 43 44 /** 45 * this session Id 46 */ 47 private Long sessionId; 48 49 /** 50 * class Name 51 */ 52 private String className; 53 54 /** 55 * Number of instances created with call stack information 56 */ 57 private Integer allocations; 58 59 /** 60 * number Of Instances Destroyed 61 */ 62 private Integer deallocations; 63 64 /** 65 * The number of all instances in the heap memory (array length of the corresponding end) 66 */ 67 private Integer totalCount; 68 69 /** 70 * The total size of all instances in the heap memory (array lengthobject size at the corresponding end) 71 */ 72 private Long shallowSize; 73 74 /** 75 * createTime 76 */ 77 private Long createTime; 78 79 /** 80 * instance Id Obtained From The EndSide 81 */ 82 private Integer instanceId; 83 84 /** 85 * updateTime 86 */ 87 private long updateTime; 88 89 /** 90 * get instance Id 91 * 92 * @return Integer id 93 */ getId()94 public Integer getId() { 95 return id; 96 } 97 98 /** 99 * set instance Id 100 * 101 * @param id id 102 */ setId(Integer id)103 public void setId(Integer id) { 104 this.id = id; 105 } 106 107 /** 108 * get class Id 109 * 110 * @return Integer cId 111 */ getcId()112 public Integer getcId() { 113 return cId; 114 } 115 116 /** 117 * set class Id 118 * 119 * @param cId cId 120 */ setcId(Integer cId)121 public void setcId(Integer cId) { 122 this.cId = cId; 123 } 124 125 /** 126 * get Heap Id 127 * 128 * @return Integer heapId 129 */ getHeapId()130 public Integer getHeapId() { 131 return heapId; 132 } 133 134 /** 135 * get Session Id 136 * 137 * @return Long sessionId 138 */ getSessionId()139 public Long getSessionId() { 140 return sessionId; 141 } 142 143 /** 144 * set SessionId 145 * 146 * @param sessionId sessionId 147 */ setSessionId(Long sessionId)148 public void setSessionId(Long sessionId) { 149 this.sessionId = sessionId; 150 } 151 152 /** 153 * set HeapId 154 * 155 * @param heapId heapId 156 */ setHeapId(Integer heapId)157 public void setHeapId(Integer heapId) { 158 this.heapId = heapId; 159 } 160 161 /** 162 * get ClassName 163 * 164 * @return String 165 */ getClassName()166 public String getClassName() { 167 return className; 168 } 169 170 /** 171 * set ClassName 172 * 173 * @param className className 174 */ setClassName(String className)175 public void setClassName(String className) { 176 this.className = className; 177 } 178 179 /** 180 * get Allocations 181 * 182 * @return allocations 183 */ getAllocations()184 public Integer getAllocations() { 185 return allocations; 186 } 187 188 /** 189 * set Allocations 190 * 191 * @param allocations allocations 192 */ setAllocations(Integer allocations)193 public void setAllocations(Integer allocations) { 194 this.allocations = allocations; 195 } 196 197 /** 198 * get Deallocations 199 * 200 * @return deallocations 201 */ getDeallocations()202 public Integer getDeallocations() { 203 return deallocations; 204 } 205 206 /** 207 * set Deallocations 208 * 209 * @param deallocations deallocations 210 */ setDeallocations(Integer deallocations)211 public void setDeallocations(Integer deallocations) { 212 this.deallocations = deallocations; 213 } 214 215 /** 216 * get TotalCount 217 * 218 * @return totalCount 219 */ getTotalCount()220 public Integer getTotalCount() { 221 return totalCount; 222 } 223 224 /** 225 * set TotalCount 226 * 227 * @param totalCount totalCount 228 */ setTotalCount(Integer totalCount)229 public void setTotalCount(Integer totalCount) { 230 this.totalCount = totalCount; 231 } 232 233 /** 234 * get ShallowSize 235 * 236 * @return shallowSize 237 */ getShallowSize()238 public Long getShallowSize() { 239 return shallowSize; 240 } 241 242 /** 243 * set ShallowSize 244 * 245 * @param shallowSize shallowSize 246 */ setShallowSize(Long shallowSize)247 public void setShallowSize(Long shallowSize) { 248 this.shallowSize = shallowSize; 249 } 250 251 /** 252 * get CreateTime 253 * 254 * @return createTime 255 */ getCreateTime()256 public Long getCreateTime() { 257 return createTime; 258 } 259 260 /** 261 * set CreateTime 262 * 263 * @param createTime createTime 264 */ setCreateTime(Long createTime)265 public void setCreateTime(Long createTime) { 266 this.createTime = createTime; 267 } 268 269 /** 270 * get InstanceId 271 * 272 * @return instanceId 273 */ getInstanceId()274 public Integer getInstanceId() { 275 return instanceId; 276 } 277 278 /** 279 * set InstanceId 280 * 281 * @param instanceId instanceId 282 */ setInstanceId(Integer instanceId)283 public void setInstanceId(Integer instanceId) { 284 this.instanceId = instanceId; 285 } 286 287 /** 288 * get UpdateTime 289 * 290 * @return updateTime 291 */ getUpdateTime()292 public long getUpdateTime() { 293 return updateTime; 294 } 295 296 /** 297 * set UpdateTime 298 * 299 * @param updateTime updateTime 300 */ setUpdateTime(long updateTime)301 public void setUpdateTime(long updateTime) { 302 this.updateTime = updateTime; 303 } 304 305 @Override equals(Object obj)306 public boolean equals(Object obj) { 307 return super.equals(obj); 308 } 309 310 @Override clone()311 protected Object clone() throws CloneNotSupportedException { 312 return super.clone(); 313 } 314 315 @Override toString()316 public String toString() { 317 return "MemoryHeapInfo{" 318 + "id=" + id 319 + ", cId=" + cId 320 + ", heapId=" + heapId 321 + ", sessionId=" + sessionId 322 + ", className='" + className 323 + '\'' 324 + ", allocations=" + allocations 325 + ", deallocations=" + deallocations 326 + ", totalCount=" + totalCount 327 + ", shallowSize=" + shallowSize 328 + ", createTime=" + createTime 329 + ", instanceId=" + instanceId 330 + ", updateTime=" + updateTime 331 + '}'; 332 } 333 334 @Override hashCode()335 public int hashCode() { 336 return Objects.hash(id, cId, heapId, sessionId, className, allocations, deallocations, totalCount, shallowSize, 337 createTime, instanceId, updateTime); 338 } 339 } 340