FileDocCategorySizeDatePackage
ClassStatistics.javaAPI DocphoneME MR2 API (J2ME)2685Wed May 02 17:59:48 BST 2007com.sun.cldchi.tools.memoryprofiler.data

ClassStatistics

public class ClassStatistics extends Object
This class is container for all statististics for a Java Class. It provides the following information: number of objects, total size of all object of the class, percentage of live objects, percentage of old generation objects
see
com.sun.cldchi.tools.memoryprofiler.data.MPDataProvider

Fields Summary
public final String
_class_name
private int
_count
private int
_total_size
private static int
_total_heap_size
private int
_dead_size
private int
_old_gen_size
Constructors Summary
public ClassStatistics(String class_name)

    _class_name = class_name;
    _count = _total_size = _dead_size = _old_gen_size = 0;
  
Methods Summary
public voidadd(JavaObject obj, int old_gen_end)

    _total_heap_size += obj.size;
    _count++;
    _total_size += obj.size;
    if (!obj.alive()) {
      _dead_size += obj.size;
    }
    if (obj.address < old_gen_end) {
      _old_gen_size += obj.size;
    }
  
public intgetAverageSize()

    if (_count== 0) return 0;
    return _total_size / _count;
  
public intgetCount()

return _count;
public intgetHeapPercentage()

    if (_total_heap_size == 0) return 0;
    return (10000*_total_size) / _total_heap_size;
  
public intgetLivePercentage()

    if (_total_size == 0) return 0;
    return (10000*(_total_size - _dead_size)) / _total_size;
  
public intgetOldGenPercentage()

    if (_total_size == 0) return 0;
    return (10000*_old_gen_size) / _total_size;
  
public intgetTotalSize()

return _total_size;
public static voidreset()

    _total_heap_size= 0;