FeaturesPluginsDocs & SupportCommunityPartners

Profiling Results - Code Fragment

When you analyze code fragment performance, the results in the Profiling Results tab display the time it takes to execute an piece of code within one method, or the whole method.

Code fragment performance is profiled when you choose the Analyze Code Fragment Performance in the Select Profiling Task dialog box.

To open the Profiling Results tab, click the Live Results button ( Live Results ) in the Profiler window.

The Profiling Results tab

When you analyze code fragment performance, the results appear as a list in the Profiling Results tab.

The length of this list is the smaller of the following two values:

  • The number of times that this code region has actually been executed
  • The size of the code region CPU results buffer.

Code Region Tab

How code fragment performance is measured

The CPU results buffer is a ring buffer kept in the target JVM memory; by default its size is 1000 elements. The size can be changed in the Custom Profiling mode. Note that when you shut down the target JVM, the results contained in this buffer are lost, thus you should invoke choose Profile -> Reset Collected Results while the target VM is still active (though the target application could have completed execution by that time).

When measuring code fragment performance you measure the time it takes to execute an arbitrary piece of code within one method, or the whole method. It is as if you inserted two System.currentTimeMillis() calls into the code of your target method (or more, if there are any return statements within this piece of code) and then calculated the difference. Profiler, however, uses a high-resolution timer and automates the whole process, allowing you to insert/remove as many timers as you want while your application is running. Only one timer can be active at any time, however.

See also

 

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by