Package gw.util.perf.objectsize
Class ObjectSizeUtil
java.lang.Object
gw.util.perf.objectsize.ObjectSizeUtil
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static DecimalFormatprivate static final IObjectSizeFilterprivate static final Stringprivate static final Mapstatic boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectSizedeepSizeOf(Object obj) static ObjectSizedeepSizeOf(Object obj, IObjectSizeFilter filter, int maxObjects) Calculates full size of object iterating over its hierarchy graph.private static longstatic intgetFieldSize(Class clazz) static intprivate static longinternalSizeOf(ObjectSizeUtil.ObjectEntry entry, Stack<ObjectSizeUtil.ObjectEntry> stack, Map<Object, Object> visited, IObjectSizeFilter filter, String indent) static voidprivate static longroundUpToNearestEightBytes(long result) private static booleanskipField(Field field, IObjectSizeFilter filter) private static booleanskipObject(Object obj, Map<Object, Object> visited, IObjectSizeFilter filter)
-
Field Details
-
VERBOSE
public static boolean VERBOSE -
INDENT
- See Also:
-
DEFAULT_FILTER
-
decimalFormat
-
primitiveSizes
-
-
Constructor Details
-
ObjectSizeUtil
public ObjectSizeUtil()
-
-
Method Details
-
getFieldSize
-
getPointerSize
public static int getPointerSize() -
deepSizeOf
Calculates full size of object iterating over its hierarchy graph.- Parameters:
obj- object to calculate size offilter- the filter used to ignore fields or objectsmaxObjects- the max numbers of objects to traverse- Returns:
- object size
- Throws:
Exception
-
deepSizeOf
-
skipObject
-
skipField
-
getArrayShallowSize
-
internalSizeOf
private static long internalSizeOf(ObjectSizeUtil.ObjectEntry entry, Stack<ObjectSizeUtil.ObjectEntry> stack, Map<Object, Object> visited, IObjectSizeFilter filter, String indent) -
roundUpToNearestEightBytes
private static long roundUpToNearestEightBytes(long result) -
main
- Throws:
Exception
-