9.4.2 Class-wise statistical information output by the instance statistical functionality
This subsection describes about the output format, the output items, and the output examples of the class-wise statistical information output by the instance statistical functionality.
- Organization of this subsection
(1) Output format and output items
The output format of the class-wise statistical information output by the instance statistical functionality is as follows:
-
Output format
Java Heap Profile ----------------------- ________________Size__Instances__Class________________ <total_size> <Instance_count> <class_name> <total_size> <Instance_count> <class_name> ...
-
Output items
The items listed in the output format are described as follows.
Table 9‒6: Output items (instance statistical functionality) Output items
Meaning
<total_size>
The total size of the instance is output in byte unit.
<Instance_count>
The number of instance is output.
<class_name>
The class name is output.
(2) Example of output
The output example of the class-wise statistical information output by the instance statistical functionality is described as the example of the following source.
public class instance {
public static void main(String args[]) {
classA cls_a = new classA();
try {
Thread.sleep(20000);
} catch (Exception e) {}
}
}
class classA {
classB a1;
classC a2;
classA() {
a1 = new classB();
a2 = new classC();
}
}
class classB {
classD b1;
String b2;
classB() {
b1 = new classD();
b2 = null;
}
}
class classC {
String c1, c2;
classC() {
c1 = null;
c2 = null;
}
}
class classD {
String d1, d2;
classD() {
d1 = null;
d2 = null;
}
}The following figure shows the instance structure for above source.
|
|
When using the above instance structure, add the following size for each class in the instance statistical functionality:
-
Size of class A: a1+a2+ b1+b2+ c1+c2+ d1+d2
-
Size of class B: b1+b2+ d1+d2
-
Size of class C: c1+c2
-
Size of class D: d1+d2
The following figure shows the output result of the instance statistical functionality.
|
|