ClassStatistics.javaAPI DocphoneME MR2 API (J2ME)2685Wed May 02 17:59:48 BST


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

Fields Summary
public final String
private int
private int
private static int
private int
private int
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;
    _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;