Oracle® Solaris Studio 12.4: Performance Analyzer Tutorials

Exit Print View

Updated: December 2014

About the Java-C++ Profiling Tutorial

This tutorial demonstrates the features of the Oracle Solaris Studio Performance Analyzer for Java profiling. It shows you how to use a sample code to do the following in Performance Analyzer:

  • Examine the performance data in various data views including the Overview page, and the Threads, Functions, and Timeline views.

  • Look at the Source and Disassembly for both Java code and C++ code.

  • Learn the difference between User Mode, Expert Mode, and Machine Mode.

  • Drill down into the behavior of the JVM executing the program and see the generated native code for any HotSpot-compiled methods.

  • See how the garbage collector can be invoked by user code and how the HotSpot compiler is triggered.

jsynprog is a Java program that has a number of subtasks typical of Java programs. The program also loads a C++ shared object and calls various routines from it to show the seamless transition from Java code to native code from a dynamically loaded C++ library, and back again.

jsynprog.main is the main method that calls functions from different classes. It uses gethrtime and gethrvtime through Java Native Interface (JNI) calls to time its own behavior, and writes an accounting file with its own timings, as well as writing messages to stdout.

jsynprog.main has many methods:

  • Routine.memalloc does memory allocation, and triggers garbage collection

  • Routine.add_int does integer addition

  • Routine.add_double does double (floating point) additions

  • Sub_Routine.add_int is a derived calls that overrides Routine.add_int

  • Routine.has_inner_class defines an inner class and uses it

  • Routine.recurse shows direct recursion

  • Routine.recursedeep does a deep recursion, to show how the tools deal with a truncated stack

  • Routine.bounce shows indirect recursion, where bounce calls bounce_b which in turn calls back into bounce

  • Routine.array_op does array operations

  • Routine.vector_op does vector operations

  • Routine.sys_op uses methods from the System class

  • jsynprog.jni_JavaJavaC: Java method calls another Java method that calls a C function

  • jsynprog.JavaCJava: Java method calls a C function which in turn calls a Java method

  • jsynprog.JavaCC: Java calls a C function that calls another C function

Some of those methods are called from others, so they do not all represent the top-level tasks.

The data you see in the experiment that you record will be different from that shown here. The experiment used for the screen-shots in the tutorial was recorded on a SPARC T5 system running Oracle Solaris 11.2. The data from an x86 system running Oracle Solaris or Linux will be different. Furthermore, data collection is statistical in nature and varies from experiment to experiment, even when run on the same system and OS.

The Performance Analyzer window configuration that you see might not precisely match the screen shots. Performance Analyzer enables you to drag separator bars between components of the window, collapse components, and resize the window. Performance Analyzer records its configuration and uses the same configuration the next time it runs. Many configuration changes were made in the course of capturing the screen shots shown in the tutorial.