9.3.3 Outputting Statistic Information for Each Class
This subsection describes how to output the class-wise statistical information.
Use the jheapprof commands to output the class-wise statistical information to the extended thread dump. Specify the Java process, where you want to output the class-wise statistical information, and the class, where you want to output the reference-related information, and then execute the jheapprof commands.
You can specify the following when executing the jheapprof command:
-
Specify whether to output the information of an Explicit heap as class-wise statistical information.
-
Specify whether to execute the GC before acquiring the class-wise statistical information.
The execution format and the execution example of the jheapprof command and each specification method are described as follows:
- Organization of this subsection
(1) Execution format and execution example of the jheapprof command
The execution format and example of the jheapprof command are described below: For details about the jheapprof commands, see jheapprof(Output of extended thread dump containing Hitachi class-wise statistical information) in the uCosminexus Application Server Command Reference Guide.
- Execution format
-
- In Windows
jheapprof [-f|-i] [-explicit|-noexplicit] [-class class-name] [-fullgc|-copygc|-nogc] [-garbage|-nogarbage] [-rootobjectinfo|-norootobjectinfo] [-rootobjectinfost size] -p process-ID
- In UNIX
jheapprof [-f|-i] [-explicit|-noexplicit] [-class class-name] [-fullgc|-copygc|-nogc] [-garbage|-nogarbage] [-rootobjectinfo|-norootobjectinfo] [-rootobjectinfost size] [-force] -p process-ID
- Execution example
-
Here, the class-wise statistical information of Java process with process ID 2463 is output.
-
In the -p option, specify the process ID of the Java process where you want to output the class-wise statistical information, and then execute the jheapprof command.
% jheapprof -p 2463
When the -f option is being omitted in the jheapprof command, the following confirmation message is displayed:
- In Windows
-
The confirmation message whether to output an extended thread dump with Hitachi class-wise statistical information is displayed in the following format:
Force VM to output HitachiJavaHeapProfile: ? (y/n)
- In UNIX
-
The confirmation message of process ID is displayed in the following format:
send SIGQUIT to 2463: ? (y/n)
-
Enter y.
An extended thread dump with Hitachi class-wise statistics is output. The following message is output in the running java program:
Writing Java core to javacore2463.030806215140.txt... OK
The running java program creates an extended thread dump with Hitachi class-wise statistics (javacore.process-ID.date-time.txt) in the current directory and continues the program.
(2) When the information of an Explicit heap is output to the class-wise statistical information
If the following conditions are satisfied, you can output the information of an Explicit heap to the class-wise statistical information:
-
-XX:+HitachiUseExplicitMemory is specified in the JavaVM start option.
-
Explicit heap is used for implementing the application, or setting the execution environment (J2EE server).
Specify the -explicit option in the jheapprof command, and then execute the command to output the information of an Explicit heap to the class-wise statistical information.
For details about the Explicit Memory Management functionality, see 7. Suppression of Full GC by Using the Explicit Memory Management Functionality in the uCosminexus Application Server Expansion Guide.
(3) When specifying whether to execute the GC
You can select whether to execute the GC before the class-wise statistical information is output. This functionality is called as pre-statistical GC selection functionality. Specify any of the following options in the jheapprof command, if you want to execute the GC before the class-wise statistical information is output:
-
-fullgc
Executes the Full GC, and then outputs the class-wise statistical information.
-
-copygc
Executes the copy GC, and then outputs the class-wise statistical information.
-
-nogc
Outputs the class-wise statistical information without executing the GC.
For details about the pre-statistical GC selection functionality, see 9.7 Pre-statistical GC selection functionality. Note that you cannot execute the pre-statistical GC selection functionality, when you execute the unused objects statistical functionality in the Tenured area.