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.nativebean; 17 18 import ohos.devtools.views.layout.chartview.memory.nativehook.NativeHookTreeTableRenderer; 19 20 import java.util.Objects; 21 22 /** 23 * HookDataBean 24 * 25 * @since 2021/8/20 26 */ 27 public class HookDataBean { 28 private String hookMethodName; 29 private int hookAllocationCount; 30 private int hookDeAllocationCount; 31 private long hookAllocationMemorySize; 32 private long hookDeAllocationMemorySize; 33 private String hookModuleName = ""; 34 private NativeHookTreeTableRenderer.HookDataBeanEnum beanEnum; 35 private int containType = 0; // 0 OK 1 There are keywords 2 children there are keywords 3 there are no keywords 36 getHookMethodName()37 public String getHookMethodName() { 38 return hookMethodName; 39 } 40 setHookMethodName(String hookMethodName)41 public void setHookMethodName(String hookMethodName) { 42 this.hookMethodName = hookMethodName; 43 } 44 getHookAllocationCount()45 public int getHookAllocationCount() { 46 return hookAllocationCount; 47 } 48 setHookAllocationCount(int hookAllocationCount)49 public void setHookAllocationCount(int hookAllocationCount) { 50 this.hookAllocationCount = hookAllocationCount; 51 } 52 getHookDeAllocationCount()53 public int getHookDeAllocationCount() { 54 return hookDeAllocationCount; 55 } 56 setHookDeAllocationCount(int hookDeAllocationCount)57 public void setHookDeAllocationCount(int hookDeAllocationCount) { 58 this.hookDeAllocationCount = hookDeAllocationCount; 59 } 60 getHookAllocationMemorySize()61 public long getHookAllocationMemorySize() { 62 return hookAllocationMemorySize; 63 } 64 setHookAllocationMemorySize(long hookAllocationMemorySize)65 public void setHookAllocationMemorySize(long hookAllocationMemorySize) { 66 this.hookAllocationMemorySize = hookAllocationMemorySize; 67 } 68 getHookDeAllocationMemorySize()69 public long getHookDeAllocationMemorySize() { 70 return hookDeAllocationMemorySize; 71 } 72 setHookDeAllocationMemorySize(long hookDeAllocationMemorySize)73 public void setHookDeAllocationMemorySize(long hookDeAllocationMemorySize) { 74 this.hookDeAllocationMemorySize = hookDeAllocationMemorySize; 75 } 76 getHookModuleName()77 public String getHookModuleName() { 78 return hookModuleName; 79 } 80 setHookModuleName(String hookModuleName)81 public void setHookModuleName(String hookModuleName) { 82 this.hookModuleName = hookModuleName; 83 } 84 85 /** 86 * getTotalCount 87 * 88 * @return int 89 */ getTotalCount()90 public int getTotalCount() { 91 return getHookAllocationCount() - getHookDeAllocationCount(); 92 } 93 94 /** 95 * get Rea min Size 96 * 97 * @return long 98 */ getReaminSize()99 public long getReaminSize() { 100 return getHookAllocationMemorySize() - getHookDeAllocationMemorySize(); 101 } 102 getBeanEnum()103 public NativeHookTreeTableRenderer.HookDataBeanEnum getBeanEnum() { 104 return beanEnum; 105 } 106 setBeanEnum(NativeHookTreeTableRenderer.HookDataBeanEnum beanEnum)107 public void setBeanEnum(NativeHookTreeTableRenderer.HookDataBeanEnum beanEnum) { 108 this.beanEnum = beanEnum; 109 } 110 getContainType()111 public int getContainType() { 112 return containType; 113 } 114 setContainType(int containType)115 public void setContainType(int containType) { 116 this.containType = containType; 117 } 118 119 @Override equals(Object obj)120 public boolean equals(Object obj) { 121 return super.equals(obj); 122 } 123 124 @Override clone()125 protected Object clone() throws CloneNotSupportedException { 126 return super.clone(); 127 } 128 129 @Override toString()130 public String toString() { 131 return hookMethodName; 132 } 133 134 @Override hashCode()135 public int hashCode() { 136 return Objects.hash(hookMethodName, hookAllocationCount, hookDeAllocationCount, hookAllocationMemorySize, 137 hookDeAllocationMemorySize, hookModuleName, beanEnum, containType); 138 } 139 } 140