Package org.github.jamm.listeners
Class TreePrinter
java.lang.Object
org.github.jamm.listeners.TreePrinter
- All Implemented Interfaces:
MemoryMeterListener
A memory listener that print to the
System.out
the class tree with the size information.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Factory forTreePrinter
instances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
arrayElementAdded
(Object[] array, int index, Object elementValue) Notification that the element from the specified array has been added.void
byteBufferRemainingMeasured
(ByteBuffer buffer, long size) Notification that the size of the remaining bytes of aByteBuffer
have been measured.void
done
(long size) Notification that the entire graph has been measured.void
failedToAccessField
(Object obj, String fieldName, Class<?> fieldType) Notification that the graph could not be fully measured has it failed to access a field.void
fieldAdded
(Object obj, String fieldName, Object fieldValue) Notification that the field from the specified object has been added.void
objectMeasured
(Object current, long size) Notification that the size of the specified object has been measured.void
Notification thatMemoryMeter
as started analyzing the specified object.
-
Constructor Details
-
TreePrinter
public TreePrinter(int maxDepth)
-
-
Method Details
-
started
Description copied from interface:MemoryMeterListener
Notification thatMemoryMeter
as started analyzing the specified object.- Specified by:
started
in interfaceMemoryMeterListener
- Parameters:
obj
- the object being analyzed
-
fieldAdded
Description copied from interface:MemoryMeterListener
Notification that the field from the specified object has been added.- Specified by:
fieldAdded
in interfaceMemoryMeterListener
- Parameters:
obj
- the object for which a field has been addedfieldName
- the field namefieldValue
- the field value
-
arrayElementAdded
Description copied from interface:MemoryMeterListener
Notification that the element from the specified array has been added.- Specified by:
arrayElementAdded
in interfaceMemoryMeterListener
- Parameters:
array
- the array for which an element has been addedindex
- the element indexelementValue
- the element value
-
objectMeasured
Description copied from interface:MemoryMeterListener
Notification that the size of the specified object has been measured.- Specified by:
objectMeasured
in interfaceMemoryMeterListener
- Parameters:
current
- the object that has been measuredsize
- the object size in bytes
-
byteBufferRemainingMeasured
Description copied from interface:MemoryMeterListener
Notification that the size of the remaining bytes of aByteBuffer
have been measured.- Specified by:
byteBufferRemainingMeasured
in interfaceMemoryMeterListener
- Parameters:
buffer
- theByteBuffer
size
- the remaining bytes
-
done
public void done(long size) Description copied from interface:MemoryMeterListener
Notification that the entire graph has been measured.- Specified by:
done
in interfaceMemoryMeterListener
- Parameters:
size
- the size of the entire graph.
-
failedToAccessField
Description copied from interface:MemoryMeterListener
Notification that the graph could not be fully measured has it failed to access a field.- Specified by:
failedToAccessField
in interfaceMemoryMeterListener
- Parameters:
obj
- the object owning the field that could not be accessedfieldName
- the field namefieldType
- the field type
-