Java runtime statistics

You can use the HJV_JZOS_JVM_SMF_LOGGING JZOS environment variable to enable the logging of system management facilities (SMF) records that contain Java™ runtime statistics.

By default, logging of Java runtime statistics is disabled. If this environment variable is set to true, the JZOS batch launcher registers a JVM shutdown hook to log an SMF record that contains Java runtime performance statistics just before the JVM shuts down.

You can also use the HJV_JZOS_JVM_SMF_LOGGING_INTERVAL environment variable to enable periodic logging of SMF records. Another environment variable, HJV_JZOS_JVM_SMF_THREADS, controls whether details for individual threads are included in these SMF records. Finally, the HJV_JZOS_JVM_SMF_THREADS_NATIVE_ID environment variable controls whether the correct native operating system thread ID information is assigned in the individual thread detail section. For more information about configuring these JZOS environment variables, see JZOS environment variables.

The JZOS batch launcher uses SMF record type 121 to record Java runtime performance statistics. The record mappings are shown in the following tables.

Header/self-defining section

This section contains the common SMF record header fields and triplet fields (offset to section, length of section, or number of sections) that locate the other sections on the record.

Table 1. Record mappings for the header/self-defining section of the SMF record
Offset (decimal) Offset (hexadecimal) Name Length Format Description
0 0 SMF121LEN 2 binary Record length (maximum size of 32,756). This field and the next field (total of four bytes) form the record descriptor word (RDW). The first two bytes (this field) must contain the logical record length, including the RDW.
2 2 SMF121SEG 2 binary Segment descriptor provided by SMF. Initialize with zeros.
4 4 SMF121FLG 1 binary System indicator. The meaning of the bits when set is as follows:
  1. 0: reserved
  2. 1: subtypes are valid
  3. 2: reserved
  4. 3: MVS/SP Version 4 and later. Bits 3, 4, 5, and 6 are on. A good practice is to use record type 30 to obtain the MVS product level.
  5. 4: MVS/SP Version 3. Bits 4, 5, and 6 are on
  6. 5: MVS/SP Version 2. Bits 5 and 6 are on
  7. 6: VS2. Bit 6 is on
  8. 7: reserved
5 5 SMF121RTY 1 binary Record type. This should be 121 decimal.
6 6 SMF121TME 4 binary Time since midnight, in hundredths of a second, that the record was moved into the SMF buffer.
10 A SMF121DTE 4 packed Date when the record was moved into the SMF buffer, in the form 00yydddF or 0cyydddF . In this format, c is 0 for 19xx and 1 for 20xx, yy is the current year (0-99), ddd is the current day (1-366), and F is the sign).
14 E SMF121SID 4 EBCDIC System identification.
18 12 SMF121SSI 4 EBCDIC Subsystem identification.
22 16 SMF121STY 2 binary Record subtype. This should be 1 decimal.
24 18 SMF121SDS_TRIPLETS 2 binary Number of triplets (Offset/Length/Number combinations). For JZOS, there are 3 triplets: one for the Java Runtime section, one for the Garbage Collector section, and one for the Thread section.
26 1A SMF121SDS_RSERVD 2 binary Reserved to account for fullword alignment of next field.
28 1C SMF121SDS_OFFJRS 4 binary Offset to the Java Runtime section.
32 20 SMF121SDS_LENJRS 2 binary Length of each Java Runtime section.
34 22 SMF121SDS_NUMJRS 2 binary Number of Java Runtime sections. There should be only 1 Java Runtime section.
36 24 SMF121SDS_OFFGCS 4 binary Offset to the Garbage Collector section.
40 28 SMF121SDS_LENGCS 2 binary Length of each Garbage Collector section.
42 2A SMF121SDS_NUMGCS 2 binary Number of Garbage Collector sections. This depends on how many Garbage Collectors are active in the Java VM.
44 2C SMF121SDS_OFFTS 4 binary Offset to the Thread section.
48 30 SMF121SDS_LENTS 2 binary Length of each Thread section.
50 32 SMF121SDS_NUMTS 2 binary Number of Thread sections. This number depends on the number of active Java threads.

Java runtime section

Triplet information: This section is located on the record by using the following triplet fields, which are located in Header/self-defining section.

Table 2. Record mappings for the Java runtime section of the SMF record
Offset (decimal) Offset (hexadecimal) Name Length Format Description
0 0 SMF121JRS_FDFLAGS 4 binary Field flags to indicate the addition of new fields. The meaning of the bits when flag byte 1 is set is as follows:
  • 0: contains CPU usage summary fields. Fields include SMF121JRS_APPCPU, SMF121JRS_SYSCPU, SMF121JRS_GCCPU, and SMF121JRS_JITCPU.
  • 1-7: reserved
Flag bytes 2, 3, and 4 are reserved.
4 4 SMF121JRS_NAME 80 EBCDIC Formatted name that represents the running Java virtual machine, in the format pid@hostname. Retrieved from java.lang.management.RuntimeMXBean::getName(). If the name is longer than 80 characters, it is truncated.
84 54 SMF121JRS_STRTTME 8 binary The approximate time when the Java virtual machine started, in milliseconds. Retrieved from java.lang.management.RuntimeMXBean::getStartTime().
92 5C SMF121JRS_UPTIME 8 binary Uptime of the Java virtual machine in milliseconds. Retrieved from java.lang.management.RuntimeMXBean::getUptime().
100 64 SMF121JRS_GCMODE 40 EBCDIC The current garbage collection mode as a human-readable string. Retrieved from com.ibm.lang.management.MemoryMXBean::getGCMode(). If the string is longer than 40 characters, it is truncated.
140 8C SMF121JRS_PEAKTHRD 4 binary The peak live thread count since the Java virtual machine started or the peak count was reset. Retrieved from java.lang.management.ThreadMXBean::getPeakThreadCount().
144 90 SMF121JRS_CURRTHRD 4 binary The current number of live threads, including both daemon and non-daemon threads. Retrieved from java.lang.management.ThreadMXBean::getThreadCount().
148 94 SMF121JRS_APPCPU 8 binary Total CPU usage for all application threads in microseconds. Retrieved from com.ibm.lang.management.JvmCpuMonitorInfo::getApplicationCpuTime(). If CPU usage information is not available, this field contains -1.
156 9C SMF121JRS_SYSCPU 8 binary Total CPU usage of all system threads in microseconds, which includes GC, JIT and other JVM daemon threads. Retrieved from com.ibm.lang.management.JvmCpuMonitorInfo::getSystemJvmCpuTime(). If CPU usage information is not available, this field contains -1.
164 A4 SMF121JRS_GCCPU 8 binary Total CPU usage of all GC threads in microseconds. Retrieved from com.ibm.lang.management.JvmCpuMonitorInfo::getGcCpuTime(). If CPU usage information is not available, this field contains -1.
172 AC SMF121JRS_JITCPU 8 binary Total CPU usage of all JIT threads in microseconds. Retrieved from com.ibm.lang.management.JvmCpuMonitorInfo::getJitCpuTime(). If CPU usage information is not available, this field contains -1.

Garbage collector section

Table 3. Record mappings for the garbage collector section of the SMF record
Offset (decimal) Offset (hexadecimal) Name Length Format Description
0 0 SMF121GCS_FDFLAGS 4 binary Field flags to indicate the addition of new fields, currently should be all zeros.
4 4 SMF121GCS_NAME 40 EBCDIC Garbage collector name. Retrieved from com.ibm.lang.management.GarbageCollectorMXBean::getName(). If the name is longer than 40 characters, it is truncated.
44 2C SMF121GCS_COLLCNT 8 binary Total number of collections that occurred. Retrieved from com.ibm.lang.management.GarbageCollectorMXBean::getCollectionCount().
52 34 SMF121GCS_COLLTME 8 binary The approximate accumulated collection elapsed time in milliseconds. Retrieved from com.ibm.lang.management.GarbageCollectorMXBean::getCollectionTime().
60 3C SMF121GCS_TMEMFREED 8 binary The cumulative total amount of memory freed, in bytes, by the garbage collector. Retrieved from com.ibm.lang.management.GarbageCollectorMXBean::getTotalMemoryFreed().
68 44 SMF121GCS_TCOMPACTS 8 binary The cumulative total number of compactions that were done by the garbage collector. Retrieved from com.ibm.lang.management.GarbageCollectorMXBean::getTotalCompacts().
76 4C SMF121GCS_MEMUSED 8 binary A snapshot of the amount of heap memory that is used by objects that the garbage collector manages just before this SMF record was recorded. Retrieved from com.ibm.lang.management.GarbageCollectorMXBean::getMemoryUsed().

Thread section

Table 4. Record mappings for the thread section of the SMF record
Offset (decimal) Offset (hexadecimal) Name Length Format Description
0 0 SMF121TS_FDFLAGS 4 binary Field flags to indicate the addition of new fields, currently should be all zeros.
4 4 SMF121TS_ID 8 binary Java thread ID. Retrieved from java.lang.management.ThreadInfo::getThreadId().
12 C SMF121TS_NAME 24 EBCDIC Java thread name. Retrieved from java.lang.management.ThreadInfo::getThreadName(). If the name is longer than 24 characters, it is truncated.
36 24 SMF121TS_CAT 8 EBCDIC

Thread category. Retrieved from com.ibm.lang.management.JvmCpuMonitorMXBean::getThreadCategory(long).

Possible thread categories are as follows: APP, APP-U1, APP-U2, APP-U3, APP-U4, APP-U5, SYS, GC, JIT. OTHER, RM.

If thread category information is not available, this field contains an empty string.

44 2C SMF121TS_CPU 8 binary Total CPU usage time. This field has nanosecond precision but might not have nanosecond accuracy. Retrieved from java.lang.management.ThreadMXBean::getThreadCpuTime(long). If CPU usage information is not available, this field contains -1.
52 34 SMF121TS_NATIVEID 8 binary The corresponding native OS thread ID. If this information is not available, the field contains -1.