Collect Java performance data

To collect Java™ performance data on an iSeries™ server, follow these steps.

  1. Create a Performance Explorer (PEX) definition that specifies:
    • A user-defined name
    • Type of data collection
    • Job name
    • Series of system events that you would like to collect system information about
    Note: A PEX definition of *STATS is preferable to a *TRACE definition if the output that you want is the java_g -prof type, and you know the specific job name of the Java program.

    Here is an example of a *STATS definition:

         ADDPEXDFN DFN(YOURDFN) JOB(*ALL/YOURID/QJVACMDSRV) DTAORG(*HIER) 
         TEXT('your stats definition')
    This *STATS definition does not get all Java events running. Only the Java events that are in your own Java session are profiled. This mode of operation may increase the time that it takes to run the Java program.

    Here is an example of a *TRACE definition:

         ADDPEXDFN DFN(YOURDFN) TYPE(*TRACE) JOB(*ALL) TRCTYPE(*SLTEVT) 
         SLTEVT(*YES) PGMEVT(*JVAENTRY *JVAEXIT)

    This *TRACE definition collects any Java entry event and exit event from any Java program in the system that you create with ENBPFRCOL(*ENTRYEXIT). This causes the analysis of this type of collection to be slower than a *STATS trace, depending on how many Java program events you have and the duration of the PEX data collection.

  2. Enable the *JVAENTRY and *JVAEXIT, under the program events category on the PEX definition, so that PEX recognizes the Java entry and exits.
    Note: If you are running the Java code using the Just-in-time (JIT) compiler, you do not enable entry and exit as you would if you were using the CRTJVAPGM command for direct processing. Instead, JIT generates code with entry and exit hooks when you use the os400.enbprfcol system property.
  3. Prepare the Java program to report program events to the iSeries Performance Data Collector.

    You can do this by using the Create Java Program (CRTJVAPGM) command on any Java program that you want to report performance data on. You must create the Java program by using the ENBPFRCOL(*ENTRYEXIT) parameter.

    Note: You must repeat this step for every Java program that you want to collect performance data on. If you do not perform this step, no performance data is collected by the PEX and no output is produced by running the Java Performance Data Converter (JPDC) tool.
  4. Start the PEX data collection by using the Start Performance Explorer (STRPEX) command.
  5. Run the program that you would like to analyze.

    This program should not be in a production environment. It generates a large amount of data in a small amount of time. You should limit the collection time to five minutes. A Java program that runs for this amount of time generates a lot of PEX system data. If too much data is collected, an unreasonable amount of time is required to process it.

  6. End the PEX data collection by using the End Performance Explorer (ENDPEX) command.
    Note: If this is not the first time that you have ended PEX data collection, you must specify a replace file of *YES or it does not save your data.
  7. Run the JPDC tool.
  8. Connect the integrated file system directory to the system with the viewer of your choice: java_g -prof viewer or Jinsight viewer.

    You can copy this file from you iSeries server and use it as input to any suitable profiling tool.

Related concepts
Java event trace performance tools
Java performance considerations
Java garbage collection
Java Native Method Invocation performance considerations
Java method inlining performance considerations
Java exception performance considerations
Java call trace performance tools
Java profiling performance tools