Configuring profiling settings

## Configuring profiling settings |
previous | up | next

### 1. What are profiling settings?

Profiling settings are settings that control the way profiling data is recorded. The must be adjusted according to your personal needs before the session is started. Unlike view settings, profiling settings cannot be changed during a running session. The primary distinction between profiling settings and view settings is that profiling settings are irreversible. If you wanted to change them during a running session, there would be a loss of data, or an inconsistency between data recorded before and after the change.

Profiling settings are persistent, just like view settings. Every change you make to the profiling settings will be remembered across restarts.

### 2. Limiting the recorded profiling data

Why doesn't JProfiler just record everything it can and shows it to the user? The answer is twofold:

- There's a trade-off between information depth and runtime overhead
  Profiling adds overhead to the profiled application. It runs more slowly and consumes more memory. As an example, consider the call tree. JProfiler record separate call trees for each thread. If all method calls in all classes are recorded, the profiling agent has to do a lot of bookkeeping operations and its internal data structures use a lot of memory.
- You want to reduce clutter in the recorded data
  Maximum detail doesn't lead to maximum insight. On the contrary, excessive detail will often be in the way. If there's too much information available, you're likely to get lost in it. Let's continue the above example: most of the time, you're not interested in the internal call tree of framework classes. Say, if you call `HashMap.get()`, the sufficiently detailed information will be the duration of this call. When you're not familiar with an implementation or if you're not in control of it, the internal calls structure is not helpful information, but rather just clutter, that you can ignore.

In principle, reducing the information depth can be done after recording. The view filters in the CPU views are such an example: the internal call structure of all classes that do no match the selected view filter is removed from the call tree. However, especially the increased memory consumption of profiling is critical: if you do not have enough physical memory available, the profiled JVM might become unstable or even crash. So in practice, you should record as little data as possible. With appropriate profiling settings you choose the required detail while retaining an acceptable runtime performance.

### 3. Profiling settings templates

At first, the number of profiling settings can be quite overwhelming and the performance implications might not be quite clear. Because of this, JProfiler offers templates for profiling settings. When you start a session, a dialog is displayed where you can select one of several pre-defined templates. Below the combo box, a description and two overhead meters for CPU and memory overhead help you in judging whether the profiling settings are acceptable for you. Please note that the overhead meters do not give any absolute values, that would not even be possible theoretically, as JProfiler has no way of knowing the runtime characteristics of your application. Rather, they are hints that allow you to compare different profiling settings.

Each profiling settings template defines certain values for the profiling settings that can be viewed and modified by clicking the [Customize profiling settings and filters] button. When you modify and save those settings, the template combo box displays that the profiling settings are "Customized".

### 4. Accessing the profiling settings

There are three locations where you can access the profiling settings in JProfiler.

- in the profiling settings dialog that is displayed before a session is started
  When you define a new session, the default profiling settings template is used. Every time a session is started, a dialog is displayed that allows you to change this template or customize the settings in detail (see above).
- from the menu or tool bar
  When a session is running, you can choose Edit->Profiling settings from the main menu or click on the corresponding tool bar button. You can look at the current profiling settings and you can even change them. However, changes in the profiling settings are not applied immediately, they will become effective the next time the session is started.
- in the application settings dialog
  If you want to compare the profiling settings of two sessions, you can edit them in the start center. This shows the application settings dialog where you click the [Profiling settings] button that is located at the bottom. This is intended to let you review the profiling settings of existing sessions.

### 5. Overview of the various profiling settings

The most important profiling settings are:

- the call tree collection method
  This profiling settings determines performance overhead and informational detail in the CPU and memory views that show call trees. A detailed presentation of the various call tree collection method is available in a separate article.
- the call tree filters
  The call tree filters determine the detail that is shown in any call tree or call stack in JProfiler. In brief, they define the set of classes whose internal call structure is shown while method calls into all other classes are treated as opaque. Please see the article on call tree filters for a thorough discussion.