Profiling Mixed-code Java Applications

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

AQTime can profile mixed code Java applications, that is, applications where certain parts are in Java (managed code), while other parts are native code (unmanaged code). AQTime can analyze both managed and unmanaged code. It does not require any special preparations for profiling of mixed code, except for cases when modules, which include unmanaged sections, must be compiled with debug information. For example, if the application itself includes both managed and unmanaged code, you have to compile it with debug information to profile its unmanaged sections. See How AQTime Profilers Use Metadata and Debug Information.

There can be two possible cases:

  1. When a Java application calls some routines from the native code library.
  2. When a native code application invokes the Java Virtual Machine and executes some Java code.

To achieve this, Java has a special API - Java native interface (JNI).

Profiling native routines called from Java application

To profile native-code DLL routines called from a Java application, you do not need any special preparations. It is not obligatory to compile your DLL with debug information (although the latter would provide more detailed results). Simply start profiling your Java application as described in the Profiling Java Archives or Profiling Java Classes topic and call the native-code routines. AQTime will trace the moment when non-managed code is called and switch to the appropriate engine.

Note: If you start profiling by attaching a profiler to a running Java application, AQTime will only profile native code called from that application. Managed code will not be analyzed.

AQTime includes a sample that illustrates how you can profile native-code routines that are called from managed Java code.

<AQTime Samples>\Java\MixedProfiling

Profiling native applications that invoke Java code

Compile such applications with debug information. See How AQTime Profilers Use Metadata and Debug Information for a list of detailed instructions for the compiler you use. Perform the actions that invoke the Java Virtual Machine, execute Java code.

See Also

Profiling Java Applications
Profiling Java Archives
Profiling Java Classes
How AQTime Profilers Use Metadata and Debug Information

Highlight search results