CPU Profiling settings
In the Custom Profiling mode, you have complete control over all of the internal
profiling settings available. When you choose CPU profiling, you can
choose between profiling the entire application, part of the
application, or application startup.
Choosing the CPU Profiling option brings up the settings dialog box:
When profiling the entire or part of an application, you can refine the profiling configuration by modifying the following Basic and Advanced settings:
Basic Options
Advanced Options
The following options are available in the Advanced options tab.
- Limit number of profiled threads. You can limit the number of
threads that are profiled. Every time a thread that has not been previously
registered enters the instrumented code, this counter is decremented. When
it reaches zero, registration of new threads is stopped. Profiling data
is collected only for the registered threads. The counter is reset to the
value specified above every time you invoke the Profile > Reset Collected
Results (
).
For details, see Profiling
Single-Threaded and Multi-Threaded Applications.
- Use Thread CPU Timer. The timestamps of method entry/exit events
can be taken using different kinds of OS timers. By default, absolute timer
is used to measure absolute, or wall clock time. Thread CPU timer measures
only the time spent executing the given thread. Essentially, the OS suspends this
timer every time the CPU stops executing the code on behalf of the given
thread, and resumes it every time execution switches back to this thread. This
option is available only for the Solaris OS.
For details, see Using Different Kinds of Timers.
- Instrumentation: scheme. By selecting an instrumentation scheme,
you can limit the number of instrumented methods. Usually, it is best if
the number of instrumented methods and the number of methods actually called
by the application when it is profiled are the same or very close. The
default scheme for Part of Application is "Lazy". Usually it is most appropriate when you
want to profile a subset of the application code (for example, just one
or more servlets running on top of an application server) because it
results in the smallest number of instrumented methods. However, total instrumentation
may be more appropriate if you want to profile application startup, or an
entire application such as a short-running command line utility. For the Entire
Application mode "Total" instrumentation is default value and the control is hidden.
For details, see
Instrumentation Schemes.
- Instrument/not instrument various special Java methods.
When "Instrument
Method.invoke()" is checked, all calls
done using Java Reflection (i.e. the java.lang.reflect.Method.invoke()
call) are followed and instrumented. Otherwise, such calls are not followed.
The other two options specify whether Profiler should instrument methods that
either get/set object fields, and methods that don't contain any executable
code. Typically it does not make sense to instrument these methods, since
the HotSpot JVM optimizes them very efficiently and normally their execution
time is negligible. When instrumented, however, they may contribute to the
profiling overhead noticeably. Check these boxes only if you want to find
out whether, or how many times, some of these methods are called.

Code Fragment Options
If you choose to profile a code fragment, the only parameters you can set are the maximum number of profiled threads and the buffer size.
See also