In your code, add optional logic that you can enable to record timing information. Measure the execution time for major tasks such as:
Component business method entry and exit
Entry and exit of JSP or servlet service invocations
Calls to other components or EJBs
Database command execution and result-set processing
Requests for cached connections
JNDI lookups that return EJB proxies or JDBC data sources
EAServer includes built-in support for profiling and tracing of EJB business method invocations and Web component invocations—see “Component profiling and tracing”.
In your own Java code, you can record timings by calling System.currentTimeMillis(). Logging can degrade performance, so be sure to encapsulate the timing code in logic that allows you or your administrators to selectively enable tracing for areas where you are tuning. To allow configuration of the log options, you can use Log4j or the Java Logging package.