Tuesday, January 3, 2012

Starting the CPU Profiler in JDeveloper

JDeveloper offers two kinds of profilers: The CPU Profiler and the Memory Profiler, for local as well as remote profiling.
  • CPU Profiling enables you to identify the most expensive methods and threads in your program.
  • Memory profiling helps you to find out how your program is using the Java heap.
In this article, we will show you how to:
  • Set Options for the CPU Profiler
  • Start the CPU Profiler
CPU Profiler

The CPU Profiler tabulates and displays statistical data on the performance of your application. It enables you to profile your code in one of two modes:
  • Sample CPU Time
  • Method Call Count
In Figure 1, it shows the result of method call count operation.


Figure 1. Hotspots view of the method call count operation




Figure 2. Call Stacks view of the method call count operation

The CPU Profiler displays data in two views:
  • Hotspots
  • Call Stacks
Also, depending on the mode of operation, they display different information.

In the method call count operation, these views show:
  • Hotspots
    • all the methods and the number of times they were called (see Figure 1)
  • Call Stacks
    • the Java platform methods called, sorted by thread group (see Figure 2)
In the time sampling mode of operation, these views show:
  • Hotspots
    • all Java platform methods and all methods they call, sorted by time usage
    • the cumulative amount of CPU time spent in each method
  • Call Stacks
    • the Java platform methods called in their call hierarchy

Setting Options for the CPU Profiler

You can specify if you want the Profiler to sample CPU time usage by your application, or to count method calls. Note that you can choose one mode at a time, not both.

To set CPU Profiler options:
  • In the navigator, double-click the project you want to profile to open the Project Properties dialog.
  • Click Run/Debug/Profiler to open the Project Properties - Run/Debug/Profile page.
  • Click Edit.
  • In the Edit Run Configuration dialog, set the options as desired on the Tool Settings - Profiler - CPU page. You can specify if you want the profiler to sample CPU time or count method calls. In Figure 3, we want the profiler to count method calls.
  • When finished, click OK to close the Edit Run Configuration dialog.

Figure 3. Edit Run Configuration Dialog

Starting the CPU Profile
r

Starting a CPU profiling session will automatically run your program. Once the CPU profiler window is open (see Figure 1), you can begin a use case to profile your application.

To start the CPU Profiler:
  1. In the navigator, select the project you want to profile. For example, OsmPublicUi.
  2. From the main menu, choose Run > CPU Profile OsmPublicUi.jpr.
  3. The CPU Profiler opens and runs your application.
  4. Click the Begin Use Case icon to begin a profiling

Figure 4. Starting the CPU Profiler
More Hints

If no default run target is specified in the Launch Settings page of the Edit Run Configuration dialog (Application menu > Project Properties > Run/Debug/Profile), the Choose Default Run Target dialog opens. Use this dialog to specify the default run target.

If you want to profile your application immediately when the profiler is launched, select the Begin Use Case on Application Startup checkbox in Profiler page of Edit Run Configuration dialog (see Figure 5).

If you want to analyze a specific method or class you might be interested in, enter the name of a particular method or class in your application in Method Filter (see Figure 5) at the options setting step.


References
  1. Oracle® Fusion Middleware User's Guide for Oracle JDeveloper 11g Release 2 (11.1.2.0.0) Profiling a Project

1 comment:

Blogger said...

QUANTUM BINARY SIGNALS

Get professional trading signals sent to your mobile phone every day.

Follow our signals NOW & profit up to 270% per day.