Skip Headers
Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B15901-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Profiling Performance

The most important challenge to performance tuning is knowing what to optimize. To improve your application performance, identify the areas of your application that do not operate at peak efficiency. The OracleAS TopLink Performance Profiler helps you identify performance problems.

The OracleAS TopLink Performance Profiler logs a summary of the performance statistics for every query you execute. The Profiler also logs a summary of all queries executed in a given session.

The Profiler logs the following information:

Using the Profiler in the Web Client

The OracleAS TopLink Web Client also includes a graphical Performance Profiler.

For more information, see "Using the Performance Profiler".

Using the Profiler in Java

The Performance Profiler is an instance of the PerformanceProfiler class, found in oracle.toplink.tools.profiler. To access the Profiler, call the session getProfiler() method.

To enable the Profiler, invoke the setProfiler(new PerformanceProfiler()) method on the session. To end a profiling session, invoke the clearProfiler() method. The Profiler supports the following public API:

  • logProfile(): Enables the profiler

  • dontLogProfile(): Disables the profile

  • logProfileSummaryByQuery(): Organizes the profiler log as query summaries. This is the default profiler behavior.

  • logProfileSummaryByClass(): Organizes the profiler log as class summaries. This is an alternative to the default behavior implemented by logProfileSummaryByQuery().

Example 10-1 Executing a Read Query with the Profiler

session.setProfiler(new PerformanceProfiler());
Vector employees = session.readAllObjects(Employee.class);

Example 10-2 Implementing the Performance Profiler in the sessions.xml File

<session>
    ...
    <profiler-class>oracle.toplink.tools.profiler.PerformanceProfiler</profiler-class>
    ...
</session>

Example 10-3 Performance Profiler Output

Begin Profile of{
ReadAllQuery(oracle.toplink.demos.employee.domain.Employee)Profile(ReadAllQuery,# of obj=12, time=1399,sql execute=217, prepare=495, row fetch=390, time/obj=116,obj/sec=8) */
} End Profile

The second line of the profile contains the following information about a query:

  • ReadAllQuery(oracle.toplink.demos.employee.domain.Employee): Specific query profiled and its arguments

  • Profile(ReadAllQuery): Start of the profile and the type of query

  • # of obj=12: Number of objects involved in the query

  • time=1399: Total execution time of the query (in milliseconds)

  • sql execute=217: Total time spent executing the SQL

  • prepare=495: Total time spent preparing the SQL

  • row fetch=390: Total time spent fetching rows from the database

  • time/obj=116: Number of milliseconds spent on each object

  • obj/sec=8) */: Number of objects handled per second

Browsing the Profiler Results

To view profiler results, use the graphical Profile Browser. From your application code, launch the browser, located in the oracle.toplink.tools.sessionconsole package.

Example 10-4 Launching the Profile Browser

ProfileBrowser.browseProfiler(session.getProfiler());