- 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.
- Set Options for the CPU Profiler
- Start the 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
Figure 1. Hotspots view of the method call count operation
Figure 2. Call Stacks view of the method call count operation
- Hotspots
- Call Stacks
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)
- 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.
Starting the CPU Profiler
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:
- In the navigator, select the project you want to profile. For example, OsmPublicUi.
- From the main menu, choose Run > CPU Profile OsmPublicUi.jpr. The CPU Profiler opens and runs your application.
- Click the Begin Use Case icon to begin a profiling
Figure 4. Starting the CPU Profiler
More HintsIf 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
- Oracle® Fusion Middleware User's Guide for Oracle JDeveloper 11g Release 2 (11.1.2.0.0) Profiling a Project
No comments:
Post a Comment