Profiling Java Classes

Applies to AQTime 8.81, last modified on January 18, 2022

Since Java is a platform-independent language, source code is compiled into an intermediate output file known as bytecode, which is stored in a .class file. If a source file has more than one class, each class is compiled into a separate .class file. These .class files can be loaded by any Java Virtual Machine (JVM). This topic describes how to profile such .class files with AQTime.

Preparing an AQTime Project

  1. Compile your Java application with debug information (see Compiler Settings for Java Compiler).

  2. Launch AQTime and create a new empty AQTime project.

  3. Select the Normal profiling mode on AQTime’s Standard toolbar.

    Select the Normal profiling mode on Visual Studio’s AQTime toolbar.

    Select the Normal profiling mode on RAD Studio’s AQTime Profiling Modes toolbar.

  4. Choose Run > Parameters from AQTime’s main menu.Choose AQTime > Parameters from Visual Studio’s main menu.Choose AQTime > Parameters from RAD Studio’s menu. This will invoke the Run Parameters dialog.

  5. Specify the Java application launcher as a host application. You can do this in two ways:

    • Select Default Java Runtime from the Select generic host application drop-down list. In this case, AQTime will use the JVM specified by the Default Java Runtime option.

      -- or --

    • Enter the fully-qualified path to the Java launcher file in the Specify custom host application edit box. The file path can be any of the following:

      • <JRE>\bin\java.exe
      • <JRE>\bin\javaw.exe
      • <JDK>\bin\java.exe
      • <JDK>\bin\javaw.exe

    For more information, see Selecting Target Java Virtual Machine.

  6. In the Parameters edit box, enter the -classpath command-line argument followed by the path and the name of the class file you want to profile. For example: -classpath "C:\Documents and Settings\All Users\Documents\AQTime 8 Samples\Java\Coverage\Bin\CoverageClasses" CoverageSample.

    Parameters for Profiling Java Classes
    Note: In order to be executed, a class should have the main method (declared as public and static), which must not return any value and must accept a String array as a parameter.

    If the path string contains space characters, enclose it in quotation marks. If the class file resides in a folder listed in the CLASSPATH environment variable, then the classpath argument may be omitted.

    You can pass any other standard and non-standard command-line parameters of the Java launcher through the Parameters field of the Run Parameters dialog. For a complete list of Java launcher parameters, see the java - the Java application launcher topic of Java Technology Reference that corresponds to the JRE installed on your machine.

  7. Click OK to save the changes and close the dialog.

  8. Switch to AQTime’s Setup panel and add the class files you want to profile to the AQTime project.

  9. Now the project is ready for profiling. If needed, you can enable the Entire Java Code preset area, create custom areas, or tune triggers and actions. Note that if the Entire Java Code area is used, AQTime profiles all the functions executed by the Java Virtual Machine, including those that are added to the excluding areas. In other words, the excluding areas are ignored in such cases.

Profiling Procedure

  1. Start profiling in AQTime. AQTime will launch the Java Virtual Machine, which, in turn, will invoke the profiled class file(s).

    Profiling Java code by attaching a profiler to a running Java application is currently not supported.
  2. Perform the desired actions over the application. AQTime will profile it.

  3. To generate results, either close the application, or use the Get Results command.

    AQTime will display profiling results in its panels.

    To denote the profiling results for routines declared within nested classes, the dollar sign is used. For instance: Collections$UnmodifiableList::indexOf.

See Also

Profiling Java Applications
Profiling Java Applications - Overview
Selecting Target Java Virtual Machine
Profiling Java Archives
Profiling Mixed-code Java Applications

Highlight search results