anthill.util
Class Analyzer

java.lang.Object
  |
  +--anthill.util.Analyzer

public final class Analyzer
extends 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: 1.4 $
Author:
Alberto Montresor

Constructor Summary
Analyzer()
           
 
Method Summary
static Collection countClasses(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(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 String printClasses(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
 

Constructor Detail

Analyzer

public Analyzer()
Method Detail

footprint

public static int footprint(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 Collection countClasses(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 String printClasses(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.