anthill.util
Class Analyzer
java.lang.Object
|
+--anthill.util.Analyzer
- public final class Analyzer
- extends java.lang.Object
This class can be used to analyze the memory footprint of an object
reference. Memory footprint is computed recursively, by adding the
memory footprint of the fields of the referenced object and the
memory footprint of the objects referenced by these objects.
Furthermore, this class can be used to obtain information about
the classes referenced (directly or indirectly) by an object and
the number of instances for each classes.
- Version:
- $Revision$
- Author:
- Alberto Montresor
Method Summary |
static java.util.Collection |
countClasses(java.lang.Object obj)
Returns a collection of InstanceCount objects, one for
each of the classes referenced (directly or indirectly)
by the specified object. |
static int |
footprint(java.lang.Object obj)
Returns the memory footprint of the specified object, computed
recursively by adding the footprint of the fields of the
object and the footprint of each of the objects referenced
by it. |
static java.lang.String |
printClasses(java.lang.Object obj)
Returns a string containing information about the classes
referenced (directly or indirectly) by the specified object
and the number of instances for each classes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Analyzer
public Analyzer()
footprint
public static int footprint(java.lang.Object obj)
- Returns the memory footprint of the specified object, computed
recursively by adding the footprint of the fields of the
object and the footprint of each of the objects referenced
by it.
countClasses
public static java.util.Collection countClasses(java.lang.Object obj)
- Returns a collection of
InstanceCount
objects, one for
each of the classes referenced (directly or indirectly)
by the specified object. InstanceCount
objects may
be used to obtain the number of instances for each of the
classes reference by the specified object.
printClasses
public static java.lang.String printClasses(java.lang.Object obj)
- Returns a string containing information about the classes
referenced (directly or indirectly) by the specified object
and the number of instances for each classes.