JProfiler Manual
JProfiler Manual
B Reference .................................................................................................................................... 40
B.1 Getting Started ..................................................................................................................... 40
B.1.1 Quickstart dialog ............................................................................................................ 40
B.1.2 Running the demo sessions ........................................................................................... 40
B.1.3 Overview of features ...................................................................................................... 40
B.1.4 JProfiler's start center .................................................................................................... 41
B.1.5 Application server integration ......................................................................................... 42
B.1.6 IDE integration ............................................................................................................... 43
B.2 JProfiler setup ....................................................................................................................... 44
B.2.1 JProfiler setup wizard ..................................................................................................... 44
B.2.2 JProfiler licensing ........................................................................................................... 44
B.3 IDE integrations .................................................................................................................... 46
B.3.1 Overview ........................................................................................................................ 46
B.3.2 IntelliJ IDEA ................................................................................................................... 46
B.3.3 Eclipse 2.x / WSAD 5.x .................................................................................................. 49
B.3.4 Eclipse 3.x ...................................................................................................................... 52
B.3.5 IBM RAD 6.x .................................................................................................................. 54
B.3.6 JBuilder .......................................................................................................................... 55
B.3.7 JDeveloper ..................................................................................................................... 58
B.3.8 Netbeans ........................................................................................................................ 60
B.4 Managing sessions ............................................................................................................... 64
B.4.1 Overview ........................................................................................................................ 64
B.4.2 Application settings ........................................................................................................ 65
B.4.2.1 Overview ................................................................................................................. 65
B.4.2.2 Local session ........................................................................................................... 66
B.4.2.3 Remote session ....................................................................................................... 67
B.4.2.4 Applet session ......................................................................................................... 68
B.4.2.5 Web Start session ................................................................................................... 69
B.4.3 Filter settings .................................................................................................................. 69
B.4.3.1 Overview ................................................................................................................. 69
B.4.3.2 Define filters ............................................................................................................ 69
B.4.3.3 View filter tree .......................................................................................................... 70
B.4.3.4 Filter templates ........................................................................................................ 71
B.4.3.5 Exceptional methods ............................................................................................... 71
B.4.3.6 Ignored methods ..................................................................................................... 72
B.4.4 Profiling settings ............................................................................................................. 73
B.4.4.1 Overview ................................................................................................................. 73
B.4.4.2 Method call recording .............................................................................................. 74
B.4.4.3 CPU profiling ........................................................................................................... 75
B.4.4.4 Java subsystems ..................................................................................................... 76
B.4.4.5 Memory profiling ...................................................................................................... 77
B.4.4.6 Thread profiling ....................................................................................................... 78
B.4.4.7 Miscellaneous settings ............................................................................................ 78
B.4.4.8 Profiling settings templates ..................................................................................... 80
B.4.5 Trigger settings .............................................................................................................. 80
B.4.5.1 Overview ................................................................................................................. 80
B.4.5.2 Trigger wizard .......................................................................................................... 81
B.4.5.3 Trigger event types .................................................................................................. 81
B.4.5.4 Trigger actions ......................................................................................................... 84
B.4.5.5 Trigger sets ............................................................................................................. 87
B.4.5.6 Adding triggers from call trees ................................................................................. 87
B.4.5.7 Enabling and disabling ............................................................................................ 87
B.4.6 Open session dialog ...................................................................................................... 88
B.4.7 Session startup dialog .................................................................................................... 88
B.4.8 Starting remote sessions ............................................................................................... 89
B.4.9 Remote sessions invocation table ................................................................................. 93
B.4.10 Saving live sessions to disk ....................................................................................... 101
B.4.11 Config synchronization ............................................................................................... 102
B.4.12 Importing and exporting sessions .............................................................................. 103
B.5 General settings ................................................................................................................. 104
B.5.1 Overview ...................................................................................................................... 104
B.5.2 Java VMs ..................................................................................................................... 104
B.5.3 Session defaults ........................................................................................................... 105
B.5.4 IDE integrations ........................................................................................................... 105
B.5.5 Miscellaneous options .................................................................................................. 105
B.6 Profiling views ..................................................................................................................... 107
B.6.1 Overview ...................................................................................................................... 107
B.6.2 Menu ............................................................................................................................ 108
B.6.3 Exporting views to HTML ............................................................................................. 112
B.6.4 Quick search in views .................................................................................................. 113
B.6.5 Undocking views .......................................................................................................... 113
B.6.6 Sorting tables ............................................................................................................... 114
B.6.7 Using graphs ................................................................................................................ 114
B.6.8 Bookmarks ................................................................................................................... 114
B.6.9 Editing bookmarks ....................................................................................................... 115
B.6.10 Source and bytecode viewer ...................................................................................... 116
B.6.11 Dynamic view filters ................................................................................................... 117
B.6.12 Memory view section ................................................................................................. 118
B.6.12.1 Overview ............................................................................................................. 118
B.6.12.2 All objects ............................................................................................................ 119
B.6.12.2.1 Overview ....................................................................................................... 119
B.6.12.2.2 Settings dialog .............................................................................................. 120
B.6.12.3 Recorded objects ................................................................................................ 121
B.6.12.3.1 Overview ....................................................................................................... 121
B.6.12.3.2 Settings dialog .............................................................................................. 122
B.6.12.4 Allocation call tree ............................................................................................... 124
B.6.12.4.1 Overview ....................................................................................................... 124
B.6.12.4.2 Settings dialog .............................................................................................. 127
B.6.12.5 Allocation hot spots view ..................................................................................... 129
B.6.12.5.1 Overview ....................................................................................................... 129
B.6.12.5.2 Settings dialog .............................................................................................. 133
B.6.12.6 Class tracker ....................................................................................................... 134
B.6.12.6.1 Overview ....................................................................................................... 134
B.6.12.6.2 Class tracker options dialog .......................................................................... 134
B.6.12.6.3 View settings dialog ...................................................................................... 134
B.6.12.7 Allocation options dialog ...................................................................................... 135
B.6.12.8 Class and package selection dialog .................................................................... 135
B.6.13 Heap walker view section .......................................................................................... 137
B.6.13.1 Overview ............................................................................................................. 137
B.6.13.2 Option dialog ....................................................................................................... 138
B.6.13.3 View layout .......................................................................................................... 139
B.6.13.4 Classes view ....................................................................................................... 142
B.6.13.4.1 Overview ....................................................................................................... 142
B.6.13.5 Allocation view ..................................................................................................... 144
B.6.13.5.1 Overview ....................................................................................................... 144
B.6.13.5.2 Allocation tree ............................................................................................... 144
B.6.13.5.3 Allocation hot spots ....................................................................................... 144
B.6.13.6 Biggest objects view ............................................................................................ 146
B.6.13.6.1 Biggest objects view ..................................................................................... 146
B.6.13.6.2 Dependency on retained size calculation ..................................................... 147
B.6.13.7 Reference view .................................................................................................... 148
B.6.13.7.1 Overview ....................................................................................................... 148
B.6.13.7.2 Reference graph ........................................................................................... 148
B.6.13.7.3 Tree of incoming references ......................................................................... 152
B.6.13.7.4 Tree of outgoing references .......................................................................... 155
B.6.13.7.5 Cumulated incoming references ................................................................... 157
B.6.13.7.6 Cumulated outgoing references .................................................................... 159
B.6.13.7.7 Path to root option dialog .............................................................................. 160
B.6.13.7.8 Restricted availability .................................................................................... 160
B.6.13.8 Data view ............................................................................................................. 161
B.6.13.8.1 Overview ....................................................................................................... 161
B.6.13.8.2 Instance data ................................................................................................ 163
B.6.13.8.3 Class data ..................................................................................................... 163
B.6.13.8.4 Restricted availability .................................................................................... 164
B.6.13.9 Time view ............................................................................................................ 165
B.6.13.9.1 Overview ....................................................................................................... 165
B.6.13.9.2 Restricted availability .................................................................................... 166
B.6.13.10 View helper dialog ............................................................................................. 168
B.6.13.11 Settings dialog ................................................................................................... 168
B.6.13.12 HPROF snapshots ............................................................................................ 169
B.6.14 CPU view section ....................................................................................................... 170
B.6.14.1 Overview ............................................................................................................. 170
B.6.14.2 Call tree view ....................................................................................................... 172
B.6.14.2.1 Overview ....................................................................................................... 172
B.6.14.2.2 Show hidden elements dialog ....................................................................... 175
B.6.14.2.3 Settings dialog .............................................................................................. 175
B.6.14.3 Hot spot view ....................................................................................................... 177
B.6.14.3.1 Overview ....................................................................................................... 177
B.6.14.3.2 Settings dialog .............................................................................................. 181
B.6.14.4 Call graph ............................................................................................................ 182
B.6.14.4.1 Overview ....................................................................................................... 182
B.6.14.4.2 Call graph wizard .......................................................................................... 183
B.6.14.4.3 Node selection dialog ................................................................................... 184
B.6.14.4.4 Settings dialog .............................................................................................. 184
B.6.14.5 Method statistics .................................................................................................. 186
B.6.14.5.1 Overview ....................................................................................................... 186
B.6.14.5.2 Settings dialog .............................................................................................. 187
B.6.14.6 Call tracer ............................................................................................................ 189
B.6.14.6.1 Overview ....................................................................................................... 189
B.6.14.6.2 Show hidden elements dialog ....................................................................... 190
B.6.14.6.3 Settings dialog .............................................................................................. 190
B.6.15 Threads view section ................................................................................................. 192
B.6.15.1 Overview ............................................................................................................. 192
B.6.15.2 Thread history view ............................................................................................. 193
B.6.15.2.1 Overview ....................................................................................................... 193
B.6.15.2.2 Settings dialog .............................................................................................. 195
B.6.15.3 Thread monitor view ............................................................................................ 196
B.6.15.3.1 Overview ....................................................................................................... 196
B.6.15.3.2 Settings dialog .............................................................................................. 197
B.6.15.4 Thread dumps view ............................................................................................. 198
B.6.15.4.1 Overview ....................................................................................................... 198
B.6.16 Monitor view section .................................................................................................. 199
B.6.16.1 Overview ............................................................................................................. 199
B.6.16.2 Locking graphs .................................................................................................... 200
B.6.16.2.1 Overview ....................................................................................................... 200
B.6.16.2.2 Current locking graph ................................................................................... 201
B.6.16.2.3 Locking history graph .................................................................................... 201
B.6.16.2.4 Settings dialog .............................................................................................. 203
B.6.16.3 Monitor views ...................................................................................................... 204
B.6.16.3.1 Overview ....................................................................................................... 204
B.6.16.3.2 Current monitors ........................................................................................... 205
B.6.16.3.3 Monitor history .............................................................................................. 205
B.6.16.3.4 Monitor history settings ................................................................................. 205
B.6.16.4 Monitor usage statistics ....................................................................................... 206
B.6.16.4.1 Overview ....................................................................................................... 206
B.6.16.4.2 Option dialog ................................................................................................. 206
B.6.17 VM telemetry view section ......................................................................................... 207
B.6.17.1 Overview ............................................................................................................. 207
B.6.17.2 Settings dialog ..................................................................................................... 209
B.7 Snapshot comparisons ....................................................................................................... 210
B.7.1 Overview ...................................................................................................................... 210
B.7.2 Memory comparisons ................................................................................................... 213
B.7.2.1 Overview ............................................................................................................... 213
B.7.2.2 Objects comparison ............................................................................................... 213
B.7.2.2.1 Overview ......................................................................................................... 213
B.7.2.2.2 Settings dialog ................................................................................................ 214
B.7.2.3 Allocation hot spot comparison ............................................................................. 215
B.7.2.3.1 Overview ......................................................................................................... 215
B.7.2.3.2 Settings dialog ................................................................................................ 215
B.7.2.4 Allocation tree comparison .................................................................................... 216
B.7.2.4.1 Overview ......................................................................................................... 216
B.7.2.4.2 Settings dialog ................................................................................................ 217
B.7.3 CPU comparisons ........................................................................................................ 219
B.7.3.1 Overview ............................................................................................................... 219
B.7.3.2 Hot spot comparison ............................................................................................. 219
B.7.3.2.1 Overview ......................................................................................................... 219
B.7.3.2.2 Settings dialog ................................................................................................ 220
B.7.3.3 Call tree comparison ............................................................................................. 220
B.7.3.3.1 Overview ......................................................................................................... 220
B.7.3.3.2 Settings dialog ................................................................................................ 221
B.7.4 VM telemetry comparisons .......................................................................................... 223
B.7.4.1 Overview ............................................................................................................... 223
B.7.4.2 Settings dialog ....................................................................................................... 224
B.8 Offline profiling .................................................................................................................... 225
B.8.1 Overview ...................................................................................................................... 225
B.8.2 Ant task ........................................................................................................................ 227
B.8.3 Profiling API ................................................................................................................. 229
B.9 Command line export ......................................................................................................... 230
B.9.1 Snapshots .................................................................................................................... 230
B.9.1.1 Overview ............................................................................................................... 230
B.9.1.2 Command line executable ..................................................................................... 231
B.9.1.3 Ant task ................................................................................................................. 237
B.9.2 Comparisons ................................................................................................................ 239
B.9.2.1 Overview ............................................................................................................... 239
B.9.2.2 Command line executable ..................................................................................... 240
B.9.2.3 Ant task ................................................................................................................. 245
Welcome To JProfiler
Thank you for choosing JProfiler. To help you get acquainted with JProfiler's features, this manual is
divided into two sections:
We appreciate your feedback. If you feel that there's a lack of documentation in a certain area of if
you find inaccuracies in the documentation, please don't hesitate to contact us at
[email protected].
-7-
How To Order
JProfiler licenses can be purchased easily and securely online. We accept credit cards from Visa,
MasterCard/Eurocard, American Express, JCB and Diners Club. You can also pay via bank transfer,
via check or in cash.
For pricing information ant to order JProfiler please visit our shop.
For large quantities or site licenses please contact [email protected].
-8-
A Help topics
-9-
of the corresponding C-function contains the package, the class and the method of the declaration
in Java code. JNI also defines how Java data types are represented in a C/C++ library. When the
native C-function is called, it gets a "JNI environment" interface as an additional parameter. With this
environment interface, it can call Java methods, convert between C and Java data types, and perform
other JVM specific operation such as creating Java threads and synchronizing on a Java monitor.
Until Java 1.5, Sun offered an ad-hoc profiling interface for tool vendors, the Java Virtual Machine
Profiling Interface (JVMPI). The JVMPI was not standardized and its behavior varied considerably
across different JVMs. In addition, the JVMPI was not able to run with modern garbage collectors
and had problems when profiling very large heaps. With Java 1.5, the JVM Tool Interface (JVMTI)
was added to the Java platform to overcome these problems. JProfiler supports both JVMPI and
JVMTI. The interfaces are defined in in jvmpi.h and jvmti.h They utilize the JNI for communication
with the JVM, but provide an additional interface to configure profiling options. JVMPI and JVMTI are
event-based systems. The profiling agent library can register handler functions for different events.
It can then enable or disable selected events.
Disabling events is important for reducing the overhead of the profiler. For example, in JProfiler, object
allocation recording is switched off by default. When you switch on allocation recording in the GUI,
the profiling agent tells the JVMPI/JVMTI interface that the event for object allocations should be
enabled. If a lot of objects are created, this can produce a considerable overhead, both in the JVM
itself as well in the profiling agent that has to perform bookkeeping operations for each event. During
the startup phase of an application server, a lot of objects are created that you're most likely not
interested in. Consequently, it's a good idea to leave object allocation recording switched off during
that time. It increases the performance of the profiled application and reduces clutter in the generated
data. The same goes for the measurement of method calls, called "CPU profiling" in JProfiler.
The JVMPI/JVMTI interface offers the following types of event:
- 10 -
reporting every single method call in the JVM is very large. The JVMTI profiling interface does not
offer this instrumentation type since it doesn't play well with hotspot compilation.
• Events for monitor contention
Whenever you call synchronized methods, use the synchronize keyword or call Object.wait(),
the JVM uses Java monitors. Events that concern these monitors, such as trying to enter a monitor,
entering a monitor, exiting a monitor or waiting on a monitor are reported to the profiling agent.
From this data, the deadlock graph and the monitor contention views are generated in JProfiler.
• Events for the garbage collector
Garbage collector activity is reported to the profiling agent. The garbage collector telemetry view
in JProfiler is based on these events.
Some information, like references between objects as well as the data in objects, are not available
from the events that the JVMPI/JVMTI fires. To get exhaustive information on all objects on the heap,
the profiling agent can trigger a "heap dump". This command is invoked when you take a snapshot
in the heap walker. The heap dump is performed differently for JVMPI and JVMTI: The JVMPI packs
all the objects on the heap and the references between them into a single byte array and passes it
to the profiling agent. That byte array is then parsed by the profiler and converted to an internal
representation. Naturally, the memory requirements of this operation are huge: first, the heap is
essentially duplicated in the byte array, then the profiling agent must parse it and translated it to data
structures. In order to reduce the peak of the memory requirement, JProfiler saves the byte array to
a temporary file on disk, releases the array and parses the contents of the temporary file. When
profiling an application that maxes out the available physical memory, taking a heap dump can crash
the JVM, simply because not enough physical memory is available to allocate the huge required
regions of memory. With JVMTI (>= 1.5) the situation has much improved. With JVMTI, JProfiler can
enumerate all existing references in the heap and build up its own data structures.
How the profiling agent is activated
Unlike a JNI library that you load and invoke from Java code, the profiling agent has to be activated
at the very beginning of the JVM startup. This is achieved by adding the special JVM parameters
-Xrunjprofiler
for Java <=1.4.2 (JVMPI) or
- 11 -
Unlike basic profilers that collect data and write out a data file to disk, advanced profilers can display
the profiling data at runtime. Although it would be possible to start the GUI directly from the profiling
agent, it would be a bad idea to do so, since the profiled process would be disturbed by the secondary
application and remote profiling would not be possible. Because of this, the JProfiler GUI is started
separately and runs in a separate JVM. The communication between the profiling agent and the GUI
is via a TCP/IP network socket. This is also the case if you start applications in JProfiler that are
configured as "local" sessions.
In order to profile successfully, it's important to choose the right profiling parameters, especially the
filters that limit the extent of the recorded call tree. Since this information is required at startup, the
profiling agent stops the JVM and waits for a connection from the GUI where these parameters are
configured. Once the connection has been established, the profiled application is allowed to start up.
The recorded profiling data resides in the internal data structures of the profiling agent. Only a small
part of the recorded data is actually transferred to the GUI. For example, if you open the call tree or
the back-traces in the hotspots views, only the next few levels are transferred from the agent to the
GUI. If the entire call tree were transferred to the GUI, potentially big amounts of data would have to
be transmitted through the socket. This would make the profiled process slower and remote profiling
between different computers would not be feasible. In essence, you could say that the profiling agent
keeps a database of the recorded profiling data while the GUI is a client that sends user-initiated
queries to the database.
- 12 -
A.1.2 Configuring Profiling Settings
What are profiling settings?
Profiling settings are settings that control the way profiling data is recorded. On older JVMs (1.5.0
and earlier), they must be adjusted according to your personal needs before the session is started.
For modern JVMs (1.6.0 and later), JProfiler is able to change profiling settings at runtime. Any change
in the profiling settings clears all recorded data. View settings can be changed during a running
session without loss of recorded data. The primary distinction between profiling settings and view
settings is that profiling settings determine how much data is recorded.
Profiling settings are persistent, just like view settings. Every change you make to the profiling settings
will be remembered across restarts. The help on sessions [p. 64] explains under what circumstances
changes in the profiling settings can be applied to an active session.
Limiting the recorded profiling data
Why doesn't JProfiler just record everything it can and show it to the user? The answer is twofold:
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.
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".
Accessing the profiling settings
There are three locations where you can access the profiling settings in JProfiler.
- 13 -
• 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 Session->Application 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.
- 14 -
A.1.3 Method Call Recording - Collection Methods and Influence on Performance and Data
Call trees and call stacks
At first glance, it might seem that the method call recording settings only influence the CPU section
of JProfiler. However, the memory section as well as the thread section display information that
originates from the call tree that is built by the profiling agent of JProfiler: the call tree view, the
allocation call tree, the stack traces in the monitor views and locking graphs as well as many other
views all depend on the same call tree. The call tree is always recorded, even if "CPU recording" is
switched off in JProfiler.
Selecting the right method call recording type is crucial for a successful profiling run. As explained in
the article on profiling settings [p. 13] , the aim is to get the best runtime performance while retaining
an acceptable level of informational detail. While the most important profiling setting in this regard is
the filter configuration [p. 17] , the method call recording type complements this choice. Each method
call recording type has various limitations that you have to bear in mind when configuring call tree
filters.
The different types of method call recording
There are three different methods for recording the call tree that have different advantages and
disadvantages:
• Dynamic instrumentation
This is JProfiler's default mode. Before unfiltered classes are loaded by the JVM, JProfiler injects
bytecode into the methods of that class that report the entry and exit of a method as well as the
invocation of any filtered method. Filtered classes are not touched and run without overhead. If
most classes are filtered, this mode causes low overhead while providing highly detailed
measurements. Typically, the entire JRE and any framework classes are filtered so that dynamic
instrumentation is most often the best choice. Since there are some classes in the java.* and
sun.* packages that the profiling agent does not get a chance to modify, the internal calls of these
packages cannot be resolved with dynamic instrumentation. However, for most applications this
is not a problem.
• Sampling
"Sampling" means to periodically take measurements that are called "samples". In the case of
profiling, an additional thread periodically halts the entire JVM and inspects the call stack of each
thread. The period is typically 5 ms, so that a large number of method calls can occur between
two samples.
The advantage of sampling is that its performance overhead is not very sensitive to the filter settings.
Even without any filters, sampling is still fast since it operates with big granularity in time. You might
ask why it is not possible to decrease the sampling time into the microsecond range to achieve a
better resolution. The answer is that the process of sampling is a very expensive operation. Halting
the entire JVM and querying the call stacks of a threads takes a lot of time. If you do this too often,
sampling will actually become slower than dynamic or full instrumentation.
Sampling has two other important informational deficiencies: Since sampling does not monitor the
entry and the exit of method calls, there's no invocation count in the CPU views of JProfiler.
Furthermore, the allocation spots for objects are only approximate. The actual call stack might
always be deeper than the reported one. Consider the above example where objects allocated by
B.subOp() between time x and time x + 5 ms are reported as being allocated by B.calculate().
The problem is that this informational deficiency is not systematic, but statistical: the confusion
sets in when at some later time two subsequent samples both produce the first call stack. Now
some objects that are allocated by B.subOp() are reported correctly, but not all of them. To get
around this deficiency, JProfiler has an option to record the exact allocation spots for sampling. In
this case, the profiling agent does not rely on the call tree as recorded by the sampler. Rather,
after each object allocation, it queries the JVMPI/JVMTI for the call stack of the current thread.
- 15 -
However, this is an expensive operation and if you create a lot of objects the performance of the
profiled application may suffer quite a lot.
To conclude, sampling is best suited for performance bottleneck searches with all filters turned off.
• Full instrumentation
The profiling agent can ask the JVMPI/JVMTI to report each and every method call, so that the
profiling agent can measure it. While this may sound like a good idea at first, in practice, the
performance overhead of this "full instrumentation" is too large. Except when you have to display
the internal call structure of classes in the java.* and sun.* packages, this method call recording
type is not recommended.
- 16 -
A.1.4 Filters for Method Call Recording - How They Work and How They Are Configured
Introduction
Method call recording filters determine the detail level that JProfiler uses when recording call sequences
in the profiled application. Filtering helps to eliminate clutter and decrease the profiling overhead for
the profiled application. Also see the article on profiling settings [p. 13] for a discussion of profiling
settings in general.
Since the internal data storage of CPU data in JProfiler is similar to the invocation tree, method call
recording filters are most easily explained while looking at the call tree view [p. 172] . As an example,
we profile the "Animated Bezier Curve" demo session that comes with JProfiler. When talking about
filters, it is important to define the distinction between your code and framework or library code. Your
code should be unfiltered, framework or library code should be filtered. In our example, the
BezierAnim class is code written by you and the JRE is library code.
What are method call recording filters?
The call tree shows call sequences. Each node and each leaf of the call tree corresponds to a certain
call stack that has existed one or multiple times while CPU recording was switched on. You will notice
that there are different icons for nodes in the tree. Among other things, these icons serve to highlight
if classes are filtered or not.
The methods of a filtered class (alternatively the class or containing package itself, depending on the
aggregation level) are endpoints in the call tree, i.e. their internal call structure will not be displayed.
Also, any methods in other filtered classes that are called subsequently, are not resolved. If, at any
later point in the call sequence, the method of an unfiltered class is called, it will be displayed normally.
In that case, the call tree shows the filtered parent method with a special icon that indicates that
it is from a filtered class and that there may be other method calls in between. The inherent time of
those missing method is added to the time of the filtered parent method. In JProfiler's terminology,
this is called an "upward filter bag".
Example with and without filters
The image below illustrates the different node types for a profiling run of the BezierAnim class:
In the above call tree, the java.* package is filtered, so only the first method in the the AWT event
dispatch thread is shown. However, the AWT is a complex system and the
java.awt.EventDispatchThread.run() does not call BezierAnim.paint() directly. If we
switch to full instrumentation and disable all filters, the call tree looks like this:
- 17 -
Now, the entry method into your code - BezierAnim.paint() - is substantially more difficult to
find. In cases where events are propagated through a complex container hierarchy, the call tree can
become many hundreds of levels deep and it becomes next to impossible to interpret the data. In
addition, calls like java.awt.Graphics2D.setPaint() show their internal structure and
implementation classes. As a Java programmer who is not working on the JRE itself, you probably
do not know or care that the implementation class is actually sun.java2d.SunGraphics2D. Also,
the internal call structure is most likely not relevant for you, since you have no control over the
implementation. It just distracts from the main goal: how to improve the performance of your code.
Not only is it easier to interpret a call tree that has proper method call recording filters, but also the
profiling overhead of the profiled application is much lower. Recording the entire call tree without
filters uses a lot of memory and measuring each call takes a lot of time. Both these considerations
especially apply to application servers, where the surrounding framework is often extremely complex
and the proportion of executed framework code to your own code might be very big.
Configuring method call recording filters
Method call recording filters are part of the profiling settings of a session. Please see the article on
profiling settings [p. 13] for an explanation on how to change the profiling settings for a session. The
help on sessions [p. 64] explains under what circumstances changes in the profiling settings can be
applied to an active session.
There are two alternative ways in JProfiler to specify the filtered classes:
- 18 -
With inclusive filters you define a list of packages and classes that should not be filtered. The call
tree is only resolved for packages and classes that you have specified, all other classes are filtered.
This approach is recommended if you have a lot of different library or framework classes that are
not contained in JProfiler's default list of filter sets, or if your code base is very large and you're
only interested in certain parts of it.
View filters
In addition to the method call recording filters, there is a view filters control at the bottom of all views
that display call trees. View filters are similar to inclusive filters and can be changed during a session.
However, they can only reduce the recorded information by taking out classes that do not correspond
to the selected view filter.
In the call tree, they have a similar behavior like the call tree collection filters. In the hot spot views,
they simply hide all classes that do not correspond to the filter selection. This is very different from
method call recording filters, where the hot spots themselves change with different filter settings.
- 19 -
A.1.5 Remote Profiling - Application Servers and Standalone Applications
Introduction
Although it is easiest to profile applications and application servers that are running on your local
machine, sometimes it is not possible to replicate the execution environment on your computer. If
you have no physical access to the remote machine or if the remote machine has no GUI where you
could run JProfiler, you have to set up remote profiling.
Remote profiling means that the profiling agent is running on the remote machine and the JProfiler
GUI is running on your local machine. Profiling agent and JProfiler GUI communicate with each other
through a socket. As explained in the background article on JProfiler [p. 9] , this situation is
fundamentally the same as running a "local session", just that the socket communication socket
connects between different machines. The main difference for you is that for local sessions you don't
have to worry about the location of native libraries and that the startup sequence can be managed
by JProfiler.
The remote integration wizard
All integration wizards in JProfiler can help you with setting up remote profiling. After choosing the
integration type or application server, the wizard asks you where the profiled application is located.
If you choose the remote option, there will be additional questions regarding the remote machine.
When the remote integration wizard asks you for startup scripts or other files of the application server
on the remote machine it brings up a standard file selector. If the file system of the remote machine
is accessible as a network drive or mounted into your file system, you can select those files and
JProfiler will directly write modified files to the right location.
If you do not have direct access to the file system of the remote machine, you have two options: You
can use the console integration wizard by executing bin/jpintegrate on the remote machine.
Alternativly, you can copy the required files to the local machine and use the "remote" option in the
integration wizard. However, you must then transfer the modified or new files back to the remote
machine after the integration wizard has completed.
Requirements for remote profiling
Although the integration wizards in JProfiler give you all required information, it's always a good idea
to have a little more inside knowledge about the mechanics and the requirements of remote profiling.
When trouble-shooting a failed integration, you should check that the requirements below are fulfilled
correctly.
The following requirements have to be satisfied for remote profiling:
1. JProfiler has to be installed on the local machine and on the remote machine. If the remote machine
is a Unix machine, you might not be able to run the GUI installer of JProfiler. In this case, please
use the .tar.gz archive to install JProfiler.
Unless you specified the "nowait" parameter on the command line together with a "config" argument,
(only necessary for pre 1.6 JVMs), you do not have to enter a license key on the remote machine,
the license key is always provided by the JProfiler GUI. Because of that, it is sufficient to unpack
JProfiler to any directory where you have write permission.
2. The operating system and the architecture of the remote machine must be explicitly supported by
JProfiler. Please see the list of supported platforms for more information. JProfiler is not a pure
Java application, it contains a lot of native code which is not easily portable to unsupported platforms.
3. On the remote machine, you have to add a number of VM parameters to the java invocation of
your application server or your standalone application. The fundamental VM parameters are
-Xrunjprofiler for Java <=1.4.2 (JVMPI) and -agentpath:[path to jprofilerti
library] for Java >=1.5.0 (JVMTI), which tell the JVM to load the native profiling agent. The help
- 20 -
page on remote sessions [p. 89] in the reference section tells you the corresponding path to the
jprofilerti library for all platforms.
Depending on your JVM and your platform, you have to add further VM parameters to your java
invocation. The remote session invocation table [p. 93] in the reference section gives you the exact
parameter sequence for your configuration.
This is all that is required to profile a modern JVM (Java 1.5 and later).
4. For Java <=1.4.2 (JVMPI), more steps are necessary. You also have to add
-Xbootclasspath/a:{path to agent.jar} which adds required Java classes to the
bootclasspath. agent.jar is located in the bin directory of your JProfiler installation. In addition,
the native library path on the remote machine must contain the platform-specific directory in the
bin directory of the JProfiler installation. The "native library path" is defined by a different
environment variable on each platform. For example, on Windows, it is simply the PATH environment
variable, on Linux it is LD_LIBRARY_PATH. The help page on remote sessions [p. 89] in the
reference section tells you the corresponding environment variables for all platforms.
5. On the local machine, you have to define a remote session whose "host" entry points to the remote
machine.
1. Execute the modified start script on the remote machine. Depending on what option you have
chosen in the remote profiling wizard, there are two startup sequences: either the application or
application server starts up completely, or it prints a few lines of information and tells you that it is
waiting for a connection. With Java 1.6.0 and later, the profiling options will be sent to the profiling
agent when the GUI connects and you don't have to copy your config file to the server.
With Java 1.5.0 and earlier, changing profiling settings at runtime is not possible. In the case where
the application does not wait for a connection from the JProfiler GUI, the profiling agent loads the
profiling configuration from the config.xml file you have copied to the server as instructed by
the integration wizard.
2. Start the remote session in the JProfiler GUI on the local machine. The remote session will connect
to the remote computer and the remote application or application server will then start up if it waited
for the GUI connection.
Trouble-shooting
When things don't work out as expected, please have a look at the terminal output of the profiled
application or application server on the remote machine. For application servers, the stderr stream
might be written to a log file. Depending on the content of the stderr output, the search for the problem
takes different directions:
• If stderr contains "Waiting for connection ...", the configuration of the remote machine
is ok. The problem might then be related to the following questions:
• Did you forget to start the remote session in the JProfiler GUI on your local machine?
• Is the host name or the IP address correctly configured in the remote session?
• Is there a firewall between the local machine or the remote machine?
- 21 -
• If stderr contains an error message about not being able to bind a socket, the port is already in
use. The problem might then be related to the following questions:
• Did you start JProfiler multiple times on the remote machine? Each profiled application needs
a separate communication port. Please see below on how to change that port.
• Are there any zombie java processes of previous profiling runs that are blocking the port? In
this case please kill these processes.
• Is there a different application on the remote machine that is using the JProfiler port? Please
see below on how to change the port for JProfiler.
The communication port is defined as a parameter to the profiling agent VM parameter. To define
a communication port of 25000, please change this VM parameter to
-Xrunjprofiler:port=25000 for Java <=1.4.2 (JVMPI) or -agentpath:[path to
jprofilerti library]=port=25000 for Java >=1.5.0 (JVMTI). Also, please make sure that
the same port is configured in the remote session in the JProfiler GUI on your local machine. Please
note that this port has nothing to do with HTTP or other standard port numbers and must not be
the same as any port that's already in use on the remote machine.
• For Java 1.4.2 and earlier, if stderr contains an error message about not being able to load native
libraries, the native library path is not configured correctly. Please see the requirements above on
how to configure the native library directory. If the problem persist, it might be a problem with
dependencies. On Unix platforms, you can execute
- 22 -
A.1.6 Replacing Finalizers With Phantom References
Why finalizers are bad
Sometimes one must perform pre-garbage collection actions such as freeing resources. In a JDBC
driver, for example, a database connection may be held by a connection object. Before the connection
object is garbage collected, the actual database connection must be closed. In such a case, one
typically cannot rely on the close() method being called by the user application code.
Most often, finalizers are used to solve this problem. A finalizer is created by overriding the
finalize() method of java.lang.Object. In that case, before the object is garbage collected,
this finalize method will be called. Unfortunately, there are severe problems with the design of this
finalizer mechanism. Using finalizers has a negative impact on the performance of the garbage
collector and can break data integrity of your application if you're not very careful since the "finalizer"
is invoked in a random thread, at a random time. If you use a lot of finalizers, the finalizer system may
be completely overwhelmed which can lead to OutOfMemoryErrors. In addition, you have no control
about when a finalizer will be run, so it can create problems with locking, the shutdown of the JVM
and other exceptional circumstances.
The solution is to eliminate finalizers where they are not strictly required and replace the necessary
ones with phantom references.
What are phantom references?
Phantom references can be used to perform actions before an object is garbage collected in a safe
way. In the constructor of a java.lang.ref.PhantomReference, you specify a
java.lang.ref.ReferenceQueue where the phantom reference will be enqueued once the
referenced object becomes "phantom reachable". Phantom reachable means unreachable other than
through the phantom reference. The initially confusing thing is that although the phantom reference
continues to hold the referenced object in a private field (unlike soft or weak references), its
getReference() method always returns null. This is so that you cannot make the object strongly
reachable again.
From time to time, you can poll the reference queue and check if there are any new phantom references
whose referenced objects have become phantom reachable. In order to be able to to anything useful,
one can for example derive a class from java.lang.ref.PhantomReference that references
resources that should be freed before garbage collection. The referenced object is only garbage
collected once the phantom reference becomes unreachable itself.
How to replace finalizers with phantom references
Let's continue with the example of the JDBC driver above: Before a connection object is garbage
collected, the actual database connection must be closed. The following steps are necessary to
achieve this with phantom references:
- 23 -
private ReferenceQueue queue = new ReferenceQueue();
• Derive a class from PhantomReference that references resources
You will not be able to access the original object from a phantom reference. Therefore, you have
to add the resources that must be freed to the phantom reference itself. In our example JDBC
driver this could be a class named DatabaseConnection. The phantom reference class will thus
look like:
- 24 -
referenceThread.setDaemon(true);
referenceThread.start();
The phantom reference is removed from the phantomReferences list. Now the phantom reference
is unreferenced itself and the referenced object can be garbage collected.
- 25 -
A.1.7 Offline Profiling and Triggers
Introduction
There are two fundamentally different ways to profile an application with JProfiler: By default, you
profile with the JProfiler GUI attached. The JProfiler GUI provides you with buttons to start and stop
recording and shows you all profiling data. However, there are situations where you would like to
profile without the JProfiler GUI and analyze the results later on. For this scenario, JProfiler offers
offline profiling. Offline profiling allows you you start the profiled application with the profiling agent
but without the need to connect with a JProfiler GUI.
However, offline profiling still requires some actions to be performed. At least one snapshot has to
be saved, otherwise no profiling data will be available for analysis later on. Also, to see CPU or
allocation data, you have to start recording at some point. Similarly, if you wish to be able to use the
heap walker in the saved snapshot, you have to trigger a heap dump at some point.
Profiling API
The first solutions to this problem is the offline profiling API [p. 225] . With the offline profiling API, you
can programmatically invoke all profiling actions in your code.
The drawback of this approach is that you have to add the JProfiler agent library to the class path of
your application during development, add temporary profiling code to your source code and recompile
your code each time you make a change to the programmatic profiling actions.
Triggers
With triggers [p. 80] , you can specify all profiling actions in the JProfiler GUI without modifying your
source code. Triggers are saved in the JProfiler config file. The config file and the session id are
passed to the profiling agent on the command line when you start with offline profiling enabled, so
the profiling agent can read those trigger definitions.
In contrast to the profiling API use case where you add calls to your source code, triggers are activated
when a certain event occurs in the JVM. For example, if you would have added a call to a certain
profiling action at the beginning or at the end of a method when using the profiling API, you can use
- 26 -
a method invocation trigger instead. Instead of creating your own timer thread to periodically save a
snapshot, you can use a timer trigger.
Each trigger has a list of actions that are performed when the associated event occurs. Some of these
actions correspond to profiling actions in the offline profiling API. In addition there are other actions
that go beyond the controller functions such as the actions to print method calls with parameters and
return values or the action to invoke an interceptor for a method.
- 27 -
A.2 Memory Profiling
A.2.1 Recording Objects
Introduction
By default, JProfiler does not track the creation of all objects. This reduces the runtime overhead of
the profiling agent regarding execution speed as well as memory consumption.
However, allocation recording is not only a way to increase runtime performance, it also helps you to
focus on important parts of your application and to reduce clutter in the memory views. Imagine you
have a web application that's started in the framework of an application server. The server allocates
a huge number of objects in a great number of classes. If you want to focus on the objects created
by your web application, the objects from the server startup will be in the way. In JProfiler, you can
start allocation recording before you perform a certain action and so reduce the displayed objects to
those that are allocated as a direct consequence of that action.
Starting and stopping allocation recording
The profiler menu as well as the toolbar allow you to start and stop allocation recording. If no allocations
have ever been recorded, the dynamic memory views show placeholders with the corresponding
"record" button. If you wish to enable allocation recording for the entire application run, you can do
so in the profiling settings dialog
When you stop allocation recording, the garbage collection of the recorded objects will still be tracked
by the dynamic memory views. In this way you can observe if the objects created during a certain
period of time are actually garbage collected at some point. Please note that the manual garbage
collection button in JProfiler just invokes the System.gc() method. This leads to a full GC in 1.3
JREs where the garbage collector makes the best effort to remove all unreferenced objects. However,
1.4 and 1.5 JREs perform incremental garbage collection, so full garbage collection is not available
when working with such a recent JRE. To check if the remaining objects are really referenced, or if
the garbage collector just doesn't feel like collecting them yet, you can take a heap snapshot. The
heap walker offers the option "Remove unreferenced and weakly referenced objects" which is the
equivalent of a full GC.
JProfiler also keeps statistics on garbage collected objects. All dynamic memory views have a mode
selector where you can choose whether to display only live objects on the heap, only garbage collected
objects, or both of them.
When you have stopped allocation recording and you restart it, the previous contents of the dynamic
memory views will be deleted. In this way, allocation recording gives you the ability to do differencing
of the heap between two points in time.
If you have very specific requirements as to where allocation recording should start and stop, you
can use the offline profiling API [p. 229] to control allocation recording programmatically.
Implications of unrecorded objects
For "unrecorded" objects there are the following implications:
• JProfiler does not know the allocation spot for an unrecorded object. This becomes apparent in
the heap walker. The heap walker takes a heap snapshot and is able to show all objects on the
heap, however, the allocation information is not available from the JVMPI/JVMTI and the
"Allocations" view will contain top-level method nodes that are labeled as "Unrecorded objects".
• JProfiler does not know the class name for an unrecorded object. This influences the monitor views
and locking graphs where JProfiler is only able to display the name of a monitor object if the object
has been recorded.
The object graph in the VM telemetry views is not affected by allocation recording.
- 28 -
Allocation recording and the heap walker
In the heap walker options dialog that is displayed before a heap snapshot is taken, the first option
is labeled "Select recorded objects". This allows you to work with a set of objects that has been created
during a certain period of time. This is just an initial selection step and does not mean that the heap
walker will discard all unrecorded objects. In the reference view you can still reach all referenced and
referencing objects and create a new object set with unrecorded objects.
If you use the "take heap snapshot with selection" action in the dynamic memory views, the number
of selected objects will only match approximately, if "Select recorded objects" is checked and "Remove
unreferenced and weakly referenced objects" is not checked in the heap walker options dialog. The
numbers might still not match exactly since the dynamic memory views can change in time while a
heap snapshot is fixed.
- 29 -
A.2.2 Using the Difference Column in the Memory Views
Introduction
In contrast to allocation recording [p. 28] , where you can restrict the displayed objects to a certain
period of time, a common situation is that you want to retain all recorded objects but still see the
difference of object allocations with respect to a certain point in time. In particular, you might be
interested in which classes have a decreasing allocation count, something that would not be possible
with allocation recording.
Memory views with differencing
By default the difference column is not displayed. Only when you choose View->Mark current values
or the corresponding toolbar button, the difference column is shown as the last column. The following
views in JProfiler have an optional difference column:
In most cases you'll be interested in sorting the view by the values in the difference column. There
are two sort modes that can be adjusted in the view settings dialog:
• absolute ordering
With absolute ordering, the absolute value of the difference will be used for sorting. This is
appropriate if you're interested in the biggest changes.
• normal ordering
With normal ordering, you'll have positive differences at the top, then a usually long list of zero
differences and finally the negative differences. This is the right setting if you're looking for a memory
leak and are only interested in positive differences.
- 30 -
A.2.3 Finding a Memory Leak
Introduction
Unlike C/C++, Java has a garbage collector that eventually frees all unreferenced instances. This
means that there are no classic memory leaks in Java where you forget to delete an object or a
memory region. However, in Java you can forget something else: to remove all references to an
instance so that the object can be garbage collected. If an object is only ever held in a single location,
this may seem simple, but in many complex systems objects are passed around through many layers,
each of which can add a permanent reference to the object.
Sometimes it appears to be clear that an object should be garbage collected when looking at the local
environment of where the object is created and discarded. However, any call to a different part of a
system that passes the object as a parameter can cause the object to "escape" if the receiver
intentionally or by mistake continues to hold a reference to the object after the call has completed.
Often, over-eager caching with the intention to improve performance or design mistakes where parallel
access structures are built are the reason for memory leaks.
Recognizing a memory leak
The first step when suspecting a memory leak is to look at the heap and object telemetry views. When
you have a memory leak in your application, these graphs must show a linear positive trend with
possible oscillations on top.
If there's no such linear trend, your application probably simply consumes a lot of memory. This is
not a memory leak and the strategy for that case is straightforward: Find out which classes or arrays
use a lot of memory and try to reduce their size or number or instances.
Using differencing to narrow down a memory leak
The first stop when looking for the origin of a memory leak is the differencing action [p. 30] of the all
objects view and the recorded objects view. Simple memory leaks can sometimes be tracked down
with the differencing function alone.
First, you observe the differences in the all objects view or the recorded objects view and find out
which class is causing the problems. Then you switch to the allocation hotspots view, select the
problematic class and observe in the difference column in which method the problematic instances
are allocated. Now you know the method in which these instances were created.
An analysis of the code for this method and the methods to which these instances are passed may
already yield the solution to the memory leak. If not, you have to continue with the heap walker.
Another tool to observe instance counts that also presents a history of values is the class tracker.
The class tracker shows graphs of instance counts versus time for selected classes and packages.
When the difference columns in the "all objects" or "recorded objects" views identify suspicious classes,
the class tracker can often generate further insight into the evolution of these instance counts since
you can correlate jumps or increases in the allocation rate with other telemetry views or bookmarks.
The heap walker and memory leaks
When you take a heap snapshot, you first have to create an object set with those object instances or
arrays that should be freed by the garbage collector but are still referenced somewhere. If you've
already narrowed down the origin of the memory leak in the dynamic memory views, you can use the
"Take heap snapshot for selection" action to save you some work and to start in the heap walker right
at the point where you left off in the dynamic memory views.
By default, the heap walker cleans a heap snapshot from objects that are unreferenced but are still
not collected by the garbage collector. This behavior can be controlled by the "Remove unreferenced
and weakly referenced objects" option in the heap walker options dialog. When searching for a memory
leak, this "full garbage collection" is desirable, since unreferenced objects are a temporary phenomenon
without any connection to a memory leak.
- 31 -
If necessary, you can now further narrow down the memory leak by adding additional selection steps.
For example, you can go to the data view and look at the instance data to find out a number of
instances that definitely should have been freed. By flagging these instances and creating a new set
of objects you can reduce the number of objects that are in your focus.
Using the biggest objects view to find the reason for a memory leak
Many memory leaks can be traced to object clusters that should be freed but are erroneously held
alive through a single string reference. This will lead to a number of objects that have a very large
retained size. "Retained size" is the memory that would be freed by the garbage collector if an object
were to be removed from the heap. The biggest objects view lists the objects with the biggest retained
sizes together with the tree of retained objects. You can use that tree to drill down to find the erroneous
references.
Using the reference graph to find the reason for a memory leak
The core instrument for finding memory leaks is the reference graph in the heap walker. Here you
can find out how single objects are referenced and why they're not garbage collected. By successively
opening incoming references you may spot a "wrong" reference immediately. In complex systems
this is often not possible. In that case you have to find one or multiple "garbage collector roots".
Garbage collector roots are points in the JVM that are not subject to garbage collection. These roots
emanate strong references, any object that is linked by a chain of references to such a root cannot
be garbage collected.
When you right-click on an object in the reference view, the context menu offers the option to search
for paths to the garbage collector roots:
Potentially there are very many garbage collector roots and displaying them all can lead to the situation
that a sizable fraction of the entire heap has to be shown in the reference graph. Also, looking for
garbage collector roots is computationally quite expensive, and if thousands of roots can be found,
the computation can take very long and use a lot of memory. In order to prevent this, it is recommend
to start with a single garbage collector root and search for more roots if required. An option dialog is
displayed after you trigger the search:
- 32 -
As you can see in this example, the chain to a garbage collector root can be quite long:
The reason for a memory leak can be anywhere along this chain. It is of a semantic nature and cannot
be found out by JProfiler, but only by the programmer. Once you have found the faulty reference, you
can work on your code to remove it. Unless there are other references, the memory leak will be gone.
Using the cumulated references views to find the reason for a memory leak
In some cases, you might not succeed in narrowing down the object set to a reasonable size. You
object set might still contain a large number of instances that are OK and using the reference graph
might not provide any insight in this situation.
- 33 -
If such a situation arises, the cumulated reference tables available in the reference view of the heap
walker can be of help. The cumulated incoming reference table shows all possible reference types
into the current object set:
From the reference type, you may be able to narrow down the object set. For example, you may know
that one type of reference is OK, but another is not. As a hypothetical example, the reference from
HashMap$Entry in the table above might be OK, but the reference from java.util.jar.Manifest
might be suspicious. By selecting the 8 objects who are referenced in this way, you can discard the
other 224 instances and use the reference graph to show the path to a garbage collector root.
- 34 -
A.3 CPU Profiling
A.3.1 Time Measurements in Different CPU Views
Wall clock time and CPU time
When the duration of a method call is measured, there are two different possibilities to measure it:
• Most likely you'll be interested in the wall clock time, that is the duration between the entry and
the exit of a method as measured with a clock. For the profiling agent this is a straightforward
measurement. While it might seem at first glance that measuring times should not have any
significant overhead, this is not so if you need a high resolution measurement. Operating systems
offer different timers with different performance overheads.
For example, on Microsoft Windows, the standard timer with a granularity of 10 milliseconds is
very fast, because the operating system "caches" the current time. However, the duration of method
calls can be as low as a few nanoseconds, so a high resolution timer is needed. A high resolution
timer works directly with a special hardware device and carries a noticeable performance overhead.
In JProfiler, CPU recording is disabled by default, however, method call recording is always enabled.
If you compare the duration of the startup sequence of an application server with and without CPU
recording, you will notice the difference.
Wall clock time is measured separately for each thread. In CPU views where the thread selection
includes multiple threads, the displayed times can be larger than the total execution time of the
application. If you have 10 parallel threads of the same class MyThreadClass whose run()
method take 1 second and "All threads" is selected in the call tree, the MyThreadClass.run()
node in the call tree will display 10 seconds, even though only one second has passed.
• Since the CPU might be handling many threads with different priorities, the wall clock time is not
the time the CPU has actually spent in that method. The scheduler of the operating system can
interrupt the execution of a method multiple times and perform other tasks. The real time that was
spent in the method by the CPU is called the CPU time. In extreme cases, the CPU time and the
wall clock time can differ by a large factor, especially if the executing thread has a low priority.
The standard time measurement in JProfiler is wall clock time. If you wish to see the CPU time in
the CPU views, you can change the measurement type in the profiling settings. The problem with
CPU time measurement is that most operating systems provide this information with the granularity
of the standard timer - high resolution measurements would carry to much overhead. This means
the CPU times are only statistically valid for method that have a CPU time bigger that the typical
granularity of 10 milliseconds.
Thread statuses
The notion of time measurement must be refined further, since not all times are equally interesting.
Imagine a server application with a pool of threads that waiting to perform a task. Most of the time
would then be in the method that keeps the threads waiting while the actual task will only get a small
part of the overall time and will be hard to spot. The necessary refinement is done with the concept
of thread status. There are 4 different thread statuses in JProfiler:
• Runnable
In this case the thread is ready to execute code. The reason that this is not called "Running" is that
it may actually not be running due to the scheduler of the operating system. However, if given a
chance, the thread will execute instructions.
• Waiting
This means that the thread has deliberately decided to enter into hibernation until a certain event
occurs. This happens when you call Object.wait() and the current thread will only become
runnable again when some other thread calls Object.notify() on the same object.
- 35 -
• Blocking
Whenever synchronized blocks of code or synchronized methods occur, there can be monitor
contention. If one thread is in the synchronized area all other threads trying to enter it will be
blocked. Frequent blocking can reduce the liveness of your application.
• Net I/O
During network operations, many calls in the Java standard libraries can block because they're
waiting for more data. This kind of blocking is called "Net I/O" in JProfiler. JProfiler knows the list
of methods in the JRE that lead to blocked net I/O and instruments them at load time.
When looking for performance bottlenecks, you're mostly interested in the "Runnable" thread state
although it's always a good idea to have a look at the "Net I/O" and "Blocking" thread states in order
to check if the network or synchronization issues are reducing the performance of your application.
Times in the call tree
Nodes in the call tree (methods, classes, packages or Java EE components, depending on the selected
aggregation level) are sorted by total time. This is the sum of all execution times of this node on the
particular call path as given by the ancestor nodes. Only threads in the current thread selection are
considered and only measurements with the currently selected thread status are shown.
Optionally, the call tree offers the possibility to show the inherent time of a node. The inherent time
is defined as the total time of of a method minus the time of its child nodes. Since child nodes can
only be in unfiltered classes, calls into filtered classes go into the inherent time. If you change your
method call recording filters [p. 15] , the inherent times in the call tree can change.
Times in the hotspots view
While the call tree view shows all call stacks in your application, the hotspot view shows the methods
that take most of the time. Each method can potentially be called through many different call stacks,
so the invocation counts in the call tree and the hotspots view do not have to match. The hotspot view
shows the inherent time rather than the total time. In addition, the hotspot view offers the option to
include calls to filtered classes into the inherent time. Please see the article on hotspots and filters
[p. 37] for a thorough discussion of this topic.
When you open a hotspot node, you see a reverse call tree. However, the times that are displayed
in those backtraces do not have the same meaning as those in the call tree, since they do not express
a time measurement for the corresponding node. Rather, the time displayed at each node indicates
how much time that particular call tree contributes to the hot spot. If there is only one backtrace, you
will see the hotspot time at each node.
Times in the call graph
The times that are shown for nodes (methods, classes, packages or Java EE components, depending
on the selected aggregation level) in the call graph are the same as those in the hotspots view. The
times that are associated with the incoming arrows are the same as those in the first level of the
hot spot backtrace, since they show all calling nodes and the cumulated duration of their calls. The
time on the outgoing arrows is a measurement that cannot be found in the call tree. It shows the
cumulated duration of calls from this node, while the call tree shows the cumulated duration of calls
from the current call stack.
- 36 -
A.3.2 The Influence of Method Call Recording Filters on Hotspots
Introduction
The notion of a performance hot spot is not absolute but relative to your point of view. The total
execution time of a method is not the right measure, since in that case your main method or the run()
method of the AWT event dispatch thread would be the biggest hotspots in most cases. Such a
definition of a hotspot would not be very useful.
At the other extreme one could use the unfiltered inherent time of the execution of a method for the
ranking of hotspots. The unfiltered inherent time is the total time minus the time spent in all other
method calls. This would not be very useful either, since the biggest hotspots will most likely always
be core methods in the JRE, like string manipulation, I/O classes or core drawing routines in obscure
implementation classes of the AWT.
As the above considerations make clear, the definition of a hotspot is not trivial and must be carefully
considered.
Definition of a hotspot
Only with filters is it possible to come up with a useful definition of a hotspot. Usually, your method
call recording filters [p. 17] will be set up in such a way that all library classes and framework classes
will be filtered out. In the following discussion, we're going to assume that this is the case.
In order to be useful a hot spot must be
Which one of these viewpoints is more helpful depends on the actual situation. JProfiler's hotspot
view offers both modes with the combo box in the top-right corner. The allocation hotspots views also
offer this mechanism of adjusting the definition of a hotspot.
Example
Let us profile the animated Bezier curve demo that comes with JProfiler. We will try out different filter
settings and check how they influence the list of hotspots. In this case we consider the BezierAnim
class to be "our" code, while the JRE classes are library classes.
We start by using the "Maximum detail" profiling setting template. Here, full instrumentation is used
and no filters are applied.
- 37 -
As we can see, most of the hotspots are implementation classes in sun.* implementation packages.
Theses classes are never called by our code. While we could open the backtraces and see how they
have been invoked, this is cumbersome and produces no insight into any performance problems that
we might be able to solve.
In the next step, we restrict our filters so that only BezierAnim and the java.awt.* packages are
unfiltered. This viewpoint is a little strange, somewhat as if the java.awt.* belonged to our code,
too. But we want to show how the inclusion of filters changes the hotspots, so we take this middle
step. We do this by customizing the "Maximum detail" profiling setting template and entering
BezierAnim, java.awt.* as inclusive filters.
Again, there are a lot of filtered classes in the list of hotspot, but while the first two hotspots have
stayed the same, the list below them is completely different to the unfiltered case.
Since we now have filters, we can change the viewpoint further by choosing the "add times to calling
class" option in the top-right combo box labeled "Filtered classes".
Now, the list has changed completely and we only see unfiltered classes.
Finally, we profile with the "All features enables, high CPU profiling detail" option, where all classes
in the JRE are filtered.
- 38 -
Any of the methods that appear in the list of hotspots have been called from our code. This is great
for finding performance bottlenecks but sometimes we only want to see our own methods. Again we
choose the "add times to calling class" option in the top-right combo box labeled "Filtered classes".
All but one method are directly from the BezierAnim class. The
java.awt.EventDispatchThread.run() method is an upward filter bag. It contains framework
calls that are executed before any method in our own code is called. This is why it cannot be included
into any of our methods.
From the above example you can see how important the filter sets and the definition of a hotspot are
for the actual results in the hotspot view. The same considerations apply to the allocation hotspot
view.
- 39 -
B Reference
1. Start up JProfiler and wait for the start center [p. 41] to appear.
2. Choose one of the demo sessions from the list of available sessions.
3. Click [OK].
4. The profiling settings dialog appears. To accept the default settings, just click [OK].
5. A terminal window is opened for the demo process and the main window of JProfiler starts displaying
profiling information [p. 107] .
The Java source code for the demo sessions can be found in "{JProfiler install
directory}/demo/">
In order to help you find JProfiler's features which are most important to you, we present a situational
overview. There are two types of uses for a profiler which arise from different motivations:
• Problem solving
- 40 -
If you turn to a profiler with a problem in your application, it most likely falls into one of the following
three categories:
• Performance problem
To find performance related problem spots in your application, turn to JProfiler's CPU section
[p. 170] . Often, performance problems are caused by excessive creation of temporary objects.
For that case, the recorded objects views [p. 121] with its view mode set to "garbage collected
objects" will show you where efforts to reduce allocations make sense.
• Excessive memory consumption
If your application consumes too much memory, the memory views [p. 118] will show you where
the memory consumption comes from. With the reference views [p. 148] in the heap walker [p.
137] you can find out which objects are unnecessarily kept alive in the heap.
• Memory leak
If your application's memory consumption goes up linearly with time, you likely have a memory
leak which is show stopper especially for application servers. The "mark current values and
show differences" feature in the memory section [p. 118] and the heap walker [p. 137] will help
you to find the cause.
• Deadlock
If you experience a deadlock, JProfiler's current monitor graph [p. 201] will help you to find the
cause even for complex locking situations.
• Hard to find bug
A often overlooked but highly profitable use of a profiler is that of debugging. Many kinds of
bugs are exceptionally hard to find by hand or by using a traditional debugger. Some bugs
revolve around complex call stack scenarios (have a look at the CPU section [p. 170] ), others
around entangled object reference graphs (have a look at the heap walker section [p. 137] ), both
of which are not easy to keep track of.
Particularly JProfiler's thread views [p. 192] are of great help in multi-threaded situations, where
race-conditions and deadlocks are hard to track down.
• Quality assurance
During a development process, it's a good idea to regularly run a profiler on your application to
assess potential problem spots. Even though an application may prove to be "good enough" in
test cases, an awareness for performance and memory bottlenecks enables you adapt your design
decisions as the project evolves. In this way you avoid costly re-engineering when real-world needs
are not met. Use the information presented in JProfiler's telemetry section [p. 207] to keep an eye
on the evolution of your application. The ability to save profiling snapshots [p. 101] enables you to
keep track of your project's evolution. The offline profiling [p. 225] capability allows you to perform
automated profiling runs on your application.
• Open session
All sessions configured by you or the preconfigured demo sessions can be started by double
clicking on a session or by selecting a session and clicking [OK] at the bottom of the start center.
In addition, sessions can be edited [p. 64] , copied or deleted by using the buttons on the right hand
side of the dialog or by invoking the context menu.
- 41 -
• New session
Sessions can be created in one of two ways:
• By manual configuration
Use the [New session] button to manually configure [p. 65] a new session. After you finish
configuring your session, it will be started.
• Through an integration wizard
Use the [New server integration] button to invoke the integration wizard [p. 42] selector. The
[New remote integration] and [New applet integration] buttons are convenience shortcuts.
After you finish configuring your session, you can either start the session immediately or the
"open session" tab will be displayed with the new session selected.
• Convert session
Here, you can convert existing local sessions to remote sessions or offline profiling sessions [p.
225] or prepare a local session for redistribution to other computers. The latter will also collect all
files for the agent that are necessary to get the agent running on remote machines. The existing
local session that is chosen for conversion will not be modified.
• Open snapshot
Previously saved sessions [p. 101] can be opened from this tab by selecting the desired *.jps file
and clicking [OK] at the bottom of the start center.
Note: For technical reasons, the open snapshot tab is not displayed on Mac OS X. Please use
Session->Open snapshot from JProfiler's main menu instead.
When you choose not to open a profiling session for an empty window and exit the start center by
clicking the [Cancel] button, all of JProfiler's views are disabled and only the general settings
(Session->General settings) and the Session and Help menus are enabled.
The start center can be invoked at any later time
• from the start center [p. 41] on the "new session" tab.
• by selecting Session->New server integration from JProfiler's main menu.
During the first step of the wizard you are asked to specify the product which is to be integrated. The
second step asks you whether the profiled application or application server is running on the local
computer or on a remote machine. In the third step you choose the desired startup mode which is
one of "Wait for connection", "Startup immediately" and "Offline profiling". The "Wait for connection"
is recommended at first. Only choose the other modes later on once you are familiar with JProfiler.
The subsequent steps depend on this choice. Please follow the instructions presented by the wizard.
- 42 -
If you miss support for a particular product, please don't hesitate to contact us through the support
request form
If no GUI is available on the remote machine you can use the jpintegrate executable in the bin
directory for the console integration wizard.
The console integration wizard will create a config file that can be imported [p. 103] in a JProfiler GUI
installation to connect zo the profiled application server without any further configuration.
- 43 -
B.2 JProfiler setup
B.2.1 JProfiler Setup Wizard
If you run JProfiler for the first time, a setup wizard will guide you through the steps to collect all
required information in order to create and run profiling sessions. Everything you enter here can be
changed at a later time through the menus of a running instance of JProfiler. The setup wizard inquires
about:
- 44 -
Together with your license key, you are asked for your name and - if applicable - for the name of your
company.
Please read the included file license.html to learn about the scope of the license.
To make it easier for you to enter the license key, you can use the [Paste from clipboard] button,
after copying any text fragment which contains the license key to your system clipboard. If a valid
license key can be found in the clipboard content, it is extracted and displayed in the dialog.
- 45 -
B.3 IDE integrations
B.3.1 JProfiler IDE Integrations
JProfiler can be integrated into the IDEs listed here [p. 46] . Installation is done either
• Automatically (recommended)
Select Session->IDE integrations from JProfiler's main menu or go to the IDE integrations tab [p.
105] in the general settings dialog [p. 104] . Now select the desired IDE from the drop down list, click
on [Integrate] and follow the instructions [p. 105] .
• Manually
The directory integrations in the JProfiler install directory holds a number of archives which
can be used for manually integrating JProfiler with any of the supported IDEs. See the file
README.txt in the above directory for detailed instructions.
After completing the instructions, you can invoke JProfiler from the integrated IDE without having to
specify class path, main class, working directory, used JVM and other options again.
All integrations insert toolbar buttons and menu entries into the respective IDE that run the application
in the IDE with profiling enabled. On Windows and Mac OS X, the IDE reuses an already running
instance of JProfiler to present profiling data. If JProfiler is not running, it will be started automatically.
Navigation to source code from JProfiler will be performed in the IDE, i.e. if you choose the "Show
source" action for a class or a method, it will be displayed in the IDE and not in JProfiler's integrated
source code viewer.
- 46 -
"Run" menu with "Profile" action
- 47 -
Editor context menu with "Profile" action
JProfiler can profile all run configuration types from IDEA, also applications servers. To configure
further settings, please edit the run configuration, choose the "Startup/Connection" tab, and select
the "Profile" entry. The screenshot below shows the startup settings for a local server configuration.
Depending on the run configuration type, you can adjust JVM options or retrieve profiling parameters
for remote profiling.
- 48 -
Startup settings for profiling of a local server configuration
For all run configuration types you can decide whether you want to open a new window in JProfiler
for the profiling session or if you wish to reuse the last window to accommodate the profiling session.
The profiled application is then started just as with the usual "Run" commands. If no instance of
JProfiler is currently running, JProfiler is also started, otherwise the running instance of JProfiler will
be used for presenting profiling data.
When JProfiler is started from IntelliJ IDEA, the "Show source" action for a class or a method in one
of JProfiler's view will show the source element in IDEA and not in JProfiler's integrated source code
viewer.
You can also open JProfiler snapshots from IDEA, either from the project window or the open file
dialog in order to get source code navigation into IDEA.
With the IDE integration for WSAD, only run configurations of type "Java application" can be profiled.
To profile a Java EE application from within WSAD, please choose Session->Integration wizards->New
server integration from JProfiler's main menu and select the server integration type IBM Websphere
started from WSAD. The integration wizard [p. 42] will lead you step by step through the required
modifications to profile your server.
- 49 -
The installation of the eclipse plugin is started by selecting "eclipse 2.x" or "IBM WSAD 5.x" on the
- 50 -
"Run" menu with "JProfiler" action
A dialog with the available launch configurations will be displayed. Choose the desired configuration
and press [OK]. If JProfiler has already been opened from eclipse, you can check the Open in new
window option to open a new window of JProfiler for the profiling session. Otherwise the last used
main window will accommodate the profiling session.
If no instance of JProfiler is currently running, JProfiler is started, otherwise the running instance of
JProfiler will be used for starting the application and for presenting profiling data. The information
contained in the launch configuration is transmitted to JProfiler. With this information, JProfiler
immediately starts a new profiling session. When you close the window, JProfiler asks you if you want
to save the session for standalone execution. If you answer with yes, you can enter a name for the
session. You will then be able to start it from the start center [p. 41] or from the open session dialog
[p. 88] if you open JProfiler as a standalone application.
All profiling settings and view settings changes are persistent across session restarts.
When JProfiler is used with the eclipse integration, the "Show source" action for a class or a method
in one of JProfiler's view will show the source element in eclipse and not in JProfiler's integrated
source code viewer.
- 51 -
Note: To configure a native library path, please define the VM parameter -Djava.library.path
in eclipse, it will be translated to the native library path by JProfiler.
The used JProfiler installation can be changed by repeating the integration from JProfiler or by adjusting
the JProfiler executable in eclipse under Window->Preferences->JProfiler. When you upgrade to a
newer version of JProfiler, make sure to repeat the integration, since the plugin has to be updated,
too.
- 52 -
eclipse "Run" menu with "Profile" actions
The profiled application is then started just as with the usual "Run" commands. If no instance of
JProfiler is currently running, JProfiler is also started, otherwise the running instance of JProfiler will
be used for presenting profiling data.
Every time a run configuration is profiled, a dialog box is brought up that asks you whether a new
window should be opened in JProfiler. To get rid of this dialog, you can select the "Don't ask me
again" checkbox. The window policy can subsequently be configured in the JProfiler settings in eclipse
(see below).
All profiling settings and view settings changes are persistent across session restarts.
When JProfiler is used with the eclipse integration, the "Show source" action for a class or a method
in one of JProfiler's view will show the source element in eclipse and not in JProfiler's integrated
source code viewer.
You can also open JProfiler snapshots from eclipse, either from the project window or the open file
dialog in order to get source code navigation into eclipse.
Several JProfiler-related settings can be adjusted in eclipse under Window->Preferences->JProfiler:
- 53 -
• The used JProfiler installation can be changed by repeating the integration from JProfiler or by
adjusting the JProfiler executable in the corresponding text field. When you upgrade to a newer
version of JProfiler, make sure to repeat the integration, since the plugin has to be updated, too.
• The window policy can be configured as
• You can manually repeat the collision detection that is performed at startup. With the corresponding
checkbox, you can also switch off collision detection at startup.
• You can ask JProfiler to always use interpreted mode for profiling. A separate checkbox tells
JProfiler to use the deprecated JVMPI interface when profiling with a 1.5 JRE. Both these settings
are trouble-shooting options and should normally not be selected.
For eclipse 3.2 and higher, profiling WTP run configurations is supported.
- 54 -
• Replace all instances of "profile" with "tptp" in the above file. Please note that the quotes are part
of the search and replace expressions. If you remove JProfiler, you can revert this change by
replacing "tptp" with "profile".
• Delete the directory eclipse/configuration/org.eclipse.osgi. The plugin cache will be
rebuilt on the next startup of RAD. This is necessary since otherwise RAD does not notice the
above change.
Only launch configuration types that exist in eclipse 3.0 can be profiled by the JProfiler plugin.
Specifically, the Websphere and Apache Tomcat launch configuration types cannot be profiled with
the JProfiler plugin. For these servers, please use the corresponding server integration wizard [p. 42]
.
The Websphere integration wizard asks you to locate the server.xml file that contains the
configuration for your Websphere server, Finding this file can be a little difficult. If you start your search
at
$CELL/nodes/$NODE/servers/$SERVER
where $CELL, $NODE and $SERVER depend on your system and the target server.
In addition, the integration wizard asks to locate a startup script named startServer.bat. That
script can be found in {RAD install directory}/runtimes/base_v6/bin/.
- 55 -
Optimizer configuration dialog
To profile your application from JBuilder, choose one of the profiling commands in the Run menu or
click on the corresponding toolbar button.
- 56 -
"Run" menu with "Optimize" actions
The profiled application is then started just as with the usual "Run" commands. If no instance of
JProfiler is currently running, JProfiler is also started, otherwise the running instance of JProfiler will
be used for presenting profiling data.
Every time a run configuration is profiled, a dialog box is brought up that asks you whether a new
window should be opened in JProfiler. To get rid of this dialog, you can select the "Don't ask me
again" checkbox. The window policy can subsequently be configured in the optimizer settings in
JBuilder (see below).
All profiling settings and view settings changes are persistent across session restarts.
- 57 -
When JProfiler is started from JBuilder, the "Show source" action for a class or a method in one of
JProfiler's view will show the source element in JBuilder and not in JProfiler's integrated source code
viewer.
Several JProfiler-related settings can be adjusted in JBuilder under
Run->Configurations->Edit->Optimize:
• The used JProfiler installation can be changed by repeating the integration from JProfiler or by
adjusting the JProfiler executable in the corresponding text field. When you upgrade to a newer
version of JProfiler, make sure to repeat the integration, since the OpenTool has to be updated,
too.
• The window policy can be configured as
• You can ask JProfiler to always use interpreted mode for profiling. A separate checkbox tells
JProfiler to use the deprecated JVMPI interface when profiling with a 1.5 JRE. Both these settings
are trouble-shooting options and should normally not be selected.
- 58 -
"Run" menu with "JProfiler" actions
The profiled application is then started just as with the usual "Run" commands. If no instance of
JProfiler is currently running, JProfiler is also started, otherwise the running instance of JProfiler will
be used for presenting profiling data.
Every time a run configuration is profiled, a dialog box is brought up that asks you whether a new
window should be opened in JProfiler. To get rid of this dialog, you can select the "Don't ask me
again" checkbox. The window policy can subsequently be configured in the "JProfiler" node in the
settings dialog of JDeveloper (see below).
All profiling settings and view settings changes are persistent across session restarts.
When JProfiler is started from JDeveloper, the "Show source" action for a class or a method in one
of JProfiler's view will show the source element in JDeveloper and not in JProfiler's integrated source
code viewer.
- 59 -
Several JProfiler-related settings can be adjusted in JDeveloper under Tools->Preferences->JProfiler:
• The used JProfiler installation can be changed by repeating the integration from JProfiler or by
adjusting the JProfiler executable in the corresponding text field. When you upgrade to a newer
version of JProfiler, make sure to repeat the integration, since the addin has to be updated, too.
• The window policy can be configured as
• You can ask JProfiler to always use interpreted mode for profiling. A separate checkbox tells
JProfiler to use the deprecated JVMPI interface when profiling with a 1.5 JRE. Both these settings
are trouble-shooting options and should normally not be selected.
- 60 -
parameters as needed. If you have problems profiling a free form project, please check the
implementation of this target.
You can profile web applications with the integrated Tomcat or with any other Tomcat server
configured in Netbeans. When your main project is a web project, selecting "Profile main project with
JProfiler" (see below) starts the Tomcat server with profiling enabled. Please make sure to stop the
Tomcat server before trying to profile it.
If you use Netbeans with the bundled Sun Java System Application Server, you can transparently
profile Java EE applications with it. When your main project is set up to use Sun Java System
Application Server, selecting "Profile main project with JProfiler" (see below) starts the application
server with profiling enabled. Please make sure to stop the application server before trying to profile
it.
To profile your application from Netbeans, choose one of the profiling commands in the Run menu
or click on the corresponding toolbar button.
"JProfiler" menu
- 61 -
Explorer context menu with "JProfiler" action
The profiled application is then started just as with the usual "Run" commands. When a profiling
session is started, a new tab with a JProfiler window is created.
Profiling sessions are closed by closing the corresponding tab. Apart from the excluded tool bar
buttons for "Attach/Detach" and "Session settings", the JProfiler window and its views are exactly the
same as in the standalone version [p. 107] .
All profiling settings and view settings changes are persistent across session restarts.
When JProfiler is used with the Netbeans integration, the "Show source" action for a class or a method
in one of JProfiler's view will show the source element in Netbeans and not in JProfiler's integrated
source code viewer.
You can also open JProfiler snapshots from Netbeans, either from the project window or the open
file dialog in order to get source code navigation into Netbeans.
The JProfiler menu in Netbeans' main menu bar contains all actions required to run JProfiler from
within Netbeans:
- 62 -
Allows you to enter your license key [p. 44] .
• Contact sales
Brings up your default mail client to write an e-mail to ej-technologies' sales department.
• Contact support
Brings up your default mail client to write an e-mail to ej-technologies' support department. The
license key is automatically included in the subject of the e-mail.
• JProfiler on the web
Connects to JProfiler's web site in the default web browser.
• About JProfiler
Shows general information about your copy of JProfiler and its license status.
- 63 -
B.4 Managing sessions
B.4.1 Sessions Overview
The information required to start a profiling run is called a session. Sessions are saved in the file
{User home directory}/.jprofiler6/config.xml and can be easily migrated to a different
computer by importing this file in the setup wizard [p. 44] . When upgrading JProfiler, your settings of
older installations are imported automatically.
Sessions are created
• the open session dialog [p. 88] or the start center [p. 41] .
• the the session startup dialog [p. 88] that is displayed just before a session is started.
• JProfiler's main menu and the toolbar. The toolbar button and the menu item Session->Session
settings open the session settings dialog.
• Application settings
The application settings section [p. 65] collects all information that is required to start your application
with profiling enabled or to connect to a running JVM that has already been started with profiling
enabled. If you use an IDE integration [p. 46] , this information will be provided by the IDE.
• Filter settings
In the filter settings section [p. 69] , you define which classes should be considered when recording
call-stack information. Defining appropriate filters will help you to reduce data overload and
minimizing CPU profiling overhead. By default, JProfiler adds an exclusion list
• Profiling settings
In the profiling settings section [p. 73] you can configure the way your application is profiled and
change the focus of a profiling run toward performance or accuracy, CPU or memory profiling.
• Trigger settings
In the trigger settings section [p. 69] you can optionally define a list of triggers. With triggers, you
can tell the profiling agent to execute specific actions when certain events occur in the JVM. The
actions are also executed during offline profiling [p. 225] .
If you change filter, profiling or trigger settings for an active session, the new settings can be applied
immediately if you profile a 1.6+ JRE. Apart from telemetry data, all recorded data including the
- 64 -
heap dump in the heap walker will be discarded in that case. When profiling settings are updated, a
bookmark [p. 114] will be added to views with a time-line, such as the telemetry views. The application
of the new profiling settings may take some time, especially if filter settings are changed and the
method call recording type is set to dynamic instrumentation. In this case, changes in the
instrumentation requires that classes have to be retransformed to reflect the new filter settings.
If you profile a pre-1.6 JRE, you have to restart the session.
View settings on the other hand, are always adjustable during a running session and are saved
separately for each session.
• Session name
Every session has a unique name that is presented in the "Open session" pane of the start center
[p. 41] and in the open session dialog [p. 88] . It is also used for the title of the main window and
the terminal window. Next to the name text field you see an ID which is used for choosing the
session in offline profiling [p. 225] or for remote profiling with the "nowait" option [p. 93] (in the latter
case only relevant if the profiled JVM has a version of 1.5 or earlier).
• Session type
There are four different session types. Depending on this choice, the middle part of the tab will
display different options.
- 65 -
• Java file path
With the radio buttons on the left you can switch between the
• Class path
The class path consists of directories and jar files that are used for the -classpath VM argument.
The class path is also used by the bytecode viewer [p. 116] to find class files for display.
• Source path
The source path optionally lists archives and directories that contain source code for some or
all of the entries in the class path. Note that the sources of the selected JDK contained in
src.jar or src.zip will be automatically appended if they are installed. The source path is
is used by the source code viewer [p. 116] to display Java sources.
• Native library path
The native library path consists of directories that are added to the native library envrironment
variable. The name of the native library envrironment variable depends on the operating system.
You only have to specify the native library path when you load native libraries by calling
java.lang.System.loadLibrary() or for resolving dependent libraries that have to be
dynamically loaded by your native libraries.
When clicking the add button you can select multiple path entries to the path list in one go from
the file chooser. Alternatively, to quickly add a list of path entries defined elsewhere, you can copy
a path from the system clipboard by clicking copy button. The path must consist of either
• absolute
The path entry is added as it is.
• relative
On the first occurrence of a relative path, JProfiler brings up a directory chooser and asks for
the root directory against which relative paths should be interpreted. All subsequent relative
paths will be interpreted against this root directory.
JProfiler will only add unique path entries into the list. If no new path entry could be found, a
corresponding error message is displayed.
Note: Adjusting the class and source path during an active session is effective for the source code
and bytecode viewer [p. 116] only.
• Java VM
Choose the Java VM to run your application. Java VMs are configured on the "Java VMs" tab [p.
104] of JProfiler's general settings [p. 104] which are accessible by clicking the [General settings]
button on the bottom of the dialog.
- 66 -
• Working directory
Choose the directory in which your java process will be started either manually or by clicking on
the [...] button to bring up a file chooser. As long as you have not selected a particular directory,
this option is set to [startup directory] which means that JProfiler's startup directory will
also be your application's working directory.
• VM arguments
If your application needs virtual machine arguments of the form -Dproperty=value, you can
enter them here. Parameters that contain spaces must be surrounded with double quotes (like
"-Dparam=a parameter with spaces").
• Main class or executable JAR
Enter the fully qualified name of your main class or the path to an executable JAR file here. If you
enter a main class, it has to be contained in class path (see above).
Clicking on the [...] button brings up menu that lets you
• Arguments
This is the place to enter any arguments you want to supply to the main class of your application.
Arguments that contain spaces must be surrounded with double quotes (like "a parameter
with spaces").
• Open browser with URL
If you would like to open a browser window along with the session, please select this checkbox
and enter the URL in the adjacent text field. JProfiler polls this URL until it becomes available, only
then is the browser opened. Please set the browser start command [p. 105] if you're working on a
UNIX platform.
• Host
Enter the host on which the application you want to profile is running either as a DNS name or as
an IP address. If this is your local computer, you may enter localhost.
• Port
- 67 -
Choose the port on which the remote profiling agent is listening. If you have not supplied a port
parameter [p. 93] , the default port 8849 is the correct choice. This default can be restored by clicking
the [Default] button on the right side of the text field.
• Timeout
Choose the timeout in seconds after which JProfiler will give up trying to connect to the remote
application.
• Start command
If you enable the "start command" checkbox and enter the path to an executable in the text field
to the right, JProfiler will execute this command before trying to connect to the remote application.
The output of that command will be displayed in a terminal window similar to the "local" session
type [p. 65] . In this case JProfiler has full control over the life cycle of the profiled application. If the
terminal window is closed, the stop button is clicked or JProfiler is exited, the process will be killed
if it is still alive.
The application server integration wizard uses start commands to make it easy to profile application
servers. should you want to take control of the launching of the application server you can temporarily
uncheck the "start command" checkbox while preserving the suitable start command.
• Stop command
If you enable the "stop command" checkbox and enter the path to an executable in the text field
to the right, JProfiler will execute this command when disconnecting from the remote application,
i.e. when the terminal window is closed, the stop button is clicked or JProfiler is exited.
The application server integration wizard uses stop commands where possible.
• Open browser with URL
If you would like to open a browser window along with the session, please select this checkbox
and enter the URL in the adjacent text field. JProfiler polls this URL until it becomes available, only
then is the browser opened. Please set the browser start command [p. 105] if you're working on a
UNIX platform.
The [config synchronization options] button brings up the config synchronization options dialog
[p. 102] .
• Java VM
Choose the Java VM to run your applet. The main class sun.applet.AppletViewer from the
tools.jar of the selected JVM will be used to show the applet. Java VMs are configured on the
"Java VMs" tab [p. 104] of JProfiler's general settings [p. 104] which are accessible by clicking the
[General settings] button on the bottom of the dialog.
• URL
Enter a URL pointing to an HTML page which contains the applet. By clicking on the [...] button
you can bring up a file chooser to select an HTML file on your file system.
Note: If the applet view is too restrictive for your applet, please use the Java plugin integration
wizard available on the New session tab of the start center [p. 41] to profile the applet directly in
the browser.
- 68 -
B.4.2.5 Web Start Session
If the session type in the application settings [p. 65] is set to "Web Start", the following settings are
displayed in the middle part of the dialog:
Note: Java VMs are configured on the "Java VMs" tab [p. 104] of JProfiler's general settings [p. 104]
which are accessible by clicking the [General settings] button on the bottom of the dialog.
• Included packages or classes are profiled and will be shown in the call tree. If the first filter is
inclusive, no classes are profiled by default.
• Excluded packages or classes are not profiled and will not be shown in the call tree. If the
first filter is exclusive, all other classes are profiled by default.
All calls from profiled classes are shown in the call tree regardless of whether the called class is
profiled or not. For example, if you only have one inclusive filter for the com.mycorp. packages, and
if your class com.mycorp.MyClass calls a method in java core classes, all those calls will be
- 69 -
measured, but their internal call structure will not be resolved. In the call tree view [p. 172] , such method
calls are opaque and will be labeled with a red corner.
Package filters include all sub-packages. For example, if you have one inclusive filter with the name
com.mycorp., it includes all classes directly in the com.mycorp. package as well as the
com.mycorp.test and the com.mycorp.test.detail packages.
Filter rules are evaluated from top to bottom, the last matching rule is applied. For example, if you
add an exclusive filter for the com.mycorp. packages, but further down add an inclusive filter for
the com.mycorp.test package, the com.mycorp.test package is profiled while other classes
in the com.mycorp. packages are not.
Adjacent filter rules of the same type can be grouped together. Just select all filters that you wish to
group and select the appropriate action from the context menu. You are then prompted to name the
group. The name of a filter group is only informational. The context menu also offers an action to
ungroup selected groups. Filter rules in filter groups are sorted alphabetically, have a gray background
and cannot be moved. However,they can be deleted from the filter group. To add a new filter rule to
an existing filter group, you first have to ungroup the group and group it again.
By default, the filter rules are configured to exclude a list of common framework classes. All other
classes are included. Whenever you find that the default list is not suitable, or if you would like to
profile classes that are in that list, you should delete the entire exclude group and add your own
inclusive filters. Alternatively, you can delete parts of the default exclude group.
If, at any later point, you wish to restore these default exludes, you can use the reset filters to
default button on the right side. All current filter settings will be lost in that case.
To analyze the overall filter configuration, you can click on [Show filter tree] and bring up a dialog
[p. 70] that shows you all filter rules in a read-only package hierarchy.
Filter configurations can be saved to filter templates [p. 71] with the save button, the open button
lets you replace the current filter configuration with a filter template.
On the session defaults [p. 105] tab of the general settings dialog [p. 104] you can change the default
filter template used for new sessions.
You can quickly bring up this tab by clicking on the [Global filters] button that is shown in the bottom
right corner of views that show call trees or time measurements of method calls.
• excluded packages
these packages or classes will not be profiled, they are only shown if they are called directly
from profiled classes.
• included packages
these packages will be profiled.
• bridge packages
these packages are only shown because there's a filter rule for a descendant package. If the
first node in the tree is an "all other packages" inclusive node, they will be profiled, otherwise not.
- 70 -
If the first filter rule on the Define Filters [p. 69] tab is exclusive, an "all other packages" inclusive node
is added as the first node in the tree. If the first filter rule is inclusive, there is no automatic addition
to the package tree.
Please note that this is a read-only representation of the filter configuration. For defining filter rules,
please return to the Define Filters [p. 69] tab.
When discriminating slow method invocations, a certain thread state can be used for the time
measurement. By default, the wall clock time (all thread states) is used, but a different thread status
can be configured in the profiling settings [p. 75] . Note that the thread status selection in the CPU
views [p. 170] is not used in this case, but the separate setting in the profiling settings is used.
Exceptional method runs are displayed differently in the call tree view [p. 172] . For the concerned
method nodes, icons are changed and text is appended:
• [exceptional run]
Such a node contains an exceptionally slow method run. By definition, it will have an invocation
count of one. If many other method runs are slower later on, this node may vanish and be added
to the "merged exceptional runs" node depending on the configured maximum number of separately
recorded method runs [p. 75] .
• [merged exceptional runs]
Method invocations which do not qualify as exceptionally slow are merged into this node. For any
call stack, there can only be one such node per exceptional method.
• [current exceptional run]
If an invocation was in progress while the call tree view was transmitted to the JProfiler GUI, it was
not yet known whether the invocation was exceptionally slow or not. The "current exceptional run"
shows the separately maintained tree for the current invocation. After the invocation completes, it
will either be maintained as a separate "exceptional run" node or be merged into the "merged
exceptional runs" node.
- 71 -
To check the statistical properties of the distribution of call times of certain methods of interest,
please start with the method statistics view [p. 186] . It can show you the outlier coefficient and a graph
of call times versus frequency. This analysis allows you to assess whether an outlier is significant or
not. From the method statistics view you can use the Add as exceptional method action in the
context menu to add the method to the list of exceptional methods. The same context action is available
in the call tree view [p. 172] .
Apart from removing previously configured exceptional methods, you can also add exceptional methods
directly on this tab of the filter settings. The following ways for selecting methods are available:
- 72 -
All ignored methods will be missing in the call tree. Their execution time will be added to the inherent
time of the calling method. If you find later on, that some ignored methods are indispensable in the
profiling views, you can activate this tab in the filter settings and delete those methods.
In case that you do not want to see messages about auto-tuning, you can disable it in the profiling
settings [p. 75] . Also, several parameters can be adjusted to broaden or narrow the scope of the
methods that are considered as overhead hot spots.
You can also add ignored methods directly on this tab of the filter settings. The following ways for
selecting methods are available:
- 73 -
Configure method call recording options for the session. These settings affect CPU views and
memory views with allocation information.
• CPU profiling [p. 75]
Configure options regarding CPU profiling. These settings affect CPU views only.
• Java subsystems [p. 76]
Configure recording options for several Java EE related Java subsystems for the session.
• Memory profiling [p. 77]
Configure options regarding memory profiling. These settings affect all memory views.
• Thread profiling [p. 78]
Configure options regarding thread profiling. These settings affect all views in the thread section.
• Miscellaneous [p. 78]
Configure miscellaneous options for profiling.
Other settings, which concern the presentation of profiling data are called view settings and are
accessible from the main toolbar as well as from context sensitive menus in each view. View
settings are persistent as well and are saved automatically for each session.
• Dynamic instrumentation
When dynamic instrumentation is enabled, JProfiler modifies filtered classes on the fly as they
are loaded by the JVM to include profiling hooks. Accuracy of non-timing related stack
information (like allocation information) is high, invocation counts are available and Java EE
payloads can be annotated in the call tree, but calls from Java core classes are not resolved.
The overhead and timing accuracy varies depending on what classes are instrumented.
Java core classes (java.*) cannot be profiled this way and are filtered automatically.
• Sampling
When sampling is enabled, JProfiler inspects the call stacks of all threads periodically. Sampling
has extremely low overhead even without any filters. Accuracy of non-timing related stack
information (like allocation information) is low and invocation counts are not available. Only
methods that take longer than the sampling period or methods called frequently are captured
by sampling.
Sampling is ideally suited for use without any method call filters. To temporarily switch off all
filters, you can use the Disable all filters for sampling setting instead of deleting
- 74 -
all filters in your configuration. In that way you can create a profiling settings template that ignores
your filter configuration and alternate between using filters and using no filters at all.
If sampling is enabled, the sampling frequency can be adjusted. The default value is 5 ms. A
lower sampling frequency incurs a slightly higher CPU overhead when profiling.
Note: allocations will be reported according to the call traces recorded by the sampling
procedure. This may lead to incorrect allocation spots.
• Line numbers
By default, JProfiler does not resolve line numbers in call trees. If you enable show line numbers
for sampling and dynamic instrumentation, line numbers will be recorded and shown.
If the aggregation level is set to "methods" and a method calls another method multiple times in
different lines of code, line number resolution will show these invocations as separate method
nodes in the call tree [p. 172] and the allocation call tree [p. 124] . Backtraces in the hotspot views
will also show line numbers.
Note that a line number can only be shown if the call to a method originates in an unfiltered class.
• Auto-tuning settings
Here, you can disable auto-tuning [p. 72] . Furthermore you can configure the criteria for determining
an overhead hot spot. A method is considered an overhead hot spot if both of the following conditions
are met:
• the total time of all its invocations exceeds a threshold in per mille of the entire total time in the
thread
• its average time is lower than an absolute threshold in microseconds
• Time settings
Select whether you want times shown in the CPU view section [p. 170] to be measured in
• elapsed time
With elapsed time selected, the clock time difference between method entry and method exit
will be shown. Note that if the thread state selector [p. 170] is set to its standard setting (Runnable).
Waiting, blocking and Net IO thread states are not included in the displayed times.
• estimated CPU time
With estimated CPU time selected, the CPU time used between method entry and method exit
will be shown. On Windows and Mac OS the system supplies CPU times with a 10 ms resolution
which are used to calculate the estimated CPU times. On Linux and Solaris the VM does not
supply a CPU time and the estimated CPU times are roughly estimated by looking at the number
of runnable threads.
- 75 -
• Maximum number of separately recorded method runs
The maximum number of the slowest invocations that are shown separately in the call tree view
[p. 172] . Increasing this value can increase memory overhead and visual clutter in the call tree.
• Time type for determining exceptional method runs
The time measurement that is used for finding the slowest method invocations. Note that this
setting is not linked to the thread state selector in the CPU views [p. 170] .
• JDBC calls
JProfiler analyzes statements, prepared statements, callable statements as well as batches of
statements and measures calls into all JDBC methods of type execute, executeQuery,
executeUpdate and executeBatch.
The displayed data is always the executed SQL statement, without any parameter substitution.
• JMS calls
Both synchronous and asynchronous messages are handled. For synchronous messages, the
receive and receiveNoWait methods of MessageConsumers are measured. For
asynchronous messages, the onMessage methods of MessageListeners or message driven
EJBs are measured.
The displayed data is by default the message destination as returned by
message.getJMSDestination(). If you would like to differentiate messages based on the
content of the message you can write a custom JMSResolver and register it with
Controller.registerJMSResolver. Please see the API documentation [p. ?] for more
information.
• JNDI calls
All calls in javax.naming.Context and javax.naming.directory.DirContext that
return data are measured.
Based on whether a call is a name lookup or a search call, the displayed data will be prefixed
with [NAME] or [SEARCH] and contains information about the name or search expression in
the parameters.
Service calls are grouped by their display data, i.e. two equal select statements at the same call
stack are held as one node in the internal data model. For each node, JProfiler keeps track of the
invocation count and total execution times for each thread status. To avoid an overload of the
system, there's a maximum number of recorded service calls per call stack. If the maximum
- 76 -
number is exceeded, the oldest call is merged into an "[earlier calls]" node. By default, this maximum
value is set to 20, if you require more detail you can increase the value in the text field as needed.
• Java EE awareness
If Split call tree for each request URL is enabled, JProfiler will analyze the URLs that occur in
calls to servlets and JSPs. For each URL, a new node is created in the call tree [p. 172] . URLs can
also be selected as a hot spot type in the hot spot view [p. 177] . In that way, you can differentiate
the performance issues of separate pages or requests.
By default, only the URL without the query parameters is used for the above splitting process. In
order to retain selected parameters in the call tree, you can enter them in the text field labeled
retained request parameters. For example, if you want to split the call tree for each different
value of the parameters "action" and "level", enter action,level into the text field. If you would
like to customize the splitting process (for example, if the session id is incorporated into the URL)
you can write a custom HTTPRequestResolver and register it with
Controller.registerHTTPRequestResolver. Please see the API documentation [p. ?] for
more information.
Request URLs that do not lead to an unfiltered method in the call tree are not displayed by default.
If you would like to display all requests, please check the checkbox labeled Show request URLs
that are outside the call tree.
JProfiler can detect the following Java EE component types:
servlets
JSPs
EJBs
The corresponding methods have a separate icon in the call tree. For JSPs, the name of the JSP
source file is displayed instead of the generated class and for EJBs the name of the interface is
displayed instead of the generated stub or proxy classes. In the "method" and the "class" aggregation
levels, the real class names are displayed in square brackets, too.
Based on this component information, JProfiler offers the Java EE components aggregation
level in all views with an aggregation level selector. If you would like to disable Java EE component
detection, you can deselect the checkbox labeled Detect Java EE components.
• Recording type
The information depth of the allocation call tree [p. 124] and the allocation hot spots view [p. 129] is
governed by this setting.
• Live objects
By default, only live objects can be displayed by the allocation views. Class-resolution is enabled.
• Live and GCed objects without class resolution
Live and garbage collected objects can be displayed by the allocation views, depending on the
selection in the allocation options dialog [p. 135] . Class-resolution is disabled, i.e. class selection
[p. 135] in the allocation options dialog [p. 135] will not work in this setting, only the cumulated
- 77 -
allocations of all classes and array types can be displayed. This setting consumes more memory
than the first setting and adds a considerable performance overhead.
• Live and GCed objects
Live and garbage collected objects can be displayed by the allocation views, depending on the
selection in the allocation options dialog [p. 135] . Class-resolution is enabled. This setting
consumes more memory than the other settings and adds adds a considerable performance
overhead.
• Allocation times
Select the Record object allocation time check box if you would like to be able to
• Monitors
if you are not interested in monitor contention events, you can switch data collection off by
deselecting the Enable monitor recording check box. This lowers the memory consumption
of the profiled application. If monitor contention views are enabled, the following settings govern
the level of detail for the monitor contention views:
• Thread filter
By default, JProfiler does not show system threads where no user code can ever run. If you would
like to see all threads, please select the Show system threads check box.
- 78 -
Note: with the classic VM (e.g. IBM JVMs), this option installs a security manager which intercepts
your application's calls to System.exit() and executes them after JProfiler's GUI front end
disconnects. This can be a problem when you profile an application server which installs its own
security manager. If you use a classic VM and get security related exceptions when profiling your
applications, try unchecking this option.
• Dynamic views
Many views in JProfiler update their data automatically. There are several options for configuring
the update behavior of those dynamic views:
• CPU views
This setting influences the update interval of the dynamic views in the CPU view section [p.
170] .
• Tables and graphs
This setting influences the update interval of the
Note: The update frequency of the all objects view [p. 119] is adjusted automatically according
to the total number of objects on the heap.
To update any dynamic view in between two regular updates, you can click on the refresh
icon in the status bar.
• Console Settings
JProfiler displays a console for locally started programs. This includes local sessions, applets, web
start applications and remote sessions with a configured start command.
JProfiler offers two types of consoles:
• Java Console
This is a cross-platform console, that supports text input, sending CTRL-C to the profiled
application, text selection and clipboard operations. For the Java console you can set the following
options:
• Buffer size
The number of most recent lines of output that are held by the console. Default is 1000.
- 79 -
• Window size
The initial size (width x height) of the console in characters. Note that the console does not
wrap text. Default is 80 x 25.
• Triggers
Here, you define the list of triggers for your session. By default, no triggers are defined. To add
new triggers, click on the add button to display the trigger wizard [p. 81] . The trigger wizard is
also used to edit existing triggers.
Some triggers are only required occasionally, especially when the set of actions incurs a
considerable overhead, such as saving snapshots. JProfiler allows you to disable and enable
triggers so you do not lose their configuration for the next time you need them. The corresponding
actions are also available from the context menu.
Note that you can select multiple triggers to quickly disable, enable or delete many triggers.
Trigger configurations can be saved to trigger sets [p. 87] with the save button, with the open
button you can add a trigger set to the current list of triggers.
On the session defaults [p. 105] tab of the general settings dialog [p. 104] you can change the default
trigger set used for new sessions. By default, no triggers are added to a new session.
• Output options
- 80 -
The following actions print information when they are executed:
• Print message
• Print method invocation
On this tab you define where this output should be printed. The available options are:
• Print to stdout
• Print to stderr
• Print to file
For this option you have to enter a file name. The file will be saved relative to the working
directory of the profiled JVM on the machine where the profiled JVM is running.
• Method invocation
Symbol:
This event occurs when a method is called. Several methods can be configured for the same action
sequence. Besides the standard actions, there are several special actions for this trigger type.
- 81 -
The second step of the trigger wizard will then be the "Specify methods" step. Here you can edit
the list of methods for which this trigger will be activated. There are several ways to enter new
methods:
In addition, all views with call trees [p. 87] offer the possibility to select methods for a method trigger
in the context menu.
By default, the method trigger event is not fired for recursive calls. This means that if a method M
is being called and later on in the call stack method M is called again, the event is only fired for
the first invocation of method M. If you deselect the check box Ignore recursive calls, the
event will be fired for all invocations of a method.
• Heap usage threshold
Symbol:
Requirements: Java 1.4+
This event occurs when the heap usage exceeds a certain threshold in percent of the maximum
heap size for a minimum period of time.
The second step of the trigger wizard will then be the "Threshold" step. Here you can configure
the
• Threshold
The trigger will be activated each time when the used heap size exceed the configured percentage
of the maximum heap size.
• Activation time
To avoid spurious trigger events, the activation time sets a minimum amount of time during
which the threshold must be exceeded. Only after the activation time has passed will the trigger
be activated.
• Deactivation time
- 82 -
Similar to the activation time, the trigger will only be deactivated after heap usage falls below
the threshold for a minimum amount of time. By default, the deactivation time is the same as
the activation time, however, you can configure a different time for it. Activation and deactivation
times determine the sensitivity of the trigger to the threshold value.
• Inhibition time
To avoid that too many trigger events are fired, you can set an inhibition time. After the trigger
has been deactivated, the trigger will not be activated again for the duration of the inhibition
time.
Symbol:
Requirements: Java 1.5+
This event occurs when the CPU load exceeds a certain threshold in percent for a minimum period
of time.
The second step of the trigger wizard will then be the "Threshold" step which is explained above
for the "Heap usage threshold" trigger with the only difference that the threshold value is the CPU
load in percent.
• Out of memory exception
Symbol:
Requirements: Java 1.6+
This event occurs when an OutOfMemoryException is thrown. You can only save an HPROF
snapshot in this case since the trigger works by adding -XX:+HeapDumpOnOutOfMemoryError to
the VM options. Also, this trigger only works with a Java 6+ JVM. For 1.5.0_07+ and 1.4.2_12+,
this VM option is also supported, however, it cannot be added by the profiling agent, so you have
to add it manually to the VM options of the profiled application.
• Timer
Symbol:
With a timer trigger, you can periodically execute a certain set of actions, such as saving a snapshot.
The second step of the trigger wizard will then be the "Timer" step where you can configure the
following properties of the timer:
• Timer type
A timer can either periodically either and unlimited number of times of a limited number of times.
• Interval
The interval defines the period of time between two subsequent timer invocations.
• Offset
With the offset, you can specify how much time should pass between the start of the JVM and
the first invocation of the timer.
• JVM startup
Symbol:
With a JVM startup trigger, you can execute a certain set of actions right after the JVM is started
for profiling. The actual execution is performed right after the trigger subsystem has been initialized
in the profiling agent.
- 83 -
• JVM exit
Symbol:
With a JVM exit trigger, you can execute a certain set of actions right before the JVM is shut down.
This is implemented with a standard shutdown hook, so code in other shutdown hooks may be
executed after the associated actions.
• Start recording
Symbol:
Starts recording any of
With the "Reset" check boxes for CPU data and allocation data, you can choose whether the
previously recorded data should be cleared or not.
• Stop recording
Symbol:
Stops recording any of
Symbol:
Starts recording monitor data. The monitor views [p. 199] that show historical data receive new data
when this action is executed. Please note that monitor recording adds a memory overhead that
grows linearly in time. You should execute the "stop monitor recording" action at some point.
In the configuration, you can define blocking and waiting thresholds for monitor recording. These
settings are the same as those in the monitor history view settings dialog [p. 205] .
- 84 -
• Stop monitor recording
Symbol:
Stops recording monitor data.
• Start call tracer
Symbol:
Starts recording call traces. The call tracer view [p. 189] will receive new data once the "stop call
tracer" action is executed. Please note that call traces use a lot of memory. You should execute
the "stop call tracer" action after a short time.
In the configuration, you can define a cap on the number of recorded call traces and determine if
calls into filtered classes should be traced as well. These settings are the same as those in the
call tracer view settings dialog [p. 190] .
In addition, you can specify if previously recorded call traces should be reset or not. If you do not
clear previously recorded call traces, you can build up call traces over several trigger events.
• Stop call tracer
Symbol:
Stops recording call traces. The call tracer view [p. 189] will be updated with the recorded data as
soon as this action is executed.
• Trigger heap dump
Symbol:
With this action you can trigger a heap dump as in the heap walker [p. 137] . Accordingly, you can
select whether to
Symbol:
With this action you can trigger a thread dump as in the thread dumps view [p. 198] . Please note
that frequently taking thread dumps will cause a linear growth in memory overhead.
• Save snapshot
Symbol:
- 85 -
With this action you can save a JProfiler snapshot [p. 101] of all profiling data to disk.
In addition to the name of the snapshot file you can specify whether a number should be appended
to the file name to prevent old snapshot files from being overwritten. Note that the path is relative
to the working directory of the profiled JVM and that the snapshot is saved on the remote machine
if you profile remotely.
• Create an HPROF heap dump
Symbol:
Requirements: Java 1.6+
With this action you can save an HPROF heap snapshot [p. 101] of all profiling data to disk. For the
"Out of memory exception" [p. 81] event type, this is the only supported action.
In addition to the name of the snapshot file you can specify whether a number should be appended
to the file name to prevent old snapshot files from being overwritten. Note that the path is relative
to the working directory of the profiled JVM and that the snapshot is saved on the remote machine
if you profile remotely.
HPROF heap dumps also offer the option to only save referenced objects.
• Wait for the event to finish
Symbol:
For event types [p. 81] that have a duration, such as the method invocation event or the threshold
events, you can use this action to execute some actions not at the start of the event but rather
after the event is finished.
• Override thread status for current method
Symbol:
This action is only available for the method invocation [p. 81] event type and allows you to change
the thread status [p. 193] for the duration of the methods that are associated the the trigger. The
thread status is configurable.
• Print method invocation
Symbol:
This action is only available for the method invocation [p. 81] event type and allows you print details
about the current method invocation including parameters and return value to the output stream
configured in the trigger output options [p. 80] .
• Invoke interceptor
Symbol:
This action is only available for the method invocation [p. 81] event type and allows you to invoke
an interceptor when the methods associated the the trigger are invoked. Interceptors can be
developed with the JProfiler API and can also be added with VM parameters. Please see the api
directory for documentation and samples. The advantage of adding the interceptor with a trigger
is that you do not have to specify the methods and signatures in the interceptor class.
You can enter the interceptor class manually or use the [...] button to scan the class path configured
in the application settings [p. 65] for all classes extending
com.jprofiler.api.agent.interceptor.Interceptor.
• Add bookmark
Symbol:
- 86 -
With this action you can add a boookmark [p. 114] to the time-resolved views. You have to enter a
description for the bookmark.
• Sleep
Symbol:
With this action, you can sleep a specified amount of time until the next action in the list is executed.
Please note that this does not block the current thread in the JVM. For example, you can use this
action to start CPU recording, record 10 minutes, stop CPU recording and save a snapshot.
• Print message
Symbol:
With his action you can print an arbitrary message to the output stream configured in the trigger
output options [p. 80] .
In all these views, the context menu shows an add method trigger action if the currently selected
node is a method. That action displays this dialog where you can choose whether to add the method
interception to an existing method trigger or whether to create a new method trigger.
If you select "Add to existing method trigger", the list below which displays all existing method triggers
is enabled and you have to choose one of them. The select method is added to the selected trigger
and the trigger wizard [p. 81] is opened at the "Actions" step, so you can review or modify the existing
list of actions.
If you select "Create new method trigger", a new method trigger is created and the trigger wizard [p.
81] is shown at the action step.
- 87 -
During a live session, you can enable or disable all triggers by choosing Profiling->(Enable|Disable)
triggers from JProfiler's main menu. Bookmarks [p. 114] will be added when triggers are enabled or
disabled manually.
The trigger recording state is shown in the status bar with a flag icon which is shown in gray when
triggers are not enabled. Clicking on the flag icon will toggle trigger recording.
Sometimes, you need to toggle trigger recording for groups of triggers at the same time. This is
possible by assigning the same group ID [p. 81] to the triggers of interest and invoking Profiling->Enable
triggers groups from JProfiler's main menu.
A dialog will be shown where you can select one or more group IDs. Furthermore, there are radio
buttons to control whether the selected trigger groups should be enabled or disabled.
Enabling or disabling trigger groups overrides the global trigger recording status as well as the initial
disabling of individual triggers.
• To open profiling sessions [p. 64] . Double click on an existing session or choose a session and
click [Open] to start a profiling session.
• To edit [p. 65] , copy and delete existing sessions.
The list of available session configurations displays the session name which can be changed when
editing [p. 65] a session. In addition, the associated icon to the left of the session name show whether
the session is a local session, a remote session, an applet session or a Java Web Start
session
The facility to open sessions is also embedded in JProfiler's start center [p. 41] .
of the profiled session as well as [Edit] buttons that lead to the corresponding sections of the session
settings dialog [p. 64] .
When profiling, there is a general trade-off between profiling overhead and information depth. Most
likely your personal requirements will change from profiling run to profiling run, so these settings are
displayed every time before your application is started.
For IDE integration users, this is the dialog where session settings can be accessed and modified.
Session settings are persistent and are associated with the project name in the IDE.
In the Startup section dialog you can choose whether recording of CPU or allocation data should
be started immediately. For many profiling use cases the startup phase of an application is not of
interest. For large applications servers, you can save a lot of memory and speed up the startup phase
by not recording allocations from the beginning.
- 88 -
• Record allocations on startup
The recorded objects view [p. 121] will display data immediately.
• Enable triggers on startup
By default, this option is selected. If you deselect this check box, triggers will not be enabled when
the JVM is started for profiling. You can enable triggers manually [p. 87] later on.
The performance indicators are set according to the selected profiling settings [p. 73] . Please note
that these values are only approximate and the the filter settings influence overhead as well.
When you click on [OK], the session will be started.
- 89 -
Solaris x86, 32-bit {JProfiler install
directory}/bin/solaris-x86/libjprofilerti.so
Also, you might need to add other JVM-specific options found in the remote session invocation
table [p. 93] .
• Java <= 1.4.2 (JVMPI)
-Xrunjprofiler
• A VM parameter that adds JProfiler-specific classes to the boot classpath:
• Windows
-Xbootclasspath/a:{JProfiler install directory}\bin\agent.jar
• all other supported platforms
-Xbootclasspath/a:{JProfiler install directory}/bin/agent.jar
• other JVM-specific options found in the remote session invocation table [p. 93]
- 90 -
2. Adjust the native library path
The native library path is an environment variable whose name depends on on the operating
system and the architecture of the JVM (not the architecture of the operating system).
- 91 -
Mac OS, 32 and 64-bit {JProfiler install
directory}/bin/macos to the
environment variable
DYLD_LIBRARY_PATH.
The remote session invocation table [p. 93] shows the complete commands for all supported JVMs.
Please note that the profiling interfaces JVMPI and JVMTI only run with the standard garbage collection.
If you have VM parameters on your command line that change the garbage collector type such as
• -Xincgc
• -XX:+UseParallelGC
• -XX:+UseConcMarkSweepGC
• -XX:+UseParNewGC
- 92 -
please make sure to remove them. It might be a good idea to remove all -XX options if you have
problems with profiling.
If you start your application from an ant build file, you can use the ant task [p. 227] to easily profile your
application.
• port=nnnnn chooses the port on which the agent listens for remote connections. Be sure to use
the same value in JProfiler's GUI front end.
• nowait tells the profiling agent to let the JVM start up immediately. Usually, the profiled JVM will
wait for a connection from the JProfiler GUI before starting up. For 1.5 JVMs or earlier, the
parameters id has to be supplied as well. Optionally, you can also supply the config parameter
in that case.
• offline enables the offline profiling [p. 225] mode. You cannot connect with the GUI front end when
using the offline profiling mode. The parameters id has to be supplied as well. Optionally, you can
also supply the config parameter.
• id=nnnnn chooses the session used with the offline or nowait parameters. This is only required
for 1.5 JVMs or earlier.
• config=[path to JProfiler config file] supplies the path to JProfiler's configuration file. This
parameter is only relevant for offline profiling [p. 225] and profiling with the nowait parameter (in
the latter case only if the profiled JVM has a version of 1.5 or earlier). If config is not specified for
those cases, the profiling agent will attempt to load the config file from its standard location. Reading
the config file is necessary to retrieve profiling settings that have to be known at startup for the
session that was selected with the id parameter.
${LIBRARY} (JVMTI only) is to be replaced by the full path to the native JProfiler library [p. 89] .
Multiple parameters are separated by commas such as in
"offline,id=172,config=~/.jprofiler6/config.xml".
In addition to the standard parameters above, there are the following trouble-shooting and debugging
parameters:
• verbose-instr prints the names of all instrumented classes to stderr. This is a debugging parameter.
• jniInterception enables the detection of object allocations via JNI calls. This parameter is only
relevant for Java 1.5.0_00, 1.5.0_01 and 1.5.0_02. This feature is enabled by default for Java
1.5.0_03 and higher. Due to a bug in Java 1.5.0_02 and lower, it is disabled when profiling with
those releases. Please make sure not to use -Xcheck:jni when you specify this parameter
for Java 1.5.0_02 and lower.
• stack=nnnnn sets the maximum stack size for dynamic instrumentation. Only change this parameter
when JProfiler emits corresponding error messages. The default value is 10000.
- 93 -
• samplingstack=nnnnn sets the maximum stack size for sampling. Only change this parameter
when JProfiler emits corresponding error messages. The default value is 200.
Version 1.3.0
• default mode:
java -Xrunjprofiler:${PARAM} [solaris: -Xboundthreads]
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.3.1
Unsupported releases with known problems: 1.3.1, 1.3.1_01
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM} [solaris:
-Xboundthreads] -Xbootclasspath/a:[path to agent.jar]
[your JVM parameters] -classpath [class path] [main
class] [parameters]
• hotspot mode:
java -Xrunjprofiler:${PARAM} [solaris: -Xboundthreads]
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.0
Unsupported releases with known problems: 1.4.0-beta, 1.4.0-beta2, 1.4.0-beta3,
1.4.0-rc, 1.4.0
• hotspot mode:
java -Xrunjprofiler:${PARAM} -Xbootclasspath/a:[path
to agent.jar] [your JVM parameters] -classpath [class
path] [main class] [parameters]
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.1
• hotspot mode:
- 94 -
java -Xrunjprofiler:${PARAM} -Xbootclasspath/a:[path
to agent.jar] [your JVM parameters] -classpath [class
path] [main class] [parameters]
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.2
see version 1.4.1
Version 1.5.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• hotspot (JVMPI) mode:
java -Xshare:off -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Note: deprecated, default interface JVMTI is preferred
Version 1.6.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.7.0
see version 1.6.0
- 95 -
Vendor: IBM Corporation
Version 1.3.0
• interpreted mode:
java -Djava.compiler=none -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• jit compiler mode:
java -Xrunjprofiler:${PARAM} -Xbootclasspath/a:[path
to agent.jar] [your JVM parameters] -classpath [class
path] [main class] [parameters]
Note: does not work with sampling
Version 1.3.1
see version 1.3.0
Version 1.4.0
see version 1.3.0
Version 1.4.1
see version 1.3.0
Version 1.4.2
see version 1.3.0
Version 1.5.0
• jit compiler mode:
java -agentpath:${LIBRARY}=${PARAM} -Xshareclasses:none
[your JVM parameters] -classpath [class path] [main
class] [parameters]
Note: does not work with sampling
• interpreted mode:
java -Djava.compiler=none -agentpath:${LIBRARY}=${PARAM}
-Xshareclasses:none [your JVM parameters] -classpath
[class path] [main class] [parameters]
Version 1.6.0
• jit compiler mode:
java -agentpath:${LIBRARY}=${PARAM} -Xshareclasses:none
[your JVM parameters] -classpath [class path] [main
class] [parameters]
Note: does not work with sampling
• interpreted mode:
java -Djava.compiler=none -agentpath:${LIBRARY}=${PARAM}
-Xshareclasses:none [your JVM parameters] -classpath
[class path] [main class] [parameters]
- 96 -
Version 1.7.0
see version 1.6.0
Version 1.4.1
• hotspot mode:
java -Xrunjprofiler:${PARAM} -XX:-UseSharedSpaces
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM} -XX:-UseSharedSpaces
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.2
see version 1.4.1
Version 1.5.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• hotspot (JVMPI) mode:
java -XX:-UseSharedSpaces -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Note: deprecated, default interface JVMTI is preferred
- 97 -
Version 1.6.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.2
see version 1.4.1
Version 1.5.0
• default mode:
java -Xjvmpi:entryexit=off -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• noopt mode:
java -Xnoopt -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.6.0
• default mode:
java -Xjvmpi:entryexit=off -agentpath:${LIBRARY}=${PARAM}
[your JVM parameters] -classpath [class path] [main
class] [parameters]
• noopt mode:
java -Xnoopt -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
- 98 -
Version 1.3.1
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• hotspot mode:
java -Xrunjprofiler:${PARAM} -Xbootclasspath/a:[path
to agent.jar] [your JVM parameters] -classpath [class
path] [main class] [parameters]
Version 1.4.1
• hotspot mode:
java -Xrunjprofiler:${PARAM} -Xbootclasspath/a:[path
to agent.jar] [your JVM parameters] -classpath [class
path] [main class] [parameters]
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.2
see version 1.4.1
Version 1.5.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• hotspot (JVMPI) mode:
java -Xshare:off -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Note: deprecated, default interface JVMTI is preferred
- 99 -
Version 1.6.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• classic mode:
java -classic -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.1
• hotspot mode:
java -Xrunjprofiler:${PARAM} -Xbootclasspath/a:[path
to agent.jar] [your JVM parameters] -classpath [class
path] [main class] [parameters]
Note: does not work with full instrumentation
• interpreted mode:
java -Xint -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Version 1.4.2
see version 1.4.1
Version 1.5.0
• hotspot mode:
- 100 -
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Note: does not work with full instrumentation
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
• hotspot (JVMPI) mode:
java -Xshare:off -Xrunjprofiler:${PARAM}
-Xbootclasspath/a:[path to agent.jar] [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Note: deprecated, default interface JVMTI is preferred
Version 1.6.0
• hotspot mode:
java -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
Note: does not work with full instrumentation
• interpreted mode:
java -Xint -agentpath:${LIBRARY}=${PARAM} [your JVM
parameters] -classpath [class path] [main class]
[parameters]
- 101 -
profiled JVM is running. The path will be interpreted as relative to the current directory of the profiled
JVM.
In situations where physical memory is sparse, saving an HPROF snapshot can be preferable compared
to saving a full JProfiler snapshot. Also, there are alternative ways to save HPROF snapshots:
• with -XX:+HeapDumpOnOutOfMemoryError
The -XX:+HeapDumpOnOutOfMemoryError VM parameter is supported by Sun 1.4.2_12+,
1.5.0_07+ and 1.6+ JVMs and is the basis of the "Out of memory exception" trigger type [p. 81] .
• with jmap
The jmap executable in the JDK can be used to extract an HPROF heap dump from a running
JVM. It is partially supported by Sun 1.5 JVMs and supported by all Sun 1.6 JVMs.
• with jconsole
The jconsole executable in the JDK can be used to extract an HPROF heap dump from a running
JVM. It is available for Java 1.5+. Starting with Java 1.6 you can attach to any local Java process
without any modifications, for Java 1.5, some modifications of the VM parameters are required.
You can also save snapshots with the offline profiling [p. 225] API or use a trigger [p. 80] and the "Save
snapshot" and "Create a HPROF heapdump" actions [p. 84] to save snapshot in an exact way. This
is also useful for offline profiling [p. 225] .
Saved snapshots can be loaded
• JProfiler snapshots
After a JProfiler snapshot has been loaded, the functionality of all views is identical to a live profiling
session with the exception of the heap walker view [p. 137] : The heap walker overview will be shown
if a heap snapshot was taken at the time of saving, otherwise the heap walker will be unavailable.
• HPROF snapshots
When an HPROF snapshot is loaded, only the heap walker is available. Also, the "Allocations" and
"Time" views of the heap walker are not available.
The status bar indicates that a snapshot is being viewed by displaying the message Snapshot in
its rightmost compartment.
• manual synchronization
- 102 -
Nothing is done, you have to copy the config file yourself if you want the new settings to become
active for the next profiling run.
• copy to directory
The config file is copied to the specified directory. You can use the [...] chooser button to select
the directory with a file chooser.
• execute command
The specified command is executed. For example you could invoke ssh to copy the config file to
a remote computer.
No terminal window is shown during the execution. If you have to show a terminal window on
Windows, you can use
Please note that in all cases the profiled JVM has to be restarted in order for the changes to take
effect.
• Sessions to export
Select one or more sessions to be exported. To select all sessions, press CTRL-A in the list and
hit SPACE for toggling the selection. The file format of the exported file is the same as JProfiler's
config file [p. 64] . Licensing information and general settings are omitted.
• Location of the exported file
The location can be a file path or a directory path. For a directory path the exported file will be
named config.xml. The text field that displays the location supports auto-completion.
For importing sessions from an XML file, choose Session->Import Session Settings from JProfiler's
main menu. In the file chooser, select the config file that should be imported. A dialog will be shown
that lists all sessions contained in the config file and allows you to select which sessions to import.
To select all sessions, press CTRL-A in the list and hit SPACE for toggling the selection.
- 103 -
B.5 General settings
B.5.1 General Settings
JProfiler's general settings are divided into several tabs:
• Double-click on the "Name" column to change the name of the JVM. This name is used for JVM
selection in the application settings dialog [p. 65] .
• Double-click on "JVM home directory" and enter a directory manually or click on the button labeled
[...] to change the home directory of an existing JVM. The new directory will be accepted only if
the directory contains a JVM which is usable by JProfiler.
• Choose the JVM Mode from the "JVM Mode" combo box. This setting is initially set to the preferred
value for the chosen JVM. See the remote session invocation table [p. 93] for details on this option.
Deleting an existing Java VM is done by selecting the Java VM which is to be deleted and clicking
the [delete] button on the right hand side of the tab or choosing Delete from the context menu. Please
note that all local sessions which currently use the deleted JVM will remain without an associated
JVM and will be unusable until you assign them a new one in the application settings dialog [p. 65] .
Setting the default Java VM is done by selecting the Java VM which is to be the default Java VM
and clicking the [Set default] button on the right hand side of the tab or choosing Set default in the
context menu. For new sessions, this Java VM will be initially selected in the application settings
dialog [p. 65] . The default Java VM is displayed with a bold font.
Searching for Java VMs is done by clicking the [Search] button on the right hand side of the tab.
This invokes the search wizard which corresponds to the functionality found in JProfiler's setup wizard
- 104 -
[p. 44] .
While the search wizard shows all JVMs found on your local fixed drives, only new JVMs will
be merged into the Java VMs tab in the general settings [p. 104] dialog.
When you switch to a different look and feel, you have to restart JProfiler for the new setting to take
effect.
Note: This setting is not available on Mac OS X.
- 105 -
Warning messages can be disabled by clicking the Don't show this dialog again checkbox in the
warning dialog. To enable selected warning messages again, click the "Configure Hidden Messages"
button.
The external source viewer command allows you to redirect all view source requests from the
JProfiler GUI to an external application. You can use the variables $FILE and $LINE to reference the
file and line number to be shown. If you leave the text box empty, JProfiler will use its internal source
viewer to show Java source code. When JProfiler is started from an IDE integration, the source code
is always shown in the IDE itself.
The browser start command for your default browser can be adjusted here. Use $URL as a variable
for the URL to be displayed. This setting is important for exporting views to HTML [p. 112] and profiling
sessions [p. 65] that are configured to open a URL after startup. If you leave the text box empty,
JProfiler will use the system defaults on Windows and Mac OS X and will try to invoke netscape on
Linux and Solaris.
By default, exported files are opened immediately after they have been exported [p. 112] . In order to
change this behavior, you can deselect the Open exported files checkbox in the "Export options"
section.
- 106 -
B.6 Profiling views
B.6.1 Views Overview
JProfiler organizes profiling data into view sections which collect similar or connected views. The
view section chooser is located on the left side of JProfiler's main window, while the single views of
a view section can be selected by choosing the tabs on the bottom of the window. View sections can
also be switched via JProfiler's Views menu or the keyboard shortcuts which are indicated below.
Note: It is possible to create and export views from a saved snapshot [p. 101] from the command line
[p. 231] or an ant build file [p. 237] . This is especially useful for an automated quality assurance process.
The functionality of the various views is strongly dependent on the state of the current session
which is displayed on the right end of the status bar.
• If the session is attached, the complete functionality of all views is available. In that case, the
session may be either
• working, where the information in all dynamic views is continuously updated. You can use
the update action in the status bar to update a dynamic view at any time.
• frozen, where the information in all dynamic views remains static. You can fetch the current
data for all dynamic views by clicking on the fetch data button which is visible only in the
frozen state.
• If the session is detached, the functionality of most views is incomplete. Any information which
is not already stored in JProfiler's GUI front end and would have to be queried from the profiled
application is unavailable.
- 107 -
• If a profiling snapshot [p. 101] is opened, the status bar displays Snapshot. The functionality of
all views is identical to the working state with the exception of the heap walker view [p. 137] : The
heap walker overview will be shown if a heap snapshot was taken at the time of saving, otherwise
the heap walker will be unavailable.
Most views have specific view settings that can be edited by choosing View->View settings from the
main menu or the corresponding toolbar button when the view is active.
Common properties of profiling views include
• Start center
(CTRL-O) Brings up JProfiler's start center [p. 41] . If there already is an open session in the
current window, it will be discarded once a new session is opened. This action is also available
from JProfiler's toolbar.
• New window
(CTRL-ALT-O) Open in a new instance of JProfiler's main window and brings up JProfiler's start
center [p. 41] .
• New session
(CTRL-N) Creates a new session and brings up the application settings dialog [p. 65] . The new
session will be started after leaving the dialog with [OK]. If there is already an open session in the
current window, it will be discarded.
• Integration wizards
This submenu contains the starting points for the application server integration wizards [p. 42]
, just like the "New session" tab on the start center [p. 41] .
• Conversion wizards
This submenu contains the starting points for the conversion wizards, just like the "Convert" tab
on the start center [p. 41] .
• Open session
Brings up the open session dialog [p. 88] . If there already is an open session in the current
window, it will be discarded once a new session is opened.
• Export session settings
- 108 -
Brings up a dialog where you can export settings for selected sessions [p. 103] to an external config
file.
• Import session settings
Brings up a dialog where you can import settings for selected sessions [p. 103] from an external
config file.
• Save snapshot
(CTRL-S) Brings up a file chooser to select a snapshot file [p. 101] to be written. A dialog box
informs about the successful completion of the operation. This action is also available from JProfiler's
toolbar.
• Open snapshot
Brings up a file chooser to select a snapshot file [p. 101] to be opened. If there already is an open
session in the current window, it will be discarded.
• Session settings
Brings up the session settings dialog [p. 64] .
• General settings
Brings up the general settings dialog [p. 104] .
• IDE integrations
Short cut to the IDE integrations tab of the general settings dialog [p. 105] where you can integrate
all supported IDEs.
• Close session
Closes the current session. If there is an open session in the current window, you will be asked
for confirmation. The window will be kept open and reverted to its original state.
• Close window
(CTRL-W) Closes the current window. If there is an open session in the current window, you will
be asked for confirmation.
• Exit JProfiler
(CTRL-ALT-X) After confirmation, closes all open main windows and exits JProfiler.
The view menu contains view-specific actions and gives access to the view settings dialog. View
specific actions are described in the help page of the corresponding view [p. 107] .
• View settings
(CTRL-T) Brings up the view settings dialog for the corresponding view. If disabled, the currently
active view has no particular settings. This action is also available from JProfiler's toolbar.
The profiling menu contains actions which change the window or session as a whole.
• Stop/Detach/Start/Attach session
(F11) This action is also available from JProfiler's toolbar.
• Stops the session (all session types [p. 64] except remote session), i.e. the process is
destroyed. In a stopped session, the profiling views are not fully functional [p. 107] (visible if
currently started and not remote session).
- 109 -
• Detaches the current remote session [p. 64] . The profiled JVM will be detached from JProfiler's
front end and continues to run undisturbed. In a detached session, the profiling views are not
fully functional [p. 107] (visible if currently attached and remote session).
• Starts the application configured in the current session if it is a local session, applet session
or Web Start session [p. 64] (visible if currently detached and not remote session).
• Attaches the current remote session [p. 64] to a remote application or reconnects to it. (visible
if currently detached and remote session).
• Freeze/Unfreeze session
(F12) This action is also available from JProfiler's toolbar.
• Freeze all views [p. 107] for the current session (visible if currently not frozen).
• Unfreeze all views [p. 107] for the current session (visible if currently frozen).
• Start recording allocation data. (visible if allocations are currently not recorded). Adds a
bookmark with a solid line to all graph views with a time axis.
• Stop recording allocation data. (visible if allocations are currently recorded). Adds a bookmark
with a dashed line to all graph views with a time axis.
• Start recording CPU data. (visible if CPU data is currently not recorded). Adds a bookmark
with a solid line to all graph views with a time axis.
• Stop recording CPU data. (visible if CPU data is currently recorded). Adds a bookmark with
a dashed line to all graph views with a time axis.
• Enable triggers
This action is also available from JProfiler's status bar and toggles the trigger execution state [p.
87]
• Enable triggers. (visible if triggers are currently not enabled). Adds a bookmark with a solid
line to all graph views with a time axis.
• Disable triggers. (visible if triggers are currently disabled). Adds a bookmark with a dashed
line to all graph views with a time axis.
- 110 -
• Enable trigger groups
Brings up a dialog to enable or disable groups of triggers [p. 87] .
• Save HPROF snapshot
Brings up a dialog to select a path for an HPROF snapshot file [p. 101] to be saved. A dialog
box informs about the successful completion of the operation.
• Run garbage collector
Run the garbage collector in the profiled JVM. This action is also available from JProfiler's
toolbar.
• Add bookmark
Add a bookmark in all graph views with a time axis. Bookmarks can be renamed or deleted by
right-clicking them and choosing the appropriate action from the context menu. Bookmarks can
also be set programmatically from the profiling API [p. ?] .
• Edit bookmarks
Brings up a dialog where you can edit all existring bookmarks [p. 115] .
• Show global filters for method call recording
Show a dialog with a tree view of all exclusive or inclusive filters [p. 70] that JProfiler uses when
recording the method call tree. This action is also available at the bottom of several views that
show call trees.
The go to menu provides one-click access to all of JProfiler's profiling views, grouped into the four
view sections [p. 107] .
The window menu allows you to keep track of all tops level windows created by JProfiler [p. 113] .
• Undock/Dock view
(CTRL-E) This action is also available from the context menu when right clicking the view in the
tab selector at the bottom of the window.
• Undocks the view and shows it in a separate top level window. (visible if the currently active
view is docked into the main window)
• Docks the view and returns it to the main window. (visible if the currently active view is
undocked)
- 111 -
Close all console windows that do not have an active process associated with them.
At the bottom of the window menu you can directly navigate to a window by selecting it from the list.
The help menu gives access to help, web sites, and useful e-mail addresses for JProfiler.
• Help contents
(F1) Brings up context sensitive help. This action is also available from JProfiler's toolbar.
• JProfiler on the web
Connects to JProfiler's web site in the web browser configured under general settings [p. 105] .
• Contact sales
Brings up a sales contact form in the web browser configured under general settings [p. 105] .
• Contact support
Brings up a support contact form in the web browser configured under general settings [p. 105] .
• Enter license key
Allows you to enter your license key [p. 44] .
• About JProfiler
Shows general information about your copy of JProfiler and its license status.
• HTML
Available for all views. The view will be exported to an HTML file. Besides the HTML file, several
image files might be written to a subdirectory jprofiler_images. If the option to open files after
export [p. 105] is enabled, the web browser configured in the general settings [p. 105] is opened and
the exported HTML file is displayed.
• CSV data
Available for tabular views, hot spot views and graphs with a time axis. CSV data suitable for
Microsoft Excel is written to a file. If the option to open files after export [p. 105] is enabled, the
registered application for CSV is opened and the exported CSV file is displayed.
Note: When using Microsoft Excel, CSV is not a stable format. Microsoft Excel on Windows takes
the separator character from the regional settings. JProfiler uses a semicolon as the separator in
locales that use a comma as a decimal separator and a comma in locales that use a dot as a
decimal separator. If you need to override the CSV separator character you can do so by setting
-Djprofiler.csvSeparator in bin/jprofiler.vmoptions.
• XML data
Available for tree views and hot spot views. XML data with a self-explanatory format is written to
a file. If the option to open files after export [p. 105] is enabled, the registered application for XML
is opened and the exported XML file is displayed.
- 112 -
If you export the same view multiple times to the same directory under the same name, a running
number will be appended to the filename. The export directory location is persistent and remembered
across restarts.
With the HTML export functionality you can print all views from JProfiler via your web browser.
An undocked view has a reduced main menu that contains only the View and Window menus from
the main menu [p. 108] as well as a reduced toolbar. With Window->Show main window for this session
(CTRL-H) the corresponding main window can be activated.
If a view has been undocked, a placeholder is shown in the corresponding tab in the main window.
An undocked view can be re-docked into its main window by
• choosing Window->Dock view from the main menu of the undocked view.
• closing the window.
• clicking the dock button in the placeholder for the view.
• choosing Window->Dock view from JProfiler's main menu
• right clicking the view in the tab selector at the bottom of the window and choosing Undock view
from the context menu.
Undocked views can be tiled or stacked with the Window->Tile all undocked view and Window->Stack
all undocked view menu entries. Note that undocked views of all main windows are treated uniformly.
To dock all undocked views with a single action, please choose Window->Dock all floating view. Note
that undocked views of all main windows are docked.
JProfiler keeps track of all created top level windows in the window list available at the bottom of the
Window menu. These windows include
• main windows
• undocked views
• console windows
• source and bytecode viewers
- 113 -
This list does not include
To navigate to a window in the window list, click on it or use the Window->Cycle to previous window
(CTRL-F2) and Window->Cycle to next window (CTRL-F3) menu entries.
Performing one of these operations multiple times alternates between ascending and descending
sort order. The current sort column and sort order is indicated graphically in the column headers as
well as in the relevant menus.
Most numeric columns in JProfiler display only positive numbers. If negative negative numbers can
be present, you might want to sort using either absolute or the normal ordering. This choice can be
made in the view settings dialog of the relevant views.
• Zoom in by rolling the mouse wheel toward you, clicking on the zoom in toolbar button or
choosing the corresponding entry from the context menu.
• Zoom out by rolling the mouse wheel away from you, clicking on the zoom out toolbar button
or choosing the corresponding entry from the context menu.
• Zoom to 100% by clicking on the zoom 100% toolbar button or choosing the corresponding
entry from the context menu.
• Fit graph to window by clicking on the fit content toolbar button or choosing the corresponding
entry from the context menu.
To zoom in on a particular object, you can select it first and then use the zoom in action described
above.
Besides using the scrollbars to navigate to other parts of the graph you can drag the graph with the
mouse to move it.
B.6.8 Bookmarks
All graph views with a time axis display bookmarks. Bookmarks are vertical lines at certain points of
the time axis. Every bookmark has a description. When you hover with the mouse above a bookmark,
the description will be displayed in a tooltip window. Bookmarks are global for all views, i.e. a
bookmark is displayed in all graphs and has the same description everywhere.
Bookmarks are created
- 114 -
• when starting and stopping allocation recording [p. 118]
• when starting and stopping CPU recording [p. 170]
• when enabling or disabling triggers [p. 87]
• when starting and stopping method statistics recording [p. 186]
• when starting and stopping call tracing [p. 189]
• when saving a snapshot [p. 101]
• when taking a heap dump [p. 137]
• when profiling settings are updated [p. 64]
• when starting or stopping monitor recording [p. 199]
• when taking a thread dump [p. 198]
• manually
You can manually add a bookmark at the current time by
You can add a bookmark at any past moment in time by moving the mouse to the desired point
on a graph view with a time axis and choose Add bookmark here here from the main menu.
• from the profiling API
You can use the profiling API [p. ?] in order to add a bookmark programatically.
• with a trigger
You can also use a trigger [p. 80] and the "Add bookmark" action [p. 84] to add a bookmark. This
is also useful for offline profiling [p. 225] .
For the start event, the bookmark is a solid line, for the stop event, the bookmark is a dashed line.
In graph views with a time axis you can
The list of bookmarks can be shown by choosing Profiling->Edit Bookmarks from JProfiler's main
menu. The bookmark dialog [p. 115] will be shown where you can edit, delete and export the list of
bookmarks.
• Time
The time when the bookmark was set, relative to the start of the JVM.
• Line style and color
- 115 -
The line style (solid or dashed) and the color of the bookmark line as shown in the graph views
with a time axis is shown as a sample. For automatic bookmarks, solid lines indicate a start event,
while dashed lines indicate a stop event.
• Description
For automatic bookmarks, the description indicates the origin of the bookmark.
Bookmarks can be
• edited by selecting a single bookmark and clicking on the [Edit] button or by double-clicking
on a bookmark. A dialog will be shown where you can edit the description, the color and the line
style of the bookmark.
• deleted by selecting one or multiple bookmarks and clicking on the [Remove] button or hitting
the DEL key.
• sorted by time or by description by clicking on the table columns.
• searched by typing into the table or choosing Find from the context menu.
• exported to HTML or CSV by clicking on the [Export] button in the lower-right corner of the
dialog.
• General information
• Constant pool
• Interfaces
• Fields
• Methods
• Class file attributes
If you look for the bytecode, select the "Code" child of the desired method. The bytecode viewer is
extensively hyperlinked, allowing you to navigate easily to constant pool entries or branch targets
- 116 -
and go back and forth in your navigation history with the navigation controls at the top of the
tab.
Note: When JProfiler is started through an IDE integration [p. 46] , the integrated source code viewer
is not used and the source element is displayed in the IDE.
com.mycorp,-com.mycorp.parser
will resolve all calls to the com.mycorp package hierarchy except any calls to the com.mycorp.parser
sub-hierarchy. You can also start the filter list with exceptions, in that case all calls will be resolved
except for the specified packages.
In one JProfiler main window, all dynamic views with a view filter box at the bottom share the same
current view filter. To reset the view filter and show the entire content of the view again, click on [Reset
view filters] in the lower right corner of the view. The combo box holds view filters that have been
entered during the current session. Selecting an entry from the combo box enables the view filter
immediately.
View filters have an effect similar to the inclusive filters that are set for the session. These are
configured in the session settings dialog [p. 69] and are not adjustable without loss of recorded data
while the session is active. However, the active filter sets of the session strongly influence the speed
and memory consumption of the profiled application while the view filters don't. It is therefore advisable
to activate as many filter sets as possible in the filter settings [p. 69] and use the view filters for dynamic
drill down only.
- 117 -
B.6.12 Memory view section
Unless "Record allocations on startup" has been selected in the Startup section of the profiling
settings dialog [p. 73] , data acquisition has to be started manually by clicking on Record allocation
data in the tool bar or by selecting Profiler->Record allocation data from JProfiler's main menu.
Bookmarks [p. 114] will be added when recording is started or stopped manually.
Allocation data acquisition can be stopped by clicking on Stop recording allocation data in the
tool bar or by selecting Profiler->Stop recording allocation data from JProfiler's main menu.
The allocation recording state is shown in the status bar with a memory icon which is shown in
gray when allocations are not recorded. Clicking on the memory icon will toggle allocation recording.
Restarting data acquisition resets all data in the the recorded objects view [p. 121] , the allocation call
tree [p. 124] and the allocation hot spots view [p. 129] . Only the all objects view (JVMTI only) [p. 119] is
not influenced by allocation recording.
When you stop recording allocations, the recorded objects will still be tracked for garbage collection.
For example, if all recorded objects are garbage collected, both the recorded objects view and the
allocation call tree will be empty in their default view mode (live objects only). You can then still display
all recorded objects if you switch to one of the other two view modes (garbage collected only or both
live and garbage collected).
Note that you can also use a trigger [p. 80] and the "Start recording" and "Stop recording" actions [p.
84] to control allocation recording in a fine-grained and exact way. This is also useful for offline profiling
[p. 225] .
The heap walker [p. 137] will be able to display allocation call stack information only for recorded
objects, otherwise the entire heap is displayed in the heap walker.
The memory views are integrated with the heap walker. The take heap snapshot with selection
[p. 137] action on the toolbar, in the View and context menus takes a heap snapshot and creates an
object set with the currently selected objects.
- 118 -
B.6.12.2 All objects
• classes
Every row in the table is a single class. This is the default aggregation level.
• packages
Every row in the table is a single package. Sub-packages are not included. In this aggregation
level, the table becomes a tree table. You can open each package by clicking on the tree node
on its left and see the contained classes directly beneath it.
• Java EE components
Every row in the table is a Java EE component [p. 76] . This aggregation level is like a filter for the
classes mode and enables you to quickly check the loaded Java EE components in your profiled
application.
There are three columns shown in the table, which can be sorted [p. 114] .
• Name
Depending on the aggregation level, this column shows different values:
• classes
shows the name of the class or the array type. When using Java version up to 1.4 or Java 1.5
with the old profiling interface JVMPI, the notation <class>[] stands for non-primitive arrays
of any class type. (e.g. the array might be of type String[] or Object[]). A further distinction
is not possible due to restrictions in the profiling interface.
• package
shows the name of the package.
• Java EE
shows the display name of the Java EE component. If the display name is different from the
actual class name, the class name is displayed in square brackets.
• Instance count
Shows how many instances are currently allocated on the heap. This instance count is displayed
graphically as well.
• Size
Shows the total size of all allocated instances. Note that this is the shallow size which does not
include the size of referenced arrays and instances but only the size of the corresponding pointers.
The size is in bytes and includes only the object data, it does not include internal JVM structures
for the class, nor does it include class data or local variables.
The update frequency for the all objects view can be set on the miscellaneous tab [p. 78] in the profiling
settings dialog [p. 73] . The update frequency of the all objects view is adjusted automatically
according to the total number of objects on the heap. If there are many objects on the heap, the
- 119 -
calculation of the all objects view becomes more expensive, so the update frequency is reduced. You
can always retrieve the current data by clicking on the refresh button in the status bar.
You can add a selected class or package to the class tracker [p. 134] by bringing up the context menu
with a right click and choosing Add Selection To Class Tracker. If the class tracker is not
recording, recording will be started for all classes configured in the class tracker. If the class tracker
is recording with a different object type or liveness type, all recorded data will be cleared after a
confirmation dialog.
You can freeze all views [p. 107] to ensure that the all objects view remains static.
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The primary measure defines which measurement will be shown in the second column of the all
objects view. That column shows its values graphically with a histogram, is the default sort column
and is used for the difference column. By default, the primary measure is the instance count.
Alternatively, you can work with the shallow size, which is especially useful if you're looking at arrays.
The sorting of the difference column can be toggled between absolute value ordering or normal
ordering.
- 120 -
B.6.12.3 Recorded objects
• classes
Every row in the table is a single class. This is the default aggregation level.
• packages
Every row in the table is a single package. Sub-packages are not included. In this aggregation
level, the table becomes a tree table. You can open each package by clicking on the tree node
on its left and see the contained classes directly beneath it.
• Java EE components
Every row in the table is a Java EE component [p. 76] . This aggregation level is like a filter for the
classes mode and enables you to quickly check the loaded Java EE components in your profiled
application.
There are three columns shown in the table, which can be sorted [p. 114] .
• Name
Depending on the aggregation level, this column shows different values:
• classes
shows the name of the class or the array type. When using Java version up to 1.4 or Java 1.5
with the old profiling interface JVMPI, the notation <class>[] stands for non-primitive arrays
of any class type. (e.g. the array might be of type String[] or Object[]). A further distinction
is not possible due to restrictions in the profiling interface.
• package
shows the name of the package.
• Java EE
shows the display name of the Java EE component. If the display name is different from the
actual class name, the class name is displayed in square brackets.
• Instance count
Shows how many instances are currently allocated on the heap. This instance count is displayed
graphically as well.
• Size
Shows the total size of all allocated instances. Note that this is the shallow size which does not
include the size of referenced arrays and instances but only the size of the corresponding pointers.
The size is in bytes and includes only the object data, it does not include internal JVM structures
for the class, nor does it include class data or local variables.
For a selected class or package, you can jump from the recorded objects view to the allocation call
tree [p. 124] as well as the allocation hot spots [p. 129] by bringing up the context menu with a right click
- 121 -
and choosing Show allocation tree for selection or Show allocation hot spots
for selection.
You can add a selected class or package to the class tracker [p. 134] by bringing up the context menu
with a right click and choosing Add Selection To Class Tracker. If the class tracker is not
recording, recording will be started for all classes configured in the class tracker. If the class tracker
is recording with a different object type or liveness type, all recorded data will be cleared after a
confirmation dialog.
The recorded objects view can filter objects according to their liveness status:
• Live objects
Only objects which are currently in memory are shown.
• Garbage collected objects
Only objects which have been garbage collected are shown.
• Live and garbage collected objects
All created objects are shown.
To switch between the three modes, you can click on the toolbar entry displaying the current mode
and chose the new desired mode. Also, JProfiler's main menu and the context menu allow the
adjustment of the view mode via View->Change view mode.
If the garbage collected objects are shown, you can reset the accumulated data by clicking on the
reset action in the toolbar or choosing the the Reset garbage collector for this view menu item in the
View or context menu. All garbage collector data will be cleared and the view will be empty for the
"Garbage collected objects" mode until further objects are garbage collected. Note that you can force
garbage collection by clicking on the garbage collector tool bar button or by selecting Profiler->Run
garbage collector from JProfiler's main menu.
The update frequency for the recorded objects view can be set on the miscellaneous tab [p. 78] in
the profiling settings dialog [p. 73] .
You can stop and restart allocation recording [p. 118] to clear the recorded objects view and freeze all
views [p. 107] to ensure that the recorded objects view remains static.
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The primary measure defines which measurement will be shown in the second column of the recorded
objects view. That column shows its values graphically with a histogram, is the default sort column
- 122 -
and is used for the difference column. By default, the primary measure is the instance count.
Alternatively, you can work with the shallow size, which is especially useful if you're looking at arrays.
The sorting of the difference column can be toggled between absolute value ordering or normal
ordering.
- 123 -
B.6.12.4 Allocation call tree
In order to prepare an allocation call tree, you have to click on the calculate toolbar button or choose
View->Calculate allocation call tree from JProfiler's main menu. If an allocation tree has already been
calculated, the context sensitive menu also gives access to this action.
Before the allocation call tree is calculated, the allocation options dialog [p. 135] is shown. The class
or package selection as well as the selected liveness mode are displayed at the top of the allocation
call tree view.
JProfiler automatically detects Java EE components [p. 76] and displays the relevant nodes in the
allocation call tree with special icons that depend on the Java EE component type:
servlets
JSPs
EJBs
• JSPs
the path of the JSP source file
• EJBs
the name of the EJB interface
If URL splitting [p. 76] is enabled, each request URL creates a new node with a special icon and
the prefix URL:, followed by the part of the request URL on which the allocation call tree was split.
Note that URL nodes group request by the displayed URL.
You can disable both Java EE component detection as well as URL splitting on the Java Subsystems
[p. 76] tab of the profiling settings [p. 73] . Also, the URL splitting method can be customized in the
profiling settings or with a custom handler in the profiling API [p. ?] .
The allocation call tree view has an aggregation level selector. It allows you to switch between
• methods
Every node in the tree is a method call. This is the default aggregation level. Special Java EE
component methods have their own icon (see above) and display name, the real class name is
appended in square brackets.
• classes
Every node in the tree is a single class. Java EE component classes have their own icon (see
above) and display name, the real class name is appended in square brackets.
• packages
Every node in the tree is a single package. Sub-packages are not included.
• Java EE components
- 124 -
Every node in the tree is a Java EE component [p. 76] . If the component has a separate
display name, the real class names are omitted.
When you switch between two aggregation levels, JProfiler will make the best effort to preserve your
current selection. When switching to a a more detailed aggregation level, there may not be a unique
mapping and the first hit in the allocation call tree is chosen.
The allocation call tree doesn't display all method calls in the JVM, it only displays
• unfiltered classes
Classes which are unfiltered according to your configured filter sets [p. 69] are used for the
construction of the allocation call tree.
• first level calls into unfiltered classes
Every call into a filtered class that originates from an unfiltered class is used for the construction
of the allocation call tree. Further calls into filtered classes are not resolved. This means that a
filtered node can include information from other filtered calls. Filtered nodes are painted with a red
marker in the top left corner.
• thread entry methods
The methods Runnable.run() and the main method are always displayed, regardless of the
filter settings.
A particular node is a bridge node if it would normally not be displayed in the view, but has descendant
nodes that have to be displayed. The icons of bridge nodes are grayed out. For the allocation call
tree view this is the case if the current node has no allocations, but there are descendant nodes that
have allocations.
When navigating through the allocation call tree by opening method calls, JProfiler automatically
expands methods which are only called by one other method themselves.
To quickly expand larger portions of the allocation call tree, select a method and choose
View->Expand Multiple Levels from the main window's menu or choose the corresponding menu item
from the context menu. A dialog is shown where you can adjust the number of levels (20 by default)
and the threshold in per mille of the parent node's value that determines which child nodes are
expanded.
If you want to collapse an opened part of the allocation call tree, select the topmost method that
should remain visible and choose View->Collapse all from the main window's menu or the context
menu.
If a method node is selected, the context menu allows you to quickly add a method trigger [p. 80] for
the selected method with the add method trigger action. A dialog [p. 87] will be displayed where
you can choose whether to add the method interception to an existing method trigger or whether to
create a new method trigger.
Nodes in the allocation call tree can be hidden by selecting them and hitting the DEL key or by
choosing Hide Selected from the context menu. Percentages will be corrected accordingly as if the
hidden node did not exist. All similar nodes in other call stacks will be hidden as well.
When you hide a node, the toolbar and the context menu will get a Show Hidden action. Invoking
this action will bring up a dialog where you can select hidden elements to be shown again.
The tree map selector above the allocation call tree view allows you to switch to an alternate
visualization: A tree map that shows all call stacks as a set of nested rectangles. Please see the
Wikipedia page on tree maps for more information on tree maps in general.
- 125 -
Each rectangle represents a particular call stack. The area of the rectangle is proportional to the
length of the percentage bar in the tree view. In contrast to the tree, the tree map gives you a flattened
perspective of all leafs in the tree. If you're mostly interested in the dominant leafs of the call trees,
you can use the tree map in order to find them quickly without having to dig into the branches of the
tree. Also, the tree map gives you an overall impression of the relative importance of leaf nodes.
By design, tree maps only display values of leaf nodes. Branch nodes are only expressed in the way
the leaf nodes are nested. For non-leaf nodes which have significant inherent values, JProfiler
constructs synthetic child nodes. In the diagram below, you can see that node A has an inherent
value of 20% so that its child nodes have a sum of 80%. To show the 20% inherent value of A in the
tree map, a synthetic child node A' with a total value of 20% is created. It is a leaf node and a sibling
node of B1 and B2. A' will be shown as a colored rectangle in the tree map while A is only used for
determining the geometric arrangement of its child nodes B1, B2 and A'.
The actual information for tree map nodes is displayed in tool tips that are immediately shown when
you hover over the tree map. It corresponds to the information that is shown in the tree view mode.
If a tree map rectangle exceeds a certain size, its name is printed directly in the tree map.
The tree map is shown up to a maximum nesting depth of 25 levels. The depth of the call stack of a
particular leaf in the tree map is encoded in its color. The color scale blends blue into yellow, where
blue indicates a smaller and yellow a larger depth. The scale is always relative to all currently displayed
nodes. For example, if you zoom into a particular area of the tree map, the scale will be re-adjusted
so that that the depth of the parent node corresponds to blue. Below the tree map, a legend presents
all possible colors as well as the displayed maximum and minimum depths.
Double-clicking on any colored rectangle in the tree map will zoom to the parent node unless the
node is already a top-level node. There are tool bar actions for for zooming in and zooming out,
as well as as context actions for showing the actual root of the allocation call tree.
In order to explore the hierarchical environment of a particular leaf in the tree map, there is a context
action "Show In Tree", that switches to the tree view mode and selects the same node there.
If enabled in the view settings [p. 127] , every node in the allocation call tree has a percentage bar
whose length is proportional to the total number of allocations including all descendant nodes and
whose light-red part indicates the percentage of allocations in the current node.
Every node in the allocation call tree has textual information attached that depends on the allocation
call tree settings [p. 127] and shows
• a percentage number which is calculated with respect to the root of the tree or calling node.
• a size measurement in bytes or kB which displays the shallow size of those objects which were
allocated here (depends on cumulation view setting, see below).
• an allocation count which shows how many instances of classes and arrays have been allocated
here (depends on cumulation view setting, see below).
- 126 -
• a name which depends on the aggregation level:
• methods
a method name that is either fully qualified or relative with respect to to the calling method.
• classes
a class name.
• packages
a package name.
• Java EE components
the display name of the Java EE component.
Note that the line number shows the line number of the invocation and not of the method itself.
The size and the allocation count are either cumulated for all calls below the associated node or not,
depending on the corresponding cumulation view setting [p. 127] . Note that allocations performed in
calls to filtered classes are consolidated in the first call into a filtered class.
If garbage collected objects are shown, you can reset the accumulated data by clicking on the
reset action in the toolbar or choosing the the Reset garbage collector for this view menu item in the
View or context menu. All garbage collector data will be cleared and the view will be empty for the
"Garbage collected objects" mode until further objects are garbage collected and a new allocation
call tree or allocation hot spots are calculated. Note that you can force garbage collection by clicking
on the garbage collector tool bar button or by selecting Profiler->Run garbage collector from
JProfiler's main menu.
Only recorded objects will be displayed in the allocation call tree view. See the memory section
overview [p. 118] for further details on allocation recording.
The View->Take heap snapshot for selection menu item and the corresponding toolbar entry take
a new snapshot, switch to the heap walker view [p. 137] and create an object set with the currently
selected class and allocation spot.
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
- 127 -
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The node description options control the amount of information that is presented in the description
of each node.
The percentage calculation determines against what allocation numbers percentages are calculated.
• Absolute
Percentage values show the contribution to the total number of allocations.
• Relative
Percentage values show the contribution to the parent method.
Whether the contribution is cumulated or not depends on the Cumulate allocations setting (see
above).
- 128 -
B.6.12.5 Allocation hot spots view
In order to prepare allocation hot spots, you have to click on the calculate toolbar button or choose
View->Calculate allocation hot spots from JProfiler's main menu. If allocation hot spots have already
been calculated, the context sensitive menu also gives access to this action.
Before the allocation hot spots are calculated, the allocation options dialog [p. 135] is shown. The class
or package selection as well as the selected liveness mode are displayed at the top of the allocation
call tree view.
The combo box at the top-right corner of the view allows you to treat allocations of filtered classes in
two different ways:
• show separately
Filtered classes can contribute hotspots of their own. This is the default mode.
• add to calling class
Allocations of filtered classes are always added to the calling class. In this mode, a filtered class
cannot contribute a hotspot, except if it has a thread entry method (run and main methods).
With these two modes you can change your viewpoint and the definition of a hotspot. Please see the
help topic on hotspots and filters [p. 37] for a detailed discussion of this topic.
Depending on your selection of the aggregation level, the method hot spots will change. They and
their hot spot backtraces will be aggregated into classes or packages or filtered for Java EE component
types.
Every hot spot is described in several columns:
• methods
a method name that is either fully qualified or relative with respect to to the calling method.
• classes
a class name.
• packages
a package name.
• Java EE components
the display name of the Java EE component.
• the percentage of all allocations together with a bar whose length is proportional to this value.
- 129 -
• the number of allocations.
The hot spot list can be sorted on all columns [p. 114] .
If you click on the handle on the left side of a hot spot, a tree of backtraces will be shown. Every
node in the backtrace tree has textual information attached to it which depends on the allocation hot
spots view settings [p. 133] .
• the percentage of all allocations. This value is calculated with respect either to the parent hot spot
or the called method. The percentage base can be changed in the allocation hot spots view settings
[p. 133] .
• the number of allocations that are contributed to the hot spot along this call path. If enabled in
the view settings, every node in the hot spot backtraces tree has a percentage bar whose length
is proportional to this number.
Note: This is not the number of allocations in this method.
• a name which depends on the aggregation level:
• methods
a method name that is either fully qualified or relative with respect to to the calling method.
• classes
a class name.
• packages
a package name.
• Java EE components
the display name of the Java EE component.
Note that the line number shows the line number of the invocation and not of the method itself.
JProfiler automatically detects Java EE components [p. 76] and displays the relevant nodes in the
hot spot backtraces tree with special icons that depend on the Java EE component type:
servlets
JSPs
EJBs
• JSPs
the path of the JSP source file
• EJBs
- 130 -
the name of the EJB interface
If URL splitting [p. 76] is enabled, each request URL creates a new node with a special icon and
the prefix URL:, followed by the part of the request URL on which the hot spot backtraces tree was
split. Note that URL nodes group request by the displayed URL.
You can disable both Java EE component detection as well as URL splitting on the Java Subsystems
[p. 76] tab of the profiling settings [p. 73] . Also, the URL splitting method can be customized in the
profiling settings or with a custom handler in the profiling API [p. ?] .
The allocation hot spots view has an aggregation level selector. It allows you to switch between
• methods
Every node in the tree is a method call. This is the default aggregation level. Special Java EE
component methods have their own icon (see above) and display name, the real class name is
appended in square brackets.
• classes
Every node in the tree is a single class. Java EE component classes have their own icon (see
above) and display name, the real class name is appended in square brackets.
• packages
Every node in the tree is a single package. Sub-packages are not included.
• Java EE components
Every node in the tree is a Java EE component [p. 76] . If the component has a separate
display name, the real class names are omitted.
When you switch between two aggregation levels, JProfiler will make the best effort to preserve your
current selection. When switching to a a more detailed aggregation level, there may not be a unique
mapping and the first hit in the hot spot backtraces tree is chosen.
The hot spot backtraces tree doesn't display all method calls in the JVM, it only displays
• unfiltered classes
Classes which are unfiltered according to your configured filter sets [p. 69] are used for the
construction of the hot spot backtraces tree.
• first level calls into unfiltered classes
Every call into a filtered class that originates from an unfiltered class is used for the construction
of the hot spot backtraces tree. Further calls into filtered classes are not resolved. This means that
a filtered node can include information from other filtered calls. Filtered nodes are painted with a
red marker in the top left corner.
• thread entry methods
The methods Runnable.run() and the main method are always displayed, regardless of the
filter settings.
When navigating through the hot spot backtraces tree by opening method calls, JProfiler automatically
expands methods which are only called by one other method themselves.
To quickly expand larger portions of the hot spot backtraces tree, select a method and choose
View->Expand Multiple Levels from the main window's menu or choose the corresponding menu item
from the context menu. A dialog is shown where you can adjust the number of levels (20 by default)
- 131 -
and the threshold in per mille of the parent node's value that determines which child nodes are
expanded.
If you want to collapse an opened part of the hot spot backtraces tree, select the topmost method
that should remain visible and choose View->Collapse all from the main window's menu or the
context menu.
If a method node is selected, the context menu allows you to quickly add a method trigger [p. 80] for
the selected method with the add method trigger action. A dialog [p. 87] will be displayed where
you can choose whether to add the method interception to an existing method trigger or whether to
create a new method trigger.
Nodes in the hot spot backtraces tree can be hidden by selecting them and hitting the DEL key or
by choosing Hide Selected from the context menu. Percentages will be corrected accordingly as if
the hidden node did not exist.
When you hide a node, the toolbar and the context menu will get a Show Hidden action. Invoking
this action will bring up a dialog where you can select hidden elements to be shown again.
By marking the current state, you can follow the evolution of the allocation hotspots. This is particularly
useful for quickly finding the origin of memory leaks. Marking the current values can be achieved by
Upon marking, a fourth column labeled Difference appears with all values initially set to zero. With
each subsequent calculation of the allocation hot spots, the column's values track the difference of
the allocation count with respect to the point in time where the mark was set. The graphical
representation of the percentage column shows the marked state in green and positive differences
in red.
By default, the difference column is sorted on the absolute values in it, this can be changed in the
allocation hot spots view settings dialog [p. 133] .
You can remove the mark by
If garbage collected objects are shown, you can reset the accumulated data by clicking on the
reset action in the toolbar or choosing the the Reset garbage collector for this view menu item in the
View or context menu. All garbage collector data will be cleared and the view will be empty for the
"Garbage collected objects" mode until further objects are garbage collected and a new allocation
call tree or allocation hot spots are calculated. Note that you can force garbage collection by clicking
on the garbage collector tool bar button or by selecting Profiler->Run garbage collector from
JProfiler's main menu.
Only recorded objects will be displayed in the allocation hot spots view. See the memory section
overview [p. 118] for further details on allocation recording.
The View->Take heap snapshot for selection menu item and the corresponding toolbar entry take
a new snapshot, switch to the heap walker view [p. 137] and create an object set with the currently
selected class and allocation hot spot.
- 132 -
B.6.12.5.2 Allocation Hot Spot View Settings
The allocation hot spots view settings dialog is accessed by bringing the allocation hot spots [p. 129]
to front and choosing View->View settings from JProfiler's main menu or clicking on the corresponding
toolbar button. The context menu also gives access to the view settings dialog.
You can select a size scale mode for all displayed sizes:
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The node description options control the amount of information that is presented in the description
of each node.
The percentage calculation determines against what allocation numbers percentages are calculated
for the hot spot backtraces.
• Absolute
Percentage values show the contribution to the total number of allocations.
• Relative
Percentage values show the contribution relative to the called method.
The sorting of the difference column can be toggled between absolute value ordering or normal
ordering.
- 133 -
B.6.12.6 Class tracker
In order to start tracking classes, you have to click on the record toolbar button or choose
View->Record class tracker data from JProfiler's main menu.
Before class tracking is started, the class tracker options dialog [p. 134] is shown. The selected classes
and packages are shown in a combo box, the object type (all objects or recorded objects) and liveness
mode (for recorded objects only) selections are shown at the top of the class tracker view.
After class tracking is started, the record button becomes a stop button that allows to to end
recording for all feeds.
Data display and zoom controls are equivalent to those in the VM telemetry views [p. 207] . Always one
class or package is displayed as a graph (a single "feed"), the combo box above the graph allows
you to switch between the recorded classes and packages. With the add and remove buttons
you can add and remove classes and package recordings without disrupting the recording of other
feeds. The graph for each feed always starts at the point in time when a feed has been added. When
you remove a feed, all associated data is deleted.
Stopping class tracking and re-starting it again at a later point does not delete previously recorded
data unless the object type or liveness mode (for recorded objects) are changed.
The selection of classes and packages for the class tracker as well as the selected object type (all
objects or recorded objects) and liveness type is persistent for a session, across restarts of
JProfiler.
The class tracker options dialog is displayed if you execute the record action for the class tracker
view [p. 134] . It allows you to specify parameters that determine the way the displayed instance counts
are calculated. Your selection will be displayed at the top of the class tracker.
The add button brings up the class and package selection dialog [p. 135] that allows you to select
either a class or a package for addition to the list of classes and packages that should be tracked.
With the remove button and the reorder buttons you can change the contents of that list
before the tracking is started.
The class tracker view itself offers add and remove buttons in the top right corner as well.
If you profile with JVMTI (Java 1.5 and higher), you can select whether to use the total number of
objects [p. 119] in the heap as the value for the graph or only the recorded objects [p. 121] . For JVMPI
(Java 1.4 and lower), the recorded objects are always used.
If you track recorded objects, you can select their liveness which is explained in the help for the
recorded objects view [p. 121] .
When you click on [OK], tracking is started on the selected classes and packages and the graph for
the first element in the list is displayed.
- 134 -
B.6.12.7 Allocation Options Dialog
The allocation options dialog is displayed if you execute the calculate action for the allocation call
tree view [p. 124] or the . It allows you to specify parameters that determine the information contained
in the call tree. Your selection will then be displayed at the top of both views. The allocation call tree
and the allocation hot spots are always calculated together, so the settings in this dialog apply to both
views.
The allocation call tree and allocation hot spots can display:
If the allocation recording mode [p. 77] is set to "Live and GCed objects without class resolution", it
is not possible to switch to select class for the "Allocations for a selected class or package" mode
and a corresponding warning message will be displayed.
The allocation call tree can show objects according to their liveness status:
• Live objects
Only objects which are currently in memory are shown.
• Garbage collected objects
Only objects which have been garbage collected are shown.
• Live and garbage collected objects
All created objects are shown.
If the allocation recording mode [p. 77] is set to "Live objects only", it is not possible to switch to view
modes with garbage collected objects and a corresponding warning message will be displayed.
By default, the data in the allocation call tree and allocation hot spots views will not be updated
automatically. If you would like to periodically update the views with the current data, select the
Auto-update the allocation views check box. Please note that for large heaps this can incur
a significant performance overhead.
When you click on [OK], the allocation tree and the allocation hot spots are calculated. If you have
a large heap, this can take a few seconds. If you click cancel, no new allocation tree and allocation
hot spots will be calculated.
• Classes
A single class can be chosen by double-clicking on it or selecting it in the tree and clicking [OK]
or pressing the Enter key.
• Packages
- 135 -
An entire package and all its recursively contained sub-packages can be chosen by selecting
the desired package in the tree and clicking [OK] or pressing the Enter key.
• Arrays
An array type can be chosen by opening the <Arrays> top level node and double-clicking on the
desired array type or selecting it and clicking [OK] or pressing the Enter key.
- 136 -
B.6.13 Heap walker view section
If a snapshot has already been taken, it will be discarded after confirmation. If the current session
[p. 64] is detached [p. 107] , it is not possible to take a new snapshot, Taking a snapshot may take
a few seconds depending on the size of the profiled application.
A bookmarks [p. 114] will be added when a heap snapshot is taken manually.
Note that you can also use a trigger [p. 80] and the "Trigger heap dump" action [p. 84] to take a
snapshot. This is also useful for offline profiling [p. 225] .
• the initial object set
After a snapshot has been fully prepared, you are taken to the the classes view [p. 142] and all
objects in the snapshot are displayed. You can return to this view at any later point by
- 137 -
• the biggest objects view [p. 146]
• the reference view [p. 148]
• the data view [p. 161]
• the time view [p. 165]
• shallow size
The shallow size does not include the size of referenced arrays and instances but only the size
of the corresponding pointers. Shallow sizes are trivially available for all objects and object sets
and are displayed in all views.
• retained size
The retained size is calculated as the shallow size plus total size of all objects that would be
garbage collected if the current object or object set were removed. This size tells you how much
memory is really behind an object or object set. Retained size calculation is done for all objects
when the heap dump is processed. Retained sizes are shown for single instances in several
views.
• deep size
The deep size is calculated as the shallow size plus total size of all referenced objects. In extreme
cases, this value may be a significant percentage of the entire heap. Deep size calculation is
only available for the current object set.
The history controls of the heap walker in JProfiler's toolbar allow you to go backward and
forward in the history of your view changes. View changes where selection steps were performed,
as well as those performed through the view selector are recorded in the history.
Changing the current object set is done by clicking on the [Use selected] buttons in the heap walker
views. You first select objects of interest and then use this button to create a new object set that
contains only these objects. In many cases you can double click on an item to create a new object
set with it.
The heap walker will be able to display allocation call stack information only for recorded objects. See
the memory section overview [p. 118] for further details.
- 138 -
selected time span. If the option is unchecked, all objects on the heap will be shown (excluding any
objects removed by the next option).
The overhead options are:
For strongly referenced objects, the heap walker will not display soft, weak and phantom references.
This mode is preferable for memory leak detection, and is especially helpful to obtain useful
information when showing the path to root [p. 160] for selected objects. Unchecking this option
reduce the time for processing the heap snapshot and allows you to analyze the heap "as-is".
<= 1.3 JVMs perform a full garbage collection before the heap snapshot is taken, so unreferenced
objects can never occur even if the option is unchecked. With >= 1.4+ JVMs, no garbage collection
is performed prior to the snapshot.
Note: With Java >= 1.5.0 (JVMTI), unreferenced objects are not shown by the heap walker. The
dynamic memory views like the all objects view [p. 119] and the recorded objects view [p. 121] can
therefore show higher instance counts.
• Calculate retained sizes
Calculating retained sizes adds memory overhead while the heap snapshot is processed and take
some time for large heap snapshots. If you experience memory problems when taking heap
snapshot or if you want the heap snapshot processing to take less time, you can deselect this
option. In that case, no retained sizes will be available. Also, the biggest objects view [p. 146] will
not be available.
Retained sizes can only be calculated if the "Remove unreferenced and weakly referenced objects"
is selected.
• Record primitive data
Note: This option is only visible when you profile with Java <= 1.4.2 (JVMPI) or with Java 1.6+
(JVMTI 1.1). With Java >= 1.5 (JVMTI 1.0), primitive data is not recorded.
If this option is checked, the heap walker will record primitive data and display string values in the
reference graph [p. 148] as well as strings and values of primitive fields in the data view [p. 161] .
Deselecting this option will save memory and is advisable if you experience memory problems
when taking heap snapshot. If primitive data is not recorded, it will be requested on demand in a
live session, depending on whether the object still exists. The data may not be the same as at the
time of the heap snapshot in that case. These on-demand requests only work for Java 1.5+, for
Java 1.4 and lower, the data view [p. 161] will display N/A for primitive values.
- 139 -
The description of the current object set shows
• what kind of objects are in the current object set. If there is more than one class or array type in
the current object set, a cumulative count will be given separately for class instances and arrays.
As it is often the case, if all objects are of a single class or array type, the class name or array type
will be displayed.
• how many selection steps have occurred so far. This gives an idea of the complexity of the
current selection.
• how much space the current object set uses on the heap. Note that this is the shallow size which
does not include the sizes of referenced arrays and class instances.
With the selection button you can add another selection step. A new object set that contains only the
currently selected objects will be created. Some views have other view specific controls in this area.
The main portion of the view displays the content which depends on the current view type.
The selection history shows all selection steps that have occurred so far. The selection history pane
is a vertical split pane and can be resized to the most convenient size. You can toggle the visibility
of the selection history window by
The view selector allows you to switch between the six different views without changing the current
object set. The views show
- 140 -
• the allocation spots [p. 144] of the current object set
• the biggest objects [p. 146] in the current object set
• the references [p. 148] of the current object set
• the class and instance data [p. 161] of the current object set
• a graph of allocation times [p. 165] of the current object set
- 141 -
B.6.13.4 Classes view
• classes
Every row in the table is a single class. This is the default aggregation level.
• packages
Every row in the table is a single package. Sub-packages are not included. In this aggregation
level, the table becomes a tree table. You can open each package by clicking on the tree node
on its left and see the contained classes directly beneath it.
• Java EE components
Every row in the table is a Java EE component [p. 76] . This aggregation level is like a filter for the
classes mode and enables you to quickly check the loaded Java EE components in your profiled
application.
There are three columns shown in the table, which can be sorted [p. 114] .
• Name
Depending on the aggregation level, this column shows different values:
• classes
shows the name of the class or the array type. When using Java version up to 1.4 or Java 1.5
with the old profiling interface JVMPI, the notation <class>[] stands for non-primitive arrays
of any class type. (e.g. the array might be of type String[] or Object[]). A further distinction
is not possible due to restrictions in the profiling interface.
• package
shows the name of the package.
• Java EE
shows the display name of the Java EE component. If the display name is different from the
actual class name, the class name is displayed in square brackets.
• Instance count
Shows how many instances are currently allocated on the heap. This instance count is displayed
graphically as well.
• Size
Shows the total size of all allocated instances. Note that this is the shallow size which does not
include the size of referenced arrays and instances but only the size of the corresponding pointers.
- 142 -
The size is in bytes and includes only the object data, it does not include internal JVM structures
for the class, nor does it include class data or local variables.
• select one or multiple rows from the table and click the [Use selected] button above the table.
• double click on a row in the table.
A new object set will be created that contains only the instances of the selected classes or packages.
After your selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for
the new object set.
- 143 -
B.6.13.5 Allocation view
The heap walker will be able to display allocation information only for recorded objects, unrecorded
objects are summed up in a top-level entry called unrecorded objects. See the memory section
overview [p. 118] for further details.
To add a selection step from this view you can
• select one or multiple allocation spots from the table and click the [Use selected] button above
the table.
• double click on a single allocation spot.
• all instances of classes and arrays allocated in the selected allocation spots and in allocation
spots below for the cumulated allocation tree view mode.
• only the instances of classes and arrays allocated in the selected allocation spots for the
allocation tree view mode.
After your selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for
the new object set.
Note: If you wish to see the allocations performed in a node regardless on what call sequence has
lead to this node, you can switch to the allocation hot spots view mode [p. 144] .
- 144 -
The contents and functionality of the allocation hot spots list are similar to those of the allocation hot
spots view [p. 129] in the memory view section [p. 118] . Contrary to that view, only allocations in the
current object set are shown. Also, back traces are not available. You can customize this view through
the heap walker view settings [p. 168] .
The heap walker will be able to display allocation information only for recorded objects, unrecorded
objects are summed up in a top-level entry called unrecorded objects. See the memory section
overview [p. 118] for further details.
To add a selection step from this view you can
• select one or multiple allocation hot spots from the table and click the [Use selected] button above
the table.
• double click on a single allocation hot spot.
A new object set will be created that contains all instances of classes and arrays allocated in the
selected methods. After your selection, the view helper dialog [p. 168] will assist you in choosing the
appropriate view for the new object set.
- 145 -
B.6.13.6 Biggest objects view
• The first column shows the name of the object's class and the ID of the object
• The second column shows the object's retained size together with a bar visualizing the relative
importance of that number with the respect to all the objects that are shown. Also, a percentage
number is shown that indicates how much of the total used heap size is retained by this object.
Please see the key concepts of the heap walker [p. 137] for an explanation of retained size.
Each object can be expanded to show outgoing references to other objects that are retained by this
object. In this way, you can recursively expand the tree of retained objects (also called a "dominator
tree") that would be garbage collected if the one of the parents were to be removed. The information
displayed for each object in this tree is similar to the outgoing reference view [p. 155] , except that only
dominating references are displayed.
Not all dominated objects are directly referenced by their dominators. For example, consider the
references in the following figure:
Object A dominates objects B1 and B2, it does not have a direct reference to object C. Both B1 and
B2 reference C. Neither B1 nor B2 dominates C, but A does. In this case, B1, B2 and C are listed as
direct children of A in the dominator tree, and C will not be listed a child of B1 and B2. For B1 and
B2, the field names in A by which they are held are displayed. For C, [transitive reference] is displayed
on the reference node.
At the left side of each reference node in this tree, a percentage bar shows how many percent of the
retained size of the top-level object heap are still retained by the target object. The numbers will
decrease as you drill down further into the tree. In the view settings [p. 168] , you can change the
percentage base to the total heap size.
The dominator tree has a built-in cutoff that eliminates all objects that have a retained size that is
lower than 0.5% of the retained size of the parent object. This is to avoid excessively long lists of
small dominated objects that distract from the important objects. If such a cutoff has been performed,
a cutoff child node will be shown that notifies you about the number of objects that are not shown
on this level, their total retained size and the maximum retained size of the single objects.
The view mode selector above the biggest objects view allows you to switch to an alternate
visualization: A tree map that shows all dominated objects as a set of nested rectangles. Please see
the Wikipedia page on tree maps for more information on tree maps in general.
Each rectangle represents a dominated object. The area of the rectangle is proportional to its retained
size. In contrast to the tree, the tree map gives you a flattened perspective of all leafs in the
- 146 -
dominator tree. If you're mostly interested in big arrays, you can use the tree map in order to find
them quickly without having to dig into the branches of the tree. Also, the tree map gives you an
overall impression of the relative importance of dominated objects and the object size distribution in
the heap.
At the bottom right of the tree map you can see the total percentage of the entire heap that is
represented by the tree map. If you have not zoomed in, the remaining part of the heap is dominated
by objects that have not made it into the list of biggest objects due to the internal threshold for retained
sizes.
The actual information for tree map nodes is displayed in tool tips that are immediately shown when
you hover over the tree map. It corresponds to the information that is shown in the tree view mode.
If a tree map rectangle exceeds a certain size, its name is printed directly in the tree map.
The tree map is shown up to a maximum nesting depth of 25 levels. The depth of the call stack of a
particular leaf in the tree map is encoded in its color. The color scale blends blue into yellow, where
blue indicates a smaller and yellow a larger depth. The scale is always relative to all currently displayed
nodes. For example, if you zoom into a particular area of the tree map, the scale will be re-adjusted
so that that the depth of the parent node corresponds to blue. Below the tree map, a legend presents
all possible colors as well as the displayed maximum and minimum depths.
Double-clicking on any colored rectangle in the tree map will zoom to the parent node unless the
node is already a top-level node. There are tool bar actions for for zooming in and zooming out,
as well as as context actions for showing the actual root of the dominator tree of the biggest objects.
In order to explore the hierarchical environment of a particular leaf in the tree map, there is a context
action "Show In Tree", that switches to the tree view mode and selects the same node there.
To add a selection step from this view you can select one or more objects and click the [Use selected]
button above the table.
A new object set will be created that contains only the instances of the selected objects. After your
selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for the new
object set.
• heap walker options dialog [p. 138] , if the heap dump is taken manually.
• the configuration of the "Trigger heap dump" [p. 84] action, if the heap dump is taken by a trigger.
• the parameters passed to the triggerHeapDump method of the Controller class in the profiling
API [p. ?] , if the heap dump is taken programatically.
- 147 -
B.6.13.7 Reference view
The reference view helps you to find memory leaks. Please note the "Show path to GC root"
functionality in the reference graph [p. 148] for this purpose.
This allows you to easily switch back and forth between these views while keeping the focus on the
same object.
The order of the instances in the object set can be adjusted to
• unsorted
The objects are in a random order. This is the default setting.
• sorted by shallow size
Objects with a larger shallow size are displayed first.
• sorted by retained size
- 148 -
Objects with a larger retained size are displayed first.
• sorted by allocation time (oldest first)
Objects with a greater age are displayed first. The "Record object allocation times" feature has to
be activated on the "Memory Profiling" tab [p. 77] of the profiling settings dialog [p. 73] , otherwise
this sort mode is not available and a warning message is displayed. This sorting only works for
recorded objects. Unrecorded objects are appended to the end of the sorted set.
• sorted by allocation time (newest first)
Like the above sort mode, only that objects with a smaller age are displayed first.
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
Sorting can take a few seconds, depending on the size of the heap. A progress dialog is shown while
the objects are sorted.
After changing the sort order, the displayed index is set to one.
• Instances are painted as rectangles with the class name of the instance written inside the rectangle.
• References are painted as arrows, the arrowhead points from the holder toward the holdee. If you
move the mouse over the reference, a tooltip window will be displayed that shows details for the
particular reference.
• The current instance has a violet background. In the current instance, the following additional
information is displayed:
• shallow size
• deep size
• retained size
• allocation time, if the "Record object allocation times" feature is activated on the "Memory
Profiling" tab [p. 77] of the profiling settings dialog [p. 73]
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size
types.
• Garbage collector roots have a red background.
A garbage collector root is an entity in the JVM that itself is not garbage collected and pins other
objects or classes. There are the following types of garbage collector roots:
- 149 -
• JNI references
Native code can request references from the JNI (local or global)
• stack
Local variables all current stack frames
• sticky class
The JVM itself can flag certain classes as non-garbage collectable
• thread block
Live threads are not garbage collected
• monitor used
A monitor that is held by someone cannot be garbage collected
• other GC root
The JVM can pin objects by attaching this unspecified GC root to them
For classes there is a special condition that prevents garbage collection: Since each instance has
an implicit reference to its class, any live instance prevents a class from being garbage collected.
This construct groups all such instances for reasons of conciseness. In this way you can also select
all instances of a specific class (rather than a specific class name).
A set of live instances that reference a yellow class object (see above) has a green background.
• Classes (objects of java.lang.Class) have a yellow background.
In most circumstances, classes are the last step on the path to the GC root that you are interested
in. Classes are not garbage collector roots, but in all situations where no custom classloaders are
used it is appropriate and easier to treat them as such. This is JProfiler's default mode when
searching for garbage collector roots, you can change this in the path to root options dialog [p. 160]
.
Class objects have references to
• there is no class loaded by that classloader that has any live instances
• the classloader is unreferenced except by its classes (this is a JVM level reference and not
visible in the source of java.lang.Class).
• None of the java.lang.Class objects is referenced except by the classloader and other
classes of that classloader.
By default, the reference graph only shows the direct incoming and outgoing references of the current
instance. You can expand the graph by double clicking on any object. This will expand either the
direct incoming or the outgoing references for that object, depending on the direction you're moving
in. Selective actions for expanding the graph are available in the view-specific toolbar and the context
menu:
- 150 -
• Show outgoing references
• Show incoming references
If applicable, an instance has plus and minus signs at the left and the right side to show or hide
incoming and outgoing references. The controls at the left side are for incoming, the controls at the
right side for outgoing references. The plus signs have the same effect as the Show outgoing
references and the Show incoming references actions. A minus sign hides all outgoing references
and all objects that are not connected to the central instance. This can have the effect that the object
on which you click the minus sign is hidden as well.
Additionally, the plus and minus signs give you the following indications:
• plus sign
There might be references to display. You have not yet tried to expand them.
• minus sign
You have expanded all references, there are no more references to expand.
• no sign
You have tried to expand references, but there were none.
To reset the graph to its original state, you can choose Reset graph from the context menu.
The reference graph offers a number of navigation and zoom options [p. 114] .
To check why an instance is not garbage collected, you can select it and use the Show paths to
GC root button in the view-specific toolbar or the corresponding entry in the context menu.
A dialog [p. 160] will ask you whether to search for a single garbage collector root or for all roots. After
that, the paths to root are searched. A progress dialog is shown while the paths to root are calculated.
• If the object is not referenced by a garbage collector root, a message box will be displayed. Note
that this case is only possible if the "Remove unreferenced and weakly referenced objects" option
in the heap walker option dialog [p. 138] is unchecked.
• Otherwise the graph is then expanded up to the garbage collector roots that were found.
The garbage collector roots themselves are displayed with a red background.
Each object is optionally annotate with an object ID. With this ID, you can check whether two objects
are the same or not. The display of IDs can be switched of the the context menu, the View menu and
the view settings of the heap walker [p. 168] .
There are four layout strategies for showing the reference graph which can be chosen by clicking on
in the toolbar or choosing the layout strategy from the context menu.
• Hierarchic layout
Standard layout that tries to layout the graph from left to right. This is suitable for most purposes.
• Hierarchic layout (Top to Bottom)
Like above, only that the layout axis is vertical. This can be suitable for viewing long chains of
references.
• Organic layout
Layout that tries to layout instances for optimal proximity. This layout is suitable for complex
situations and can visualize clusters.
- 151 -
• Orthogonal layout
Layout that tries to layout instances on a rectangular grid. This layout is suitable if your objects
form a matrix.
To add a selection step from this view you can select one or multiple objects and click the [Use ...]
button above the graph and choose in the popup menu. There is a corresponding entry in the context
menu. Multiple objects are selected by keeping the SHIFT key pressed during selection. The following
selection modes are available:
• Selected Objects
A new object set will be created that contains only the selected instances.
• Exclusively Referenced Objects
A new object set will be created that contains all objects that would be garbage collected if the
selected objects did not exist.
• Items in Selected Collection
This option is only enabled if you select an array of objects or a standard collection from the
java.util package. A new object set will be created that contains the objects in the array or
collection. If you select a map collection, you are prompted whether you want to include the key
objects as well.
After your selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for
the new object set.
This allows you to easily switch back and forth between these views while keeping the focus on the
same object.
The order of the instances in the object set can be adjusted to
• unsorted
The objects are in a random order. This is the default setting.
• sorted by shallow size
Objects with a larger shallow size are displayed first.
• sorted by retained size
Objects with a larger retained size are displayed first.
- 152 -
• sorted by allocation time (oldest first)
Objects with a greater age are displayed first. The "Record object allocation times" feature has to
be activated on the "Memory Profiling" tab [p. 77] of the profiling settings dialog [p. 73] , otherwise
this sort mode is not available and a warning message is displayed. This sorting only works for
recorded objects. Unrecorded objects are appended to the end of the sorted set.
• sorted by allocation time (newest first)
Like the above sort mode, only that objects with a smaller age are displayed first.
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
Sorting can take a few seconds, depending on the size of the heap. A progress dialog is shown while
the objects are sorted.
After changing the sort order, the displayed index is set to one.
Above the main view, the the following additional information is displayed:
• shallow size
• retained size
• allocation time, if the "Record object allocation times" feature is activated on the "Memory Profiling"
tab [p. 77] of the profiling settings dialog [p. 73]
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
Each reference node has one or two icons. The first icon is one of
• a regular reference.
• a reference expanded by the search to garbage collector root (see below).
• a reference from an object that is already present as an ancestor node. This indicates a reference
cycle. Cycles are more convenienrly analyzed in the reference graph [p. 148]
• there is no class loaded by that classloader that has any live instances
- 153 -
• the classloader is unreferenced except by its classes (this is a JVM level reference and not
visible in the source of java.lang.Class).
• None of the java.lang.Class objects is referenced except by the classloader and other
classes of that classloader.
• JNI references
Native code can request references from the JNI (local or global)
• stack
Local variables all current stack frames
• sticky class
The JVM itself can flag certain classes as non-garbage collectable
• thread block
Live threads are not garbage collected
• monitor used
A monitor that is held by someone cannot be garbage collected
• other GC root
The JVM can pin objects by attaching this unspecified GC root to them
For classes there is a special condition that prevents garbage collection: Since each instance has
an implicit reference to its class, any live instance prevents a class from being garbage collected.
This construct groups all such instances for reasons of conciseness. In this way you can also select
all instances of a specific class (rather than a specific class name).
To check why an instance is not garbage collected, you can select it and use the Show paths to
GC root button in the view-specific toolbar or the corresponding entry in the context menu.
A dialog [p. 160] will ask you whether to search for a single garbage collector root or for all roots. After
that, the paths to root are searched. A progress dialog is shown while the paths to root are calculated.
• If the object is not referenced by a garbage collector root, a message box will be displayed. Note
that this case is only possible if the "Remove unreferenced and weakly referenced objects" option
in the heap walker option dialog [p. 138] is unchecked.
• Otherwise the tree is then expanded up to the garbage collector roots that were found.
Newly expanded nodes on the path to the GC root have a red reference icon. To highlight the
found path without any distractions, no sibling references are shown on that level. To show all sibling
references, you can either choose the Show all incoming references action from the context menu
or View menu or collapse and expand the parent node.
Each object is optionally annotate with an object ID. With this ID, you can check whether two objects
are the same or not. The display of IDs can be switched of the the context menu, the View menu and
the view settings of the heap walker [p. 168] .
To add a selection step from this view you can select one or multiple objects and click the [Use ...]
button above the graph and choose in the popup menu. There is a corresponding entry in the context
- 154 -
menu. Multiple objects are selected by keeping the SHIFT key pressed during selection. The following
selection modes are available:
• Selected Objects
A new object set will be created that contains only the selected instances.
• Exclusively Referenced Objects
A new object set will be created that contains all objects that would be garbage collected if the
selected objects did not exist.
• Items in Selected Collection
This option is only enabled if you select an array of objects or a standard collection from the
java.util package. A new object set will be created that contains the objects in the array or
collection. If you select a map collection, you are prompted whether you want to include the key
objects as well.
After your selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for
the new object set.
This allows you to easily switch back and forth between these views while keeping the focus on the
same object.
The order of the instances in the object set can be adjusted to
• unsorted
The objects are in a random order. This is the default setting.
• sorted by shallow size
Objects with a larger shallow size are displayed first.
• sorted by retained size
Objects with a larger retained size are displayed first.
• sorted by allocation time (oldest first)
Objects with a greater age are displayed first. The "Record object allocation times" feature has to
be activated on the "Memory Profiling" tab [p. 77] of the profiling settings dialog [p. 73] , otherwise
this sort mode is not available and a warning message is displayed. This sorting only works for
recorded objects. Unrecorded objects are appended to the end of the sorted set.
• sorted by allocation time (newest first)
- 155 -
Like the above sort mode, only that objects with a smaller age are displayed first.
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
Sorting can take a few seconds, depending on the size of the heap. A progress dialog is shown while
the objects are sorted.
After changing the sort order, the displayed index is set to one.
Above the main view, the the following additional information is displayed:
• shallow size
• retained size
• allocation time, if the "Record object allocation times" feature is activated on the "Memory Profiling"
tab [p. 77] of the profiling settings dialog [p. 73]
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
Each reference node consists of three parts:
• Field name
The field name of the object in the parent node that holds the referenced object
• Reference icon
The reference icon separates the holder from the referenced object. The icon is one of
• A regular reference.
• A reference from an object that is already present as an ancestor node. This indicates a
reference cycle. Cycles are more conveniently analyzed in the reference graph [p. 148]
• Referenced object
This is the object referenced by the outgoing reference. Direct child references below this node
refer to this object.
Each object is optionally annotate with an object ID. With this ID, you can check whether two objects
are the same or not. The display of IDs can be switched of the the context menu, the View menu and
the view settings of the heap walker [p. 168] .
To add a selection step from this view you can select one or multiple objects and click the [Use ...]
button above the graph and choose in the popup menu. There is a corresponding entry in the context
menu. Multiple objects are selected by keeping the SHIFT key pressed during selection. The following
selection modes are available:
• Selected Objects
A new object set will be created that contains only the selected instances.
• Exclusively Referenced Objects
A new object set will be created that contains all objects that would be garbage collected if the
selected objects did not exist.
• Items in Selected Collection
This option is only enabled if you select an array of objects or a standard collection from the
java.util package. A new object set will be created that contains the objects in the array or
- 156 -
collection. If you select a map collection, you are prompted whether you want to include the key
objects as well.
After your selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for
the new object set.
There are three columns shown in the table, which can be sorted [p. 114] :
• Reference type
Shows the type of the incoming reference which is one of
• field
some of the objects or arrays in the current object set are held in the indicated field of an instance
of the indicated class.
• static field
some of the objects or arrays in the current object set are held in the indicated static field of the
indicated class.
• constant
some of the objects or arrays in the current object set are held in the constant pool of the indicated
class. These references mostly stem from constants declared as private static final.
• object array content
some of the objects in the current object set are held in an array of instances of classes. The
arrays are of types or supertypes of the held objects. A further distinction is not possible due to
the nature of Java bytecode.
• JNI global/local reference
some of the objects or arrays in the current object set are held through the Java Native Interface.
Generally global references are persistent across a number of native calls which local references
are only valid for the duration of one native call. These references are of interest to JNI
programmers only. If you do not use any extra native libraries and encounter these reference
types nonetheless, they can be attributed to the internal state of the JVM. In that case, there
won't be any accessible objects behind these references and the Size column will show a zero
value.
• java stack
some of the objects in the current object set are held in a stack frame of a thread.
- 157 -
• sticky class, thread block, unknown type
internal references in the JVM.
Note that for static fields, constants, java stack references and the internal references in the JVM
the origin of the reference do not belong to accessible objects. The Size column shows a zero
value and a filter selection is not possible for these incoming reference types.
• Object count
Depending on the display mode, shows
Note that this is the shallow size which does not include the size of referenced arrays and instances
but only the size of the corresponding pointers.
• select one or multiple references from the table and click the [Use ...] button above the table and
choose reference holders in the popup menu. A new object set will be created that contains all
objects that hold any object in the current object set by way of the selected reference types.
• select one or multiple references from the table and click the [Use ...] button above the table and
choose referenced objects in the popup menu. A new object set will be created that contains all
objects in the current set that are held by a reference of one of the the selected types.
• double click on a reference. Depending on the display mode, either the reference holders or the
referenced objects are selected as the new object set.
- 158 -
All reference types in your selection that do not lead to selectable objects are removed for the selection
step. If no selectable objects are contained in your selection, the corresponding action will be disabled.
A new object set will be created that contains all instances of classes and arrays that reference objects
in the current object set via the selected references. After your selection, the view helper dialog [p.
168] will assist you in choosing the appropriate view for the new object set.
• Reference type
Shows the type of the outgoing reference which is one of
• field
the referenced object or array is held in the indicated field of an instance of the indicated class.
• static field
the referenced object or array is held in the indicated static field of the indicated class.
• constant
the referenced object or array is held in the constant pool of the indicated class. These references
mostly stem from constants declared as private static final.
• object array content
the referenced object or array is held in an array of instances of classes (e.g. the array might
be of type String[] or Object[]).
• Object count
Shows how many references of this outgoing reference type are present in the current object set.
The reference count is displayed graphically as well.
• Size
Shows the total size of the object set which would result if this reference type was added as a filter
step. Note that this is the shallow size which does not include the size of referenced arrays and
instances but only the size of the corresponding pointers.
• select one or multiple references from the table and click the [Use selected] button above the
table.
• double click on a reference.
- 159 -
A new object set will be created that contains all instances of classes and arrays that are referenced
by objects in the current object set via the selected references. After your selection, the view helper
dialog [p. 168] will assist you in choosing the appropriate view for the new object set.
• a single root
Only a single garbage collector root will be found. When searching for a memory leak, this option
is often appropriate since any path to a garbage collector root will prevent the instance from being
garbage collected.
• up to a certain number of roots
A specified maximum number of roots will be found and displayed. If a single root is not sufficient,
try displaying one root more at a time until you get a useful result.
• all roots
All paths to garbage collector roots will be found and displayed. This analysis takes much longer
than the single root option and can us a lot of memory.
By default, the path to root search does not follow weak references. If you would like to show garbage
collector roots that are only reachable through a weak reference, you can check the Include weak
references option.
By default the path to root search uses classes as garbage collector roots. This is not strictly correct
but valid in most situations and makes the path to root search much more usable. For example, a
static field of a class is technically not a garbage collector root, but in practice any information about
why a class is not garbage collected is not interesting. The only case were you need a different
behavior is when searching for classloader-related memory leaks. In that case, you can deselect
"Use classes as roots" to use the true garbage collector roots exclusively.
After completing the dialog with the [OK] button, the analysis will be calculated and the result will be
shown in the reference view.
With the [Cancel] button, the path to root option dialog is closed and no analysis is performed.
- 160 -
B.6.13.8 Data view
This allows you to easily switch back and forth between these views while keeping the focus on the
same object.
The order of the instances in the object set can be adjusted to
• unsorted
The objects are in a random order. This is the default setting.
• sorted by shallow size
Objects with a larger shallow size are displayed first.
• sorted by retained size
Objects with a larger retained size are displayed first.
• sorted by allocation time (oldest first)
Objects with a greater age are displayed first. The "Record object allocation times" feature has to
be activated on the "Memory Profiling" tab [p. 77] of the profiling settings dialog [p. 73] , otherwise
this sort mode is not available and a warning message is displayed. This sorting only works for
recorded objects. Unrecorded objects are appended to the end of the sorted set.
• sorted by allocation time (newest first)
Like the above sort mode, only that objects with a smaller age are displayed first.
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
Sorting can take a few seconds, depending on the size of the heap. A progress dialog is shown while
the objects are sorted.
After changing the sort order, the displayed index is set to one.
The data view of the heap walker offers two or more view modes that can be changed in the combo
box at the top of the view:
- 161 -
instance is an object of class java.lang.Class. In that case, the instance data view mode is
not available.
• Class data [p. 163]
Shows the class data of the class or a particular super class of the current instance. There is one
such view mode for each class in the class hierarchy. When the current instance is an object of
class java.lang.Class, there are no super classes displayed.
Above the main view, the the following additional information is displayed:
• shallow size
• retained size
• allocation time, if the "Record object allocation times" feature is activated on the "Memory Profiling"
tab [p. 77] of the profiling settings dialog [p. 73]
Please see the key concepts of the heap walker [p. 137] for an explanation of the different size types.
To be able to select multiple objects from the current object set and create a new object set from
them, you can flag each instance with the checkbox at the top right corner of the data view. The
menu button to the right of the checkbox allows you to
The [Use ...] button above the table shows a popup where you can select all flagged as well as all
unflagged instances (see below).
To add a selection step from this view you can
• select an entry from the table that is either a java.lang.String object or if it has a [reference]
value and click the [Use ...] button above the table and choose this instance from the popup menu.
Alternatively, you can double click on the entry. An object set will be created that contains only the
selected object.
• activate the instance data view mode (see above) and click the [Use ...] button above the table
and choose this instance from the popup menu. An object set will be created that contains only
the currently displayed instance.
• activate the class data view mode (see above) and click the [Use ...] button above the table and
choose this class from the popup menu. An object set will be created that contains only the
java.lang.Class object of the currently displayed class. In this way you can go from any instance
to its class or one of its super classes. This is useful if you have multiple classes with the same
name from different classloaders and cannot use the class selection in the classes view [p. 142] of
the heap walker that groups classes with the same name. If you subsequently want to select all
instances of that class, you can go to the references graph [p. 148] , show the incoming references
and make a selection step with the green node named "live instances".
• click the [Use ...] button above the table and choose flagged instance or unflagged instance from
the popup menu. An object set will be created that contains only the flagged or unflagged instances.
After your selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for
the new object set.
- 162 -
B.6.13.8.2 Heap Walker Data View - Instance Data
The instance data table is one of the view modes in the data view [p. 161] of the heap walker [p. 137]
.
The main table in the instance data table lists all fields of the current instance or all array elements
of the current array. There are three columns shown in the table, which can be sorted [p. 114] .
• Number
Shows the number of the field in the class file.
• Field name
Shows type and name for the field if a class instance is displayed or array element if an array
is displayed.
• Value
Shows the value of the field as
• the explicit contents of the field for primitive field types and instances of java.lang.String.
This data is available depending on the profiling interface:
There are three columns shown in the table, which can be sorted [p. 114] . Note that sorting by number
always keeps static fields and constant pool references together.
- 163 -
• Number
Shows the number of the entry in its category.
• Field name
Shows type and name for the static fields or the corresponding category name.
• Value
Shows the value of the field as
• the explicit contents of the field for primitive field types and instances of java.lang.String.
This data is available depending on the profiling interface:
- 164 -
B.6.13.9 Time view
• fixed scale
If you are currently in the "scale to fit window" mode, you can switch to this mode by
• choosing the scale mode selector button at the top of the graph.
• choosing Scale to fit window from the context menu.
• checking Scale to fit window in the view settings dialog [p. 168] .
In this mode, the time axis can be scrolled with the scrollbar on the bottom which appears if the
total extent of the axis does not fit into the current view size.
You can adjust the scale of the time axis byzooming in or out. Zooming in increases the level
of detail while zooming out decreases it. You change the zoom level by
• choosing the scale mode selector button in the lower right corner of the view.
• choosing Continue at fixed scale from the context menu.
• unchecking Scale to fit window in the view settings dialog [p. 168] .
The time scale on the time axis is adjusted in order to show the total extent of the axis in the current
size of the view. Zooming is not possible in this mode.
Grid lines and background of the time view can be configured in the view settings dialog [p. 168] .
The time view has two different display modes. The display mode is a persistent view setting and is
thus also accessible through the heap walker view settings dialog [p. 168] .
- 165 -
• choosing the scale mode selector button at the top of the graph.
• choosing Scale to fit window from the context menu.
• checking Scale to fit window in the heap walker view settings dialog [p. 168] .
In this mode, the time axis can be scrolled with the scrollbar on the bottom which appears if the
total time span does not fit into the current view size.
You can adjust the scale of the time axis by zooming in or out. Zooming in increases the level
of detail while zooming out decreases it. You change the zoom level by
• choosing the scale mode selector button in the lower right corner of the view.
• choosing Continue at fixed scale from the context menu.
• unchecking Scale to fit window in the heap walker view settings dialog [p. 168] .
The time scale on the time axis is adjusted in order to show the total time span in the current size
of the view. Zooming is not possible in this mode.
Grid lines and background of the time view can be configured in the heap walker view settings dialog
[p. 168] .
• clicking and dragging with the mouse on the graph in the horizontal direction.
• choosing the select up to here action from the context menu.
• choosing the select from here action from the context menu.
• choosing the select between bookmarks action from the tool bar right above the view or the
context menu. A dialog will be shown that allows you to select a range of bookmarks. All objects
allocated between the first selected and the last selected bookmark are selected in the view.
You can clear your selections by clicking on the clear selections button at the top of the view or
by selecting the corresponding action from the context menu.
To add a selection step from this view you can select one or more time intervals and click the [Use
selected] button above the graph.
A new object set will be created that contains only the instances of the selected objects. After your
selection, the view helper dialog [p. 168] will assist you in choosing the appropriate view for the new
object set.
- 166 -
• selection of one or several allocation spots [p. 144]
• selection of one or several biggest objects [p. 146]
- 167 -
B.6.13.10 Heap Walker View Helper Dialog
The view helper dialog is displayed each time when a new object is created. New object sets are
created by choosing objects in the heapwalker views [p. 137] and clicking on the [Use selected]
buttons.
The view helper dialog is intended to assist you in choosing the view that is most interesting for the
new object set. You can switch to desired view by selecting the corresponding radio button and closing
the dialog with the [OK] button. On the right hand side of the dialog a short description of the selected
view is displayed.
The view helper dialog automatically suggest a view based on the contents of the new object set.
To discard the new object set you can leave the dialog with the [Cancel] button. You will then be
returned to the previous heap walker view.
You can suppress this dialog by clicking the Do not show this dialog again checkbox at the
bottom of the dialog. In this case the view change to the automatically suggested view will be performed
without confirmation.
To show the dialog again at a later time, you can adjust this setting in the heap walker view settings
[p. 168] .
The Classes tab applies to the classes view [p. 142] only. It is analogous to the recorded objects view
settings [p. 122] .
The Allocations tab applies to the allocation view [p. 144] only. It is analogous to the allocation call
tree settings [p. 127] .
Note: Unlike for the allocation call tree, there is no "cumulate allocations" option since the view mode
combo box in the allocations view of the heap walker offers both an "allocation tree" and a "cumulated
allocation tree".
The Biggest objects tab applies to the biggest objects view [p. 146] only.
• Size scale
You can select a size scale, just like in the recorded object view settings [p. 122] .
• Show object IDs
If checked, all objects are annotated with object IDs. This can help you to check if an object is the
same as one displayed in another view.
• Show retained size bar for dominator tree
If checked, a percentage bar will be shown in from of each outgoing reference node. The percentage
base can be configured as
- 168 -
• Top level object
The percentages refer to the retained size of the top level object. This is the default setting.
• Total heap
The percentages show how much of the total heap is retained by this reference. The lengths of
all percentage bars are always comparable with this option.
The References tab applies to the references view [p. 148] only.
• Size scale
You can select a size scale, just like in the recorded object view settings [p. 122] .
• Show object IDs
If checked, all objects are annotated with object IDs. This can help you in checking if two objects
in two different reference graphs are the same or not. There are two separate options for the
reference graph and the reference tree views since the object IDs are much more important for
the tree views where this option is enabled by default.
• Show declaring class if different from actual class
In the incoming and outgoing reference tree views, the declaring class of a field will be displayed
as well if it is different from the actual class or the object (i.e. the field has been declared in a
super-class). Since this can add a lot of potentially distracting information to the reference trees,
you can switch it off with this setting. In the reference graph, the declaring class is always displayed
in the tool tip on the reference arrows.
The Time tab applies to the time view [p. 165] only. It is analogous to the VM telemetry view settings
dialog [p. 209] .
- 169 -
B.6.14 CPU view section
• thread groups
• active threads
• dead threads
Next to the thread selector you find information about the thread state which is one of
• All states
No filtering is performed.
• Runnable
Only runnable thread states will be shown. This is the standard setting.
• Waiting
Only waiting thread states will be shown.
• Blocked
Only blocked thread states will be shown.
• Net I/O
Only blocking network operations of the java library will be shown.
When you switch between two thread states, JProfiler will make the best effort to preserve your
current selection.
Below the thread selector you find information about the aggregation level which is one of
• methods
• classes
• packages
• Java EE components
The call tree is always recorded on the method level. If you switch to a higher aggregation level, the
information contained in the method call tree is aggregated accordingly into a new tree from which
the current view is calculated. Java EE components can only be shown if component recording has
been enabled in on the Java subsystems tab [p. 76] of the profiling settings dialog [p. 73] .
In the dynamic views thread selection, thread state and aggregation level are displayed in combo
boxes. After changing the selection in the thread selector or the thread state selector, the dynamic
views are updated immediately with the new settings. The thread selector applies to all dynamic views
simultaneously. Initially it is set to All thread groups and may be switched to specific threads or
thread groups as soon as they come into existence.
Please turn to the thread view section [p. 192] for more detailed information on threads.
The update frequency can be set on the miscellaneous tab [p. 78] in the profiling settings dialog [p.
73] for all dynamic views of the CPU view section.
- 170 -
Unless "Record CPU data on startup" has been selected in the Startup section of the profiling
settings dialog [p. 73] , data acquisition has to be started manually by clicking on Record CPU data
in the tool bar or by selecting Profiler->Record CPU data from JProfiler's main menu. Bookmarks [p.
114] will be added when recording is started or stopped manually.
CPU data acquisition can be stopped by clicking on Stop recording CPU data in the tool bar or
by selecting Profiler->Stop recording CPU data from JProfiler's main menu.
The CPU recording state is shown in the status bar with a CPU icon which is shown in gray when
CPU is not recorded. Clicking on the CPU icon will toggle CPU recording.
Restarting data acquisition resets the CPU data in all dynamic views of the CPU view section.
Note that you can also use a trigger [p. 80] and the "Start recording" and "Stop recording" actions [p.
84] to control CPU recording in a fine-grained and exact way. This is also useful for offline profiling
[p. 225] .
- 171 -
B.6.14.2 Call tree view
servlets
JSPs
EJBs
• JSPs
the path of the JSP source file
• EJBs
the name of the EJB interface
If URL splitting [p. 76] is enabled, each request URL creates a new node with a special icon and
the prefix URL:, followed by the part of the request URL on which the call tree was split. Note that
URL nodes group request by the displayed URL.
You can disable both Java EE component detection as well as URL splitting on the Java Subsystems
[p. 76] tab of the profiling settings [p. 73] . Also, the URL splitting method can be customized in the
profiling settings or with a custom handler in the profiling API [p. ?] .
The call tree view has an aggregation level selector. It allows you to switch between
• methods
Every node in the tree is a method call. This is the default aggregation level. Special Java EE
component methods have their own icon (see above) and display name, the real class name is
appended in square brackets.
For methods that have been configured for exceptional method run recording, different icons will
be shown. Please see the help on exceptional method run recording [p. 71] for more information.
• classes
Every node in the tree is a single class. Java EE component classes have their own icon (see
above) and display name, the real class name is appended in square brackets.
• packages
Every node in the tree is a single package. Sub-packages are not included.
• Java EE components
Every node in the tree is a Java EE component [p. 76] . If the component has a separate
display name, the real class names are omitted.
When you switch between two aggregation levels, JProfiler will make the best effort to preserve your
current selection. When switching to a a more detailed aggregation level, there may not be a unique
mapping and the first hit in the call tree is chosen.
- 172 -
The call tree doesn't display all method calls in the JVM, it only displays
• unfiltered classes
Classes which are unfiltered according to your configured filter sets [p. 69] are used for the
construction of the call tree.
• first level calls into unfiltered classes
Every call into a filtered class that originates from an unfiltered class is used for the construction
of the call tree. Further calls into filtered classes are not resolved. This means that a filtered node
can include information from other filtered calls. Filtered nodes are painted with a red marker in
the top left corner.
• thread entry methods
The methods Runnable.run() and the main method are always displayed, regardless of the
filter settings.
A particular node is a bridge node if it would normally not be displayed in the view, but has descendant
nodes that have to be displayed. The icons of bridge nodes are grayed out. For the call tree view
this is the case if the inherent time of the current node is below the defined threshold [p. 175] , but there
are descendant nodes that are above the threshold.
When navigating through the call tree by opening method calls, JProfiler automatically expands
methods which are only called by one other method themselves.
To quickly expand larger portions of the call tree, select a method and choose View->Expand
Multiple Levels from the main window's menu or choose the corresponding menu item from the context
menu. A dialog is shown where you can adjust the number of levels (20 by default) and the threshold
in per mille of the parent node's value that determines which child nodes are expanded.
If you want to collapse an opened part of the call tree, select the topmost method that should remain
visible and choose View->Collapse all from the main window's menu or the context menu.
If a method node is selected, the context menu allows you to quickly add a method trigger [p. 80] for
the selected method with the add method trigger action. A dialog [p. 87] will be displayed where
you can choose whether to add the method interception to an existing method trigger or whether to
create a new method trigger.
You can use this view as a starting point for determining which methods are candidates for exceptional
method run recording [p. 71] . Once you have identified methods of interest, you can right-click them
in the table and choose Add as exceptional method from the context menu.
Nodes in the call tree can be hidden by selecting them and hitting the DEL key or by choosing Hide
Selected from the context menu. Percentages will be corrected accordingly as if the hidden node did
not exist. All similar nodes in other call stacks will be hidden as well.
When you hide a node, the toolbar and the context menu will get a Show Hidden action. Invoking
this action will bring up a dialog where you can select hidden elements to be shown again.
The tree map selector above the call tree view allows you to switch to an alternate visualization: A
tree map that shows all call stacks as a set of nested rectangles. Please see the Wikipedia page on
tree maps for more information on tree maps in general.
Each rectangle represents a particular call stack. The area of the rectangle is proportional to the
length of the percentage bar in the tree view. In contrast to the tree, the tree map gives you a flattened
perspective of all leafs in the tree. If you're mostly interested in the dominant leafs of the call trees,
you can use the tree map in order to find them quickly without having to dig into the branches of the
tree. Also, the tree map gives you an overall impression of the relative importance of leaf nodes.
- 173 -
By design, tree maps only display values of leaf nodes. Branch nodes are only expressed in the way
the leaf nodes are nested. For non-leaf nodes which have significant inherent values, JProfiler
constructs synthetic child nodes. In the diagram below, you can see that node A has an inherent
value of 20% so that its child nodes have a sum of 80%. To show the 20% inherent value of A in the
tree map, a synthetic child node A' with a total value of 20% is created. It is a leaf node and a sibling
node of B1 and B2. A' will be shown as a colored rectangle in the tree map while A is only used for
determining the geometric arrangement of its child nodes B1, B2 and A'.
The actual information for tree map nodes is displayed in tool tips that are immediately shown when
you hover over the tree map. It corresponds to the information that is shown in the tree view mode.
If a tree map rectangle exceeds a certain size, its name is printed directly in the tree map.
The tree map is shown up to a maximum nesting depth of 25 levels. The depth of the call stack of a
particular leaf in the tree map is encoded in its color. The color scale blends blue into yellow, where
blue indicates a smaller and yellow a larger depth. The scale is always relative to all currently displayed
nodes. For example, if you zoom into a particular area of the tree map, the scale will be re-adjusted
so that that the depth of the parent node corresponds to blue. Below the tree map, a legend presents
all possible colors as well as the displayed maximum and minimum depths.
Double-clicking on any colored rectangle in the tree map will zoom to the parent node unless the
node is already a top-level node. There are tool bar actions for for zooming in and zooming out,
as well as as context actions for showing the actual root of the call tree.
In order to explore the hierarchical environment of a particular leaf in the tree map, there is a context
action "Show In Tree", that switches to the tree view mode and selects the same node there.
If enabled in the view settings [p. 175] , every node in the call tree has a percentage bar whose length
is proportional to the total time spent in the current node including all descendant nodes and whose
light-red part indicates the percentage of the inherent time of the current node.
Every entry in the call tree has textual information attached which depends on the call tree view
settings [p. 175] and shows
• a percentage number which is calculated with respect to either the root of the tree or the calling
node.
• a total time measurement in ms or µs. This is the total time that includes calls into other nodes.
• an inherent time measurement in ms or µs. This is the inherent time that does not include calls
into unfiltered classes.
• an invocation count which shows how often the node has been invoked on this path.
• a name which depends on the aggregation level:
• methods
- 174 -
a method name that is either fully qualified or relative with respect to to the calling method.
• classes
a class name.
• packages
a package name.
• Java EE components
the display name of the Java EE component.
Note that the line number shows the line number of the invocation and not of the method itself.
You can set change the root of the call tree to any node by selecting that node and choosing
View->Set as root from the main window's menu or by choosing the corresponding menu item from
the context menu. Percentages will now be calculated with respect to the new root if the percentage
base has been set to "total thread time" in the view settings dialog [p. 175] . To return to the full view
of all nodes called in the current thread or thread group, select View->Show all from the main window's
menu or the context menu.
You can stop and restart CPU data acquisition [p. 170] to clear the call tree and freeze all views [p. 107]
to ensure that the call tree remains static.
- 175 -
• Show inherent time
Show the inherent time (excluding calls to unfiltered methods) that was spent in the node.
• Show invocation count
Show how many times the node was called in this particular call sequence.
• Always show fully qualified names
If this option is not checked (default), class name are omitted in intra-class method calls which
enhances the conciseness of the display.
Only applicable if the aggregation level has been set to "methods".
• Always show signature for method calls
Only applicable if the aggregation level has been set to "methods". If this option is not checked,
method signatures are shown only if two methods with the same name appear on the same level.
Only applicable if the aggregation level has been set to "methods".
• Show average time values in brackets
Show the total time divided by the number of invocations for each node in brackets. Is not displayed
if the invocation count is 0, e.g. if an invocation has not completed yet or if sampling is chosen as
the call tree collection method.
You can select a time scale mode for all displayed times:
• Automatic
Depending on the time value, it's displayed in seconds, millseconds or microseconds, in such a
way that 3 significant digits are retained.
• Seconds
• Millseconds
• Microseconds
The display threshold below which nodes are ignored is entered in percent. Calls whose inherent
time makes up less than that percentage are not shown in the call tree except for the case where
they are part of a call sequence which leads to a node with an inherent time above the given threshold.
Those nodes are indicated by a grayed out icon.
To activate the threshold, you have to select the "Hide calls with less than ..." check box.
This option allows you to trim down the call tree to the most important parts.
The percentage base determines against what time span percentages are calculated.
• Absolute
Percentage values show the contribution to the total time.
• Relative
Percentage values show the contribution to the calling node.
- 176 -
B.6.14.3 Hot spot view
1. method calls
Depending on your selection of the aggregation level, the method hot spots will change. They
and their hot spot backtraces will be aggregated into classes or packages or filtered for Java EE
component types.
Note: The notion of a method hot spot is relative. Method hot spots depend on the filter sets that
you have enabled in the filter settings [p. 69] . Filtered methods are opaque, in the sense that calls
into other filtered methods are attributed to their own time. If you change your filter sets you're
likely to get different method hot spots since you are changing your point of view. Please see the
help topic on hotspots and filters [p. 37] for a detailed discussion.
2. Java EE related calls
• JDBC calls
The displayed hot spots are JDBC calls. JDBC call recording has to be enabled in the profiling
settings [p. 76] .
• JMS calls
The displayed hot spots are JMS calls. JMS call recording has to be enabled in the profiling
settings [p. 76] .
• JNDI calls
The displayed hot spots are JNDI calls. JNDI call recording has to be enabled in the profiling
settings [p. 76] .
• URL invocations
The displayed hot spots are URL invocations. URL call tree splitting has to be enabled in the
profiling settings [p. 76] . URL splitting can be customized in the profiling settings or by registering
a custom handler with the profiling API [p. ?] . In the profiling settings you can also specify if all
URLs or only URLs which lead to the invocation of an unfiltered class (the default setting) should
be displayed.
- 177 -
Depending on your selection of the aggregation level, the hot spot backtraces can be aggregated
into classes or packages. The Java EE related hot spots themselves do not change for different
aggregation levels.
For the Java EE related hot spot types, please see the help on the Java subsystems tab [p. 76]
of the profiling settings [p. 73] for more information on how these calls are recorded.
• If a Java EE related hot spot type is selected, the recorded data for the call is displayed. For method
call hot spots types, a name which depends on the aggregation level:
• methods
a method name that is either fully qualified or relative with respect to to the calling method.
• classes
a class name.
• packages
a package name.
• Java EE components
the display name of the Java EE component.
• the inherent time, i.e. how much time has been spent in the hot spot together with a bar whose
length is proportional to this value. All calls into this method are summed up regardless of the
particular call sequence.
If the method belongs to an unfiltered class, this time does not include calls into other methods. If
the method belongs to a filtered class, this time includes calls into other filtered methods.
• the average time, i.e. the inherent time (see above) divided by the invocation count (see below).
• the invocation count of the hot spot. If "Sampling" is selected as the method call recording type
[p. 74] , the invocation count is not available.
The hot spot list can be sorted on all columns [p. 114] .
If you click on the handle on the left side of a hot spot, a tree of backtraces will be shown. Every
entry in the backtrace tree has textual information attached to it which depends on the hot spot view
settings [p. 181] .
• a percentage number which is calculated with respect either to the total time or the called method.
• a time measurement in ms or µs of how much time has been contributed to the parent hot spot
on this path. If enabled in the view settings, every node in the hot spot backtraces tree has a
percentage bar whose length is proportional to this number.
• an invocation count which shows how often the hot spot has been invoked on this path.
Note: This is not the number of invocations of this method.
• a name which depends on the aggregation level:
• methods
a method name that is either fully qualified or relative with respect to to the calling method.
• classes
a class name.
- 178 -
• packages
a package name.
• Java EE components
the display name of the Java EE component.
Note that the line number shows the line number of the invocation and not of the method itself.
JProfiler automatically detects Java EE components [p. 76] and displays the relevant nodes in the
hot spot backtraces tree with special icons that depend on the Java EE component type:
servlets
JSPs
EJBs
• JSPs
the path of the JSP source file
• EJBs
the name of the EJB interface
If URL splitting [p. 76] is enabled, each request URL creates a new node with a special icon and
the prefix URL:, followed by the part of the request URL on which the hot spot backtraces tree was
split. Note that URL nodes group request by the displayed URL.
You can disable both Java EE component detection as well as URL splitting on the Java Subsystems
[p. 76] tab of the profiling settings [p. 73] . Also, the URL splitting method can be customized in the
profiling settings or with a custom handler in the profiling API [p. ?] .
The hot spots view has an aggregation level selector. It allows you to switch between
• methods
Every node in the tree is a method call. This is the default aggregation level. Special Java EE
component methods have their own icon (see above) and display name, the real class name is
appended in square brackets.
• classes
Every node in the tree is a single class. Java EE component classes have their own icon (see
above) and display name, the real class name is appended in square brackets.
• packages
Every node in the tree is a single package. Sub-packages are not included.
- 179 -
• Java EE components
Every node in the tree is a Java EE component [p. 76] . If the component has a separate
display name, the real class names are omitted.
When you switch between two aggregation levels, JProfiler will make the best effort to preserve your
current selection. When switching to a a more detailed aggregation level, there may not be a unique
mapping and the first hit in the hot spot backtraces tree is chosen.
The hot spot backtraces tree doesn't display all method calls in the JVM, it only displays
• unfiltered classes
Classes which are unfiltered according to your configured filter sets [p. 69] are used for the
construction of the hot spot backtraces tree.
• first level calls into unfiltered classes
Every call into a filtered class that originates from an unfiltered class is used for the construction
of the hot spot backtraces tree. Further calls into filtered classes are not resolved. This means that
a filtered node can include information from other filtered calls. Filtered nodes are painted with a
red marker in the top left corner.
• thread entry methods
The methods Runnable.run() and the main method are always displayed, regardless of the
filter settings.
When navigating through the hot spot backtraces tree by opening method calls, JProfiler automatically
expands methods which are only called by one other method themselves.
To quickly expand larger portions of the hot spot backtraces tree, select a method and choose
View->Expand Multiple Levels from the main window's menu or choose the corresponding menu item
from the context menu. A dialog is shown where you can adjust the number of levels (20 by default)
and the threshold in per mille of the parent node's value that determines which child nodes are
expanded.
If you want to collapse an opened part of the hot spot backtraces tree, select the topmost method
that should remain visible and choose View->Collapse all from the main window's menu or the
context menu.
If a method node is selected, the context menu allows you to quickly add a method trigger [p. 80] for
the selected method with the add method trigger action. A dialog [p. 87] will be displayed where
you can choose whether to add the method interception to an existing method trigger or whether to
create a new method trigger.
Nodes in the hot spot backtraces tree can be hidden by selecting them and hitting the DEL key or
by choosing Hide Selected from the context menu. Percentages will be corrected accordingly as if
the hidden node did not exist.
When you hide a node, the toolbar and the context menu will get a Show Hidden action. Invoking
this action will bring up a dialog where you can select hidden elements to be shown again.
You can stop and restart CPU data acquisition [p. 170] to clear the hot spots view and freeze all views
[p. 107] to ensure that the hot spots view remains static.
- 180 -
B.6.14.3.2 Hot Spots View Settings Dialog
The hot spots view settings dialog is accessed by bringing the hot spots [p. 177] to front and choosing
View->View settings from JProfiler's main menu or clicking on the corresponding toolbar button.
The context menu also gives access to the view settings dialog.
The node description options control the amount of information that is presented in the description
of the node.
You can select a time scale mode for all displayed times:
• Automatic
Depending on the time value, it's displayed in seconds, millseconds or microseconds, in such a
way that 3 significant digits are retained.
• Seconds
• Millseconds
• Microseconds
The percentage calculation determines against what time span percentages are calculated.
• Absolute
Percentage values show the contribution to the total recorded time.
• Relative
Percentage values shows the contribution to the invoked method.
- 181 -
B.6.14.4 Call graph
To calculate a call graph, click Generate graph in the tool bar or select View->Generate graph
from JProfiler's main menu. If a graph has been calculated, the context menu also provides access
to this action.
Before a graph is calculated, the call graph wizard [p. 183] is brought up. The resulting graph is static
and can be re-calculated be executing Generate graph again. The call graph wizard remembers
your last selection.
• The node name (method name, class name, package name or or Java EE component name).
For methods, no parameters are displayed. In order to see the parameters of a method, switch
on signature tooltips in the call graph view settings [p. 184] or select the corresponding check
item in the context menu.
• The total time (including calls into unfiltered classes)
• The inherent time (excluding calls into unfiltered classes)
• The number of calls into this node
• The node rectangles have a background coloring which - depending on the call graph view settings
[p. 184] is taken from a gray to red scale for increasing
• inherent time
• or total time
- 182 -
• or the time spent in all nodes
• Calls are painted as arrows, the arrowhead points from the caller toward the callee. If you move
the mouse over the call arrow, a tooltip window will be displayed that shows details for the particular
call.
• Call arrows have a color which is taken from a black to red scale for an increasing percentage in
execution time. In this way you can spot the most important calls of a node without checking their
tooltips one by one.
By default, the call graph only shows the direct incoming and outgoing calls of the initially selected
nodes. You can expand the graph by double clicking on any node. This will expand the direct
incoming and outgoing calls for that node. Selective actions for expanding the graph are available in
the toolbar, the View menu and the context menu:
If applicable, an node has plus signs at the left and the right side to show or hide calling and called
nodes. The controls at the left side are for calling, the controls at the right side for called nodes. The
plus signs have the same effect as the Show calling nodes and the Show called nodes actions.
Additionally, the plus signs give you the indication that there might be nodes to display and that you
have not yet tried to expand them.
You can hide nodes by selecting them and pressing the delete key. You can select multiple nodes
and delete them together. Alternatively, you can select the remove nodes from graph action from
the graph toolbar or the context menu.
If you delete methods, the call graph may contain a number of unconnected branches. To clean up
the graph, select a method on the branch that should be retained and select the cleanup
unconnected methods action from the graph toolbar or the context menu. The "remove all but selected
nodes" action in the context method allows you to trim the graph to a few selected nodes.
The reference graph offers a number of navigation and zoom options [p. 114] .
1. Graph Options
Similar to the the dynamic views of the CPU view section [p. 170] , you can select a thread or thread
group and a thread state for which the call graph will be calculated.
The aggregation level selector allows you to calculate a call graph for
• methods
Every node in the graph is a method call. This is the default aggregation level.
• classes
Every node in the graph is a single class. Java EE component classes have their own display
name, the real class name is appended in square brackets.
- 183 -
• packages
Every node in the graph is a single package. Sub-packages are not included.
• Java EE components
Every node in the graph is a Java EE component [p. 76] . If the component has a separate display
name, the real class names are omitted.
• node name
• inherent time
• total time
• invocations
and can be sorted [p. 114] on all columns. Initially it is sorted by inherent time to show the most
interesting hot spots at the top of the table.
You can add further nodes later on with the node selection dialog [p. 184] .
After you click [Finish] in the last step, the call graph will be calculated, if you leave the wizard with
[Cancel], you are returned to the old call graph.
• Inherent time
• Total time
- 184 -
• Displayed nodes only. If this setting is checked, the coloring of nodes changes as new nodes
are expanded or added.
• All nodes. If this setting is checked, the coloring stays the same as new nodes are expanded
or added.
• display threshold
The display threshold below which nodes are ignored is entered in percent. Calls whose inherent
time makes up less than that percentage are not shown in the method graph. If you raise the
threshold, none of the currently displayed nodes are hidden. If you lower the threshold, nodes who
do not have plus signs for expanding incoming and outgoing calls may get them again.
To activate the threshold, you have to select the "Hide calls with less than ..." check box.
This option allows you to trim down the call graph to the most important parts.
- 185 -
B.6.14.5 Method statistics
• Method
The name of the method and its parameters.
• Total Time
The total time spent in the method.
• Invocations
The number of times a method was called.
• Average Time
The average time spent in a method. This is equal to the total time divided by the invocation count.
• Median Time
The median time is the time for which half of the method calls were shorter and half were longer.
• Minimum Time
The minimum time of a single method invocation.
• Maximum Time
The maximum time of a single method invocation.
• Standard Deviation
The standard deviation measures the breadth of the distribution of method call times. If all method
call times are nearly equal, the value will be close to zero, the more spread-out the call times are,
the higher the standard deviation will be.
• Outlier Coefficient
The outlier Coefficient is calculated as (maximum time - median time) / median time. It measures
how significant the maximum time deviates from the median time. Outliers with small times are not
considered. Methods with high outlier coefficients are suitable candidates for exceptional method
run measurements in the call tree view [p. 172] .
You can sort [p. 114] the table on all columns. Double-clicking on a table row will show the source code
of the selected method.
You can use this view as a starting point for determining which methods are candidates for exceptional
method run recording [p. 71] . Once you have identified methods with a high outlier coefficient, you
can right-click them in the table and choose Add as exceptional method from the context menu.
Below the method table, a graph with the distribution of invocation counts versus call times is shown.
The graph is always shown for the currently selected method in the method table.
- 186 -
By default, the graph shows invocation counts on a linear scale. However, in order to identify outliers
with a low relative frequency, it is useful to switch to a logarithmic axis. This can be done in the view
settings [p. 187] or in the context menu.
The graph can be exported to HTML or CSV by right-clicking into the graph area and selecting Export
from the context menu. The export action in the tool bar and in the context menu of the method table
export the method table without the currently shown graph.
The call distribution view has two different display modes. The display mode is a persistent view
setting and is thus also accessible through the view settings dialog [p. 187] .
• fixed scale
If you are currently in the "scale to fit window" mode, you can switch to this mode by
• choosing the scale mode selector button at the top of the graph.
• choosing Scale to fit window from the context menu.
• checking Scale to fit window in the view settings dialog [p. 187] .
In this mode, the call duration axis can be scrolled with the scrollbar on the bottom which appears
if the total extent of the axis does not fit into the current view size.
You can adjust the scale of the call duration axis byzooming in or out. Zooming in increases
the level of detail while zooming out decreases it. You change the zoom level by
• choosing the scale mode selector button in the lower right corner of the view.
• choosing Continue at fixed scale from the context menu.
• unchecking Scale to fit window in the view settings dialog [p. 187] .
The time scale on the call duration axis is adjusted in order to show the total extent of the axis in
the current size of the view. Zooming is not possible in this mode.
Grid lines and background of the call distribution view can be configured in the view settings dialog
[p. 187] .
- 187 -
Controls on what ticks grid lines will be shown along the time axis.
• Grid lines for vertical axis
Controls on what ticks grid lines will be shown along the vertical axis.
• Logarithmic Display of Invocation Counts
If this option is selected, the invocation counts are plotted on a logarithmic axis. This makes it
easier to find outliers with a low relative frequency.
- 188 -
B.6.14.6 Call tracer
To record call traces, click Record call traces in the tool bar or select View->Record call traces
from JProfiler's main menu. If you have previously recorded call traces, the old recorded data will be
lost. Bookmarks [p. 114] will be added when recording is started or stopped manually.
Please note that recording call traces can generate massive amounts of data in a very short time.
To avoid problems with excessive memory consumption, a cap is set on the maximum number of
collected call traces. That cap is configurable in the view settings [p. 190] . The amount of collected
traces heavily depends on your filter settings [p. 69] . Also see the help topic on method call filters [p.
17] for background information.
By default, calls into filtered classes are recorded, similarly to the default behavior of the hot spot
view [p. 177] . Calls into filtered classes can be excluded in the view settings [p. 190] .
Call tracing only works when the method call recording type [p. 74] is set to "dynamic instrumentation".
Sampling does not keep track of single method calls, so it is technically not possible to collect call
traces with sampling.
To facilitate navigation, all method calls are grouped in a tree on three levels:
• Threads
Every time the executing thread changes in the call sequence, a new thread node is created.
• Packages
Every time the Java package changes in the call sequence, a new package node is created.
• Classes
Every time the class changes in the call sequence, a new class node is created.
At the lowest level there are method entry and method exit nodes. If call traces into other
methods have been recorded from the current method or if another thread interrupts the current
method, the entry and exit nodes for the that method will not be adjacent. Initially, all nodes are
collapsed, so you see a sequence of thread nodes after the traces have been recorded.
You can navigate on the method level only by using the skip to next method trace (Alt-Down)
and skip to previous method trace (Alt-Up) actions.
Each node displays the following information:
• Name
For thread nodes, this is the thread name, for package nodes this is the package name and for
class nodes this is the fully qualified class name. By default, method nodes show the method name
and the method signature. In the view settings [p. 190] , you can decide to drop the signature or add
the fully qualified class name. The latter can be useful when using the quick search feature.
• Trace count
Thread, package and class nodes display the number of method call traces that are contained in
them.
• Trace time
The trace time on the right side is one of
- 189 -
• Relative to first trace
The displayed time is the difference between the current call trace and the first displayed call
trace. This is the default setting.
• Relative to previous node
The displayed time is the difference between the current call trace and the previous node. If the
previous node is the parent node, that difference will be zero.
• Relative to previous node of the same type
The displayed time is the difference between the current call trace and the previous node of the
same type. For example, if the current node is a class node, the previous node of the same type
is the previous class node in the tree.
The time display type can be configured in the view settings [p. 190] .
Below the table with the call traces, a stack trace list shows you the stack trace of the currently
selected method trace. You can double-click on the stack trace element to show the source code.
The context menu gives you access to source and bytecode navigation.
A huge number of traces can be collected in a very short time. To eliminate traces that are of no
interest, the call tracer allows you to quickly trim the displayed data. For example, traces in certain
threads might not be interesting or traces in certain packages or classes might not be relevant. Also,
recursive method invocations can occupy a lot of space and you might want to eliminate those single
methods only.
You can hide nodes by selecting them and pressing the delete key. All other instances of the selected
nodes and all associated child nodes will be hidden as well. You can select multiple nodes and delete
them together. Alternatively, you can select the hide selected nodes action from the toolbar or
the context menu.
To show hidden nodes again, you can click on the show hidden button or select View->Show
Hidden from the main menu to show the show hidden elements dialog [p. 190] .
The show hidden elements dialog is displayed when clicking on the show hidden button or selecting
View->Show Hidden from the main menu when the call tracer view [p. 189] is visible.
The dialog shows a list of all the elements that you have previously hidden with the hide button or
the DELETE key. Hidden elements can be threads, packages, classes and methods.
You can select multiple elements from the list and press [OK] to show these elements again in the
call tracer view. Note that some elements can be subsets of others, so unhiding an element might
not make it visible. For example, if you have hidden the class com.mycorp.MyClass and then the
package com.mycorp, unhiding the class com.mycorp.MyClass will not make it visible again, you
also have to unhide the package com.mycorp for that.
The list of hidden elements is persistent across multiple trace recordings on the same run. It is cleared
when the session is restarted.
- 190 -
• Maximum number of recorded call traces
To avoid excessive memory consumption, the profiling agent stops collecting call traces after this
threshold has been reached.
• Record calls into filtered classes
If selected, calls into filtered classes are traced as well. Please see help topic on method call filters
[p. 17] for background information.
The time display options control the displayed trace time. The time display can be one of
The above settings are explained on the help page for the call tracer view [p. 189] .
The method display options determine the presentation of method nodes. The following options
are available:
• Show signature
If selected, each method node shows the signature of the method.
• Show class names in method nodes
If selected, the fully qualified class name is prepended to each method node.
- 191 -
B.6.15 Threads view section
- 192 -
B.6.15.2 Thread history view
• green
Green color means that the thread is runnable and eligible for receiving CPU time by the
scheduler. This does not mean that the thread has in fact consumed CPU time, only that the thread
was ready to run and was not blocking or sleeping. How much CPU time a thread is allotted,
depends on various other factors such as general system load, the thread's priority and the
scheduling algorithm.
• orange
Orange color means that the thread is waiting. The thread is sleeping and will be woken up
either by a timer or by another thread.
• red
Red color means that the thread is blocking. The thread has is trying to enter a synchronized
code section or a synchronized method whose monitor is currently held by another thread.
• blue
Light blue color means that the thread is in Net I/O. The thread is waiting for a network
operation of the java library to complete. This thread state occurs if a thread is listening for
socket connections or if it is waiting to read or write data to a socket.
Note: If you are color-blind, you can edit bin/jprofiler.vmoptions and set
-Djprofiler.highContrastMode=true. The above colors will then have an optimal contrast.
At the top of the view, there is a thread filter selector. You can use it to filter the displayed threads by
• liveness status
From the combo box you can choose if you wish to display
• name
In the text box you can enter the full name of a thread or only a part of it. Only threads whose
names begin with this fragment are displayed. You can also use wildcards ("*" and "?") to select
groups of threads. Please note that if you use wildcards, you have to manually append a trailing
"*" if desired. You can display the union of multiple filters at the same time by separating multiple
filter expressions with commas, e.g. AWT-, MyThreadGroup-*-Daemon.
The selection is performed once you press the enter key. The combo box contains all entries
performed during the current session. The [Reset filters] button can be used to remove all filters.
- 193 -
When you move the mouse across the thread history view, the time at the position of the mouse
cursor will be shown in JProfiler's status bar. If you have recorded monitor events [p. 199] , a tool tip
with the stack trace and links into the locking history graph [p. 201] and the monitor history view [p. 205]
will be displayed. The link to the locking history graph points to the time that the event has started,
the linked entry in the monitor history view shows the entire event. If the event has not yet completed,
the link into the monitor history view is not available.
When you right-click a thread name on the left side of the view, a context menu will be displayed that
allows you to jump to the Call tree view [p. 172] or the Hot spots view [p. 177] and display the single
selected thread there.
The thread history view has two different display modes. The display mode is a persistent view setting
and is also accessible through the thread history view settings dialog [p. 195] .
• choosing the scale mode selector button in the lower right corner of the view.
• choosing View->Scale to fit window from JProfiler's main menu.
• choosing Scale to fit window from the context menu.
• checking Scale to fit window in the thread history view settings dialog [p. 195] .
In this mode, the time scale on the time axis does not change with time and the time axis can be
scrolled with the scrollbar on the bottom which appears if the total time span does not fit into the
current view size. If the current time is visible, the view is in auto-follow mode where the time axis
is scrolled automatically when new data arrives to always show the current time. If you are not in
auto-follow mode, because you scrolled back in time, just move the scrollbar to the right end of
the time scale to re-enable auto-following.
You can adjust the scale of the time axis by zooming in or out. Zooming in increases the level
of detail while zooming out decreases it. You change the zoom level by
• using the zoom controls in the lower right corner of the view.
• choosing View->Zoom in and View->Zoom out from JProfiler's main menu.
• choosing Zoom in and Zoom out from the context menu.
• choosing the scale mode selector button in the lower right corner of the view.
• choosing View->Continue at fixed scale from JProfiler's main menu.
• choosing Continue at fixed scale from the context menu.
• unchecking Scale to fit window in the thread history view settings dialog [p. 195] .
The time scale on the time axis is adjusted continuously in order to show the total time span in the
current size of the view. Zooming is not possible in this mode.
Grid lines and background of the thread history view can be configured in the thread history view
settings dialog [p. 195] .
- 194 -
B.6.15.2.2 Thread History View Settings Dialog
The thread history view settings dialog is accessed by bringing the thread history [p. 193] to front and
choosing View->View settings from JProfiler's main menu or clicking on the corresponding toolbar
button. The context menu also gives access to the view settings dialog.
• None
No bookmarks will be shown in the thread history view.
• In time scale
The vertical bookmark line will only be drawn in the time scale at the top of the view.
• In entire view
The vertical bookmark line will be drawn in the time scale and in the view itself.
- 195 -
B.6.15.3 Thread monitor view
• Name
Shows the name of the thread. If the thread has not been named explicitly, the name is provided
by the JVM. To make most use of this view, name your threads according to their function by
invoking the setName() method on all threads created by you.
• Group
Shows the name of the thread group associated with this thread.
• Start time
Shows the time when the thread has been started. This time is calculated relative to the start time
of the first thread in the JVM.
• End time
This column is only visible when show dead threads is enabled in the view settings dialog [p.
197] . It shows the time when the thread has died and is empty if the thread is still alive. This time
is calculated relative to the start time of the first thread in the JVM.
• CPU time
Shows the CPU time which has been consumed by the thread.
Note: The CPU time column is only visible if the CPU time type is set to Estimated CPU
times on the Miscellaneous [p. 78] tab of the profiling settings [p. 73] . In addition, the CPU time
is only measured when you record CPU data [p. 170] . Otherwise the CPU time column is always
empty.
This column may also be empty if your system and JVM do not support thread specific CPU time
reporting.
• Creating thread
Shows the name of the thread and its thread group that created this thread.
Note: The creating thread column is only visible if you profile with Java 1.5 and higher (JVMTI).
For Java 1.4 and lower (JVMPI), this column is not shown.
This column may also be empty if your system and JVM do not support thread specific CPU time
reporting.
• Status
Shows the status of the thread which corresponds to the status reported in the thread history view
[p. 193] .
If you profile with Java 1.5 and higher (JVMTI), the above table will be the top component of a split
pane. In the lower part of the split pane, the filtered stack trace of the thread creation of the currently
selected thread is displayed. Stack traces can only be displayed if CPU data was being recorded [p.
170] when the thread was created.
You can decide which threads are shown in the thread monitor view by checking the desired filters
in the thread monitor view settings dialog [p. 197] . If Show dead threads is not enabled, the End
time column will not be visible.
- 196 -
B.6.15.3.2 Thread Monitor View Settings Dialog
The thread monitor view settings dialog is accessed by bringing the thread monitor [p. 196] to front
and choosing View->View settings from JProfiler's main menu or clicking on the corresponding
toolbar button. The context menu also gives access to the view settings dialog.
These options determine the filter for the thread monitor view [p. 196] . See the thread history help page
[p. 193] for a detailed explanation of the different types of thread status.
- 197 -
B.6.15.4 Thread dumps view
A new thread dump is taken by clicking on the [Thread dump] tool bar button. This button is also
present for the thread history view [p. 193] and the thread monitor view [p. 196] . A bookmark [p. 114] will
be added to the time-resolved views.
The new thread dump will by added to the list of thread dumps and it will be selected automatically.
The two lists to the right show the threads that are contained in the currently selected thread dump
as well as the stack trace of the currently selected thread.
The list of threads is organized according to thread groups, similar to the thread selector in the CPU
views [p. 170] .
The stack traces in thread dumps are not filtered, i.e. the filter settings [p. 69] in the session settings
do not apply. The context menu gives access to source and byte code navigation. Double-clicking
on a stack trace element shows the selected method.
Thread dumps can be copied to the clipboard with the [Copy To Clipboard] button at the top of
the list of thread dumps. The entire selected thread dump is copied as plain text to the clipboard.
To copy a single thread only, choose the Copy Selected Thread To Clipboard menu item from the
context menu of the list of threads.
When exporting [p. 112] the thread dumps view to HTML, the file chooser offers a combo box for
exporting the selected thread dump only, or all thread dumps to the same file.
Thread dumps can also be taken with the trigger thread dump [p. 84] trigger action or via the API [p.
?] .
- 198 -
B.6.16 Monitor view section
For all views that are not only showing current events, you have to record monitor events in order
to see data. Recording is started by clicking Record monitor events in the tool bar. Bookmarks
[p. 114] will be added when recording is started or stopped manually.
Monitor event recording can be stopped by clicking on Stop recording monitor events in the tool
bar.
Restarting data acquisition resets the monitor data in all historical views of the monitor view section.
In most applications, a large number of short events is generated continuously and would be
unmanageable to navigate. Because of this, JProfiler applies minimum thresholds for recording and
waiting events below which events are discarded. The thresholds are displayed on the locking history
graph [p. 201] and the monitor history view [p. 205] together with a hyperlink to open the view settings
dialog where the thresholds can be changed. Changes are effective immediately.
Note that you can also use a trigger [p. 80] and the "Start recording" and "Stop recording" actions [p.
84] to control monitor event recording in a fine-grained and exact way. This is also useful for offline
profiling [p. 225] .
The update frequency can be set on the miscellaneous tab [p. 78] in the profiling settings dialog [p.
73] for all dynamic views of the monitor view section.
- 199 -
B.6.16.2 Locking graphs
• Threads which participate in a locking situation are painted as blue rectangles. The rectangle
includes information about
• Monitors which participate in the locking situation are painted as gray rectangles. The rectangle
includes information about
• The ownership of monitors which participate in a locking situation is painted as a solid black
arrow. The arrowhead points from the thread to the monitor. To see details about where the monitor
was entered, move the mouse over the arrow and see the information in the tool tip window.
• The blocking of threads which participate in a locking situation is painted as a dashed red arrow.
The arrowhead points from the blocked thread to the monitor that the thread wants to enter. To
see details about where the thread is blocking, move the mouse over the arrow and see the
information in the tool tip window.
• The waiting of threads which participate in a locking situation is painted as a solid yellow arrow
with a hollow arrowhead. The arrowhead points from the waiting thread to the monitor that the
thread is waiting on. To see details about where the thread is waiting, move the mouse over the
arrow and see the information in the tool tip window.
• Threads or monitors that are part of a deadlock are painted in red.
The tool tip window shows a stack trace in a scrollable list whose context menu allows you to navigate
to the source code or show the selected method in the byte code viewer. You can pin the tool tip
window by toggling the pin button in the top right corner of the tool tip window.
Locks are analyzed for
• the primitive synchronization mechanism that's built into the Java platform, i.e. when using the
synchronized keyword.
- 200 -
• the locking facility in the java.util.concurrent package which does not use monitors of objects but
a different natively implemented mechanism.
You can show any monitor in the heap walker [p. 137] by selecting the monitor node and choosing
Show Selection In Heap Walker from the context menu. If a heap dump was already taken, you can
choose to select the object in the current heap dump, otherwise a new heap dump will be taken.
Note that the selected monitor might not exist in the heap dump because the heap dump might have
been taken before the monitor was allocated or after the monitor was garbage collected.
If you profile with Java <=1.4 (JVMPI), the monitor class names can only be displayed if they are
recorded objects. You can enable "Record allocations on startup" in the session startup dialog [p. 88]
to record all objects.
• All events
All monitor events that have been recorded. Next to the navigation buttons you see the current
position and the total event count as well as the time of the currently shown event. If a time spam
has been cumulated (see below), that time span as well as the number of events before and after
the currently selected time span are shown.
• Events of interest
Monitor events that involve a thread or monitor that you have marked as being of interest to you.
You can mark nodes as being of interest by selecting them and choosing Mark Node Of Interest
from the context menu. Multiple nodes can be selecting by holding down the Shift key. Marked
nodes are painted in a different color.
Next to the navigation buttons you see the current position and the total event count involving
nodes of interest or the number of events if an event of interest is currently shown. If the current
event is not an event of interest, you see the number of events of interest before and after the
current event.
Events of interest do not necessarily have to contain a node of interest. For example, if a thread
that has been marked as a node of interest releases a lock, the associated event does not contain
that thread node anymore, but the event is still an event of interest.
To change your selection of nodes of interest, simply select new nodes of interest or choose
Remove mark from the context menu.
The tool tips that appear when you hover of the arrows in the graph contain several navigation options:
• Origin time
For blocking and waiting relationships, the tool tip contains a hyperlink to the event where the arrow
first appeared.
- 201 -
• Monitor history
To analyze the duration of an event, it can be useful to show it in the monitor history view [p. 205] .
At the bottom of the tool tip, a corresponding hyperlink is available.
At the bottom of the view, you see a timeline, where all recorded events are shown as blue lines. The
currently shown event is surrounded with a green marker while events of interest are shown in red.
When you hover with the mouse over event lines, you can see the number of associated events in
the status bar. When you click on an event line, the first event associated with that event line is shown
in the graph. When a new event is selected with the navigation buttons or a hyperlink in the tool tip
window, the timeline is scrolled so that the selected event is visible.
You can cumulate multiple events by clicking an dragging the mouse in the time line. The selected
area will be shown with a green background and all events in the selected time span will be shown
together in the graph. If you have marked nodes of interest, only the events of interest in the
selection will be cumulated.
In a cumulated graph, each arrow can contain multiple events of the same type. In that case, the tool
tip window shows the number of events as well as the total time of all contained events. A drop-down
list in the tool tip window lets you switch between the stack traces of the different events and the
navigation hyperlinks in the tool tip window refer to the currently selected event.
The locking history time line has two different display modes. The display mode is a persistent view
setting and is thus also accessible through the view settings dialog [p. 203] .
• fixed scale
If you are currently in the "scale to fit window" mode, you can switch to this mode by
• choosing the scale mode selector button at the top of the graph.
• choosing Scale to fit window from the context menu.
• checking Scale to fit window in the view settings dialog [p. 203] .
In this mode, the time axis can be scrolled with the scrollbar on the bottom which appears if the
total extent of the axis does not fit into the current view size.
You can adjust the scale of the time axis byzooming in or out. Zooming in increases the level
of detail while zooming out decreases it. You change the zoom level by
• choosing the scale mode selector button in the lower right corner of the view.
• choosing Continue at fixed scale from the context menu.
• unchecking Scale to fit window in the view settings dialog [p. 203] .
The time scale on the time axis is adjusted in order to show the total extent of the axis in the current
size of the view. Zooming is not possible in this mode.
- 202 -
Grid lines and background of the locking history time line can be configured in the view settings dialog
[p. 203] .
• None
No bookmarks will be shown in the VM telemetry view.
• In time scale
The vertical bookmark line will only be drawn in the time scale at the top of the view.
• In entire view
The vertical bookmark line will be drawn in the time scale and in the view itself.
- 203 -
B.6.16.3 Monitor views
The monitor views show the following 6 columns: sortable [p. 114] .
• Time
The start time of the event.
• Duration
The duration of the event. The event may still be in progress.
• Type
The type of the event, one of "waiting" or "blocked".
• Monitor ID
The ID of the monitor for identifying multiple events on a particular monitor instance.
• Monitor class
The class of the monitor. If no Java object is associated with this monitor [raw monitor] is
displayed.
• Waiting thread
The thread that is or was waiting during the event.
• Owning thread
The thread holding the monitor which is blocking the waiting thread is displayed. The owning thread
is only relevant for the "blocked" event type. This column is not available if you profile with Java
<=1.4 (JVMPI).
In the lower part of the split pane, the stack traces of the waiting thread and - if applicable - of the
owning thread are displayed. Stack traces can only be displayed if CPU data is being recorded [p.
170] .
You can show any monitor in the heap walker [p. 137] by selecting the table row and choosing Show
Selection In Heap Walker from the context menu. If a heap dump was already taken, you can choose
to select the object in the current heap dump, otherwise a new heap dump will be taken.
Note that the selected monitor might not exist in the heap dump because the heap dump might have
been taken before the monitor was allocated or after the monitor was garbage collected.
If you profile with Java <=1.4 (JVMPI), the monitor class names can only be displayed if they are
recorded objects. You can enable "Record allocations on startup" in the session startup dialog [p. 88]
to record all objects.
- 204 -
B.6.16.3.2 Current Monitors View
The current monitors view shows monitors that are currently involved in a waiting or blocking operation.
Data in this view is available even if monitor events are not being recorded [p. 199] .
Otherwise, this view is explained by the common properties of monitor views [p. 204] .
- 205 -
B.6.16.4 Monitor usage statistics
To calculate a statistics, click Calculate statistics in the tool bar or select View->Calculate statistics
from JProfiler's main menu. If a statistics has been calculated, the context menu also provides access
to this action.
Before a statistics is calculated, the monitor usage statistics options dialog [p. 206] is brought up. The
resulting statistics table is static and can be re-calculated be executing Calculate statistics again.
The statistics options dialog remembers your last selection.
The package level statistics table displays five columns:
• Monitors/Threads/Classes
Displays the grouping criterion selected in the statistics dialog [p. 206] ,
• Block count
Shows how often a block operation has been performed on the monitors grouped in this row.
• Block duration
Shows the cumulative duration of all block operations performed on the monitors grouped in this
row.
• Wait count
Shows how often a waiting operation has been performed on the monitors grouped in this row.
• Wait duration
Shows the cumulative duration of all waiting operations performed on the monitors grouped in this
row.
• Monitors
• Threads
• Classes of monitors
- 206 -
B.6.17 VM telemetry view section
• Memory
Shows the maximum heap size and the amount of used and free space in it. This view can be
displayed as a line graph or area graph.
When you profile a Java 1.5+ JVM, the drop down list at the top offers all available memory pools.
Please see the article on tuning garbage collection for more information on heap memory pools.
In addition, there are several memory pools for non-heap data structures. The drop down list shows
all available memory pools in a tree-like structure, so you can display the sum of all heap pools
(the default selection) or the sum of all non-heap pools in the graph.
• Recorded objects
Shows the total number of objects on the heap, divided into arrays and non-arrays. This view can
be displayed as a line graph or area graph. Note that this view only displays recorded objects [p.
118] and is unavailable if no objects have been recorded so far. Objects that have been recorded
are tracked even after recording has been stopped.
• Recorded throughput
Shows how many objects are garbage collected and created. The plotted values are time rates,
so the total numbers in a time interval are given by the area under the respective lines. Note that
this view only displays recorded objects [p. 118] and is unavailable if no objects have been recorded
so far. Objects that have been recorded are tracked even after recording has been stopped.
• GC activity
Shows the garbage collector activity in percent of the elapsed time. This view is only available
when profiling with a Java 1.5+ JVM. The combo box at the top allows you to show the activity for
specific GC types. Sun JVMs implement a "Copy" and a "MarkSweepCompact" that apply to
different object generations.
• Classes
Shows the total number of classes loaded by the JVM, divided into CPU-profiled and
non-CPU-profiled [p. 69] classes. This view can be displayed as a line graph or area graph.
• Threads
Shows the total number of alive threads in the JVM, divided into the different thread states [p. 193]
. This view can be displayed as a line graph or area graph.
• CPU load
Shows the CPU load of the profiled process in percent of the elapsed time. This view is only
available when profiling with a Java 1.5+ JVM.
The graph type is a persistent view setting separate for each view and is thus also accessible through
the VM telemetry view settings dialog [p. 209] . Where possible, switching between line and area graph
is done by
• Choosing View->Graph type->Line graph or View->Graph type->Area graph from JProfiler's main
menu.
• Choosing Line graph or Area graph from the context menu.
• Choosing Line graph or Area graph in the VM telemetry view settings dialog [p. 209] .
- 207 -
When a view is shown as an area graph, the line which shows the total value is given by the upper
bound of the filled area while the single contributions are shown as stacked area segments.
When you move the mouse across a telemetry view, the time at the position of the mouse cursor and
the corresponding value on the vertical axis will be shown in JProfiler's status bar. The current value
of each data line is always shown next to the corresponding legend entry.
The VM telemetry views have two different display modes. The display mode is a persistent view
setting and is also accessible through the VM telemetry view settings dialog [p. 209] .
• choosing the scale mode selector button in the lower right corner of the view.
• choosing View->Scale to fit window from JProfiler's main menu.
• choosing Scale to fit window from the context menu.
• checking Scale to fit window in the VM telemetry view settings dialog [p. 209] .
In this mode, the time scale on the time axis does not change with time and the time axis can be
scrolled with the scrollbar on the bottom which appears if the total time span does not fit into the
current view size. If the current time is visible, the view is in auto-follow mode where the time axis
is scrolled automatically when new data arrives to always show the current time. If you are not in
auto-follow mode, because you scrolled back in time, just move the scrollbar to the right end of
the time scale to re-enable auto-following.
You can adjust the scale of the time axis by zooming in or out. Zooming in increases the level
of detail while zooming out decreases it. You change the zoom level by
• using the zoom controls in the lower right corner of the view.
• choosing View->Zoom in and View->Zoom out from JProfiler's main menu.
• choosing Zoom in and Zoom out from the context menu.
• choosing the scale mode selector button in the lower right corner of the view.
• choosing View->Continue at fixed scale from JProfiler's main menu.
• choosing Continue at fixed scale from the context menu.
• unchecking Scale to fit window in the VM telemetry view settings dialog [p. 209] .
The time scale on the time axis is adjusted continuously in order to show the total time span in the
current size of the view. Zooming is not possible in this mode.
Horizontal and vertical grid lines of the VM telemetry views can be configured in the VM telemetry
view settings dialog [p. 209] .
Note that you can use a trigger [p. 80] and the "Start recording" and "Stop recording" actions [p. 84]
to control VM telemetry recording for offline profiling [p. 225] .
- 208 -
B.6.17.2 VM Telemetry View Settings Dialog
The VM telemetry view settings dialog is accessed by bringing any VM telemetry [p. 207] to front and
choosing View->View settings from JProfiler's main menu or clicking on the corresponding toolbar
button. The context menu also gives access to the view settings dialog.
View settings are saved separately for each VM telemetry.
The following options are available:
• None
No bookmarks will be shown in the VM telemetry view.
• In time scale
The vertical bookmark line will only be drawn in the time scale at the top of the view.
• In entire view
The vertical bookmark line will be drawn in the time scale and in the view itself.
- 209 -
B.7 Snapshot comparisons
B.7.1 Snapshot Comparisons Overview
In JProfiler, you can save profiling data to disk,
• either with the save action [p. 101] in JProfiler's main window [p. 107]
• or with the offline profiling API [p. 225]
To compare one or several of these snapshots, JProfiler offers a separate comparison window that
you can access by
• Choosing Compare multiple snapshots from the Snapshots tab of the start center [p. 41]
and clicking [OK]. If the current window is already used for a profiling session, you will be prompted
whether a new frame should be opened, otherwise the current window will be exchanged with the
snapshot comparison window.
• Choosing Session->Compare snapshots in new window from JProfiler's main menu.
Menu and toolbar of the snapshot window are focused on snapshot comparisons, you can access all
other parts of JProfiler from a snapshot window by choosing File->Show start center from the main
menu or clicking on the corresponding toolbar button. This can be necessary if you close all other
windows. File->New window opens a new JProfiler window with the start center displayed.
Note: It is possible to create and export comparisons from the command line [p. 240] or an ant build
file [p. 245] . This is especially useful for an automated quality assurance process.
The snapshot window contains a snapshot selector at the left side that lets you configure the
snapshots which are available for creating a comparison. Before you create a comparison, you have
to add the involved snapshots to the snapshot selector. If you open the snapshot comparison window
without having saved any snapshots during the current JProfiler session, you will be prompted to
select snapshot files.
The order of the snapshot files in the list is significant since all comparisons will assume that snapshots
further down in the list have been recorded later.
Note: Snapshots are always compared to other snapshots, if you wish to compare a snapshot to a
currently running profiling session, please save a snapshot first. The saved snapshot will automatically
be shown in the snapshot selector.
The snapshot selector offers the following operations as toolbar buttons and context menu items:
• add a new snapshot file (INS). In the following file chooser select one or more *.jps files to
add to the snapshot selector. New snapshots are always appended to the end of the list.
• sort snapshot files. In the following popup dialog, you can select whether to sort the snapshot
files by creation time (i.e. the file modification time) or by name. Note that this is a one-time operation,
new snapshots are always appended to the end of the list.
• open snapshot files. The selected snapshot files are opened in new windows, just like when
you open them from the start center [p. 41] or with Session->Open snapshot from JProfiler's
main menu.
• remove snapshot files (DEL). The currently selected snapshot files are removed from the
snapshot selector. If any of the snapshot files to be removed are used in an existing comparison,
those comparison will be closed as well after a confirmation dialog.
- 210 -
• move snapshot files up in the list (ALT-UP). If your selection is a single interval, the whole
block of snapshot files will be moved.
• move snapshot files down in the list (ALT-DOWN). If your selection is a single interval, the
whole block of snapshot files will be moved.
After you've added the involved snapshots, you can create comparisons with the comparison
wizards. There are several comparison wizards that group comparisons in analogy to the view sections
[p. 107] in the profiling window:
The comparison wizards can be invoked from the File menu, from the toolbar as well as from the
context menu of the snapshot selector.
If you wish to perform the comparison on a subset of the displayed snapshot files, it is easiest to first
select the involved snapshots before invoking a comparison wizard. However, all snapshot wizards
allow you to change this selection.
Comparisons are displayed as new tabs in the snapshot comparison window. They can be
• renamed by choosing View->Rename from the main menu while the view is active.
• closed by choosing View->Close from the main menu while the view is active. You can also click
the tab with the middle mouse button to close it.
The above actions are also available in the context menu on the bottom of the tab.
The comparison wizards are optimized to quickly let you create new comparisons that are similar to
previous comparisons. The wizards remember all previous parameters, so to create another
comparison with the same parameters but different snapshots, just select new new snapshots in the
snapshot selector on the left, invoke the wizard and click on "Finish".
To create another comparison with the same snapshots but different parameters, just invoke the
wizard, click on "Next" to confirm the comparison type, then click on the step in the index where you
wish to make a change and finally click on "Finish".
Most of the parameters that can be adjusted on the fly in the normal profiling views [p. 107] are selected
in the comparison wizards and are fixed once the snapshot comparison has been created. These
parameters are displayed in the comparison header which has the same layout for every comparison:
In the first line you see the name of the comparison, the following lines are name value pairs of the
selected parameters.
All comparisons have specific view settings that can be edited by choosing View->View settings
from the main menu or the corresponding toolbar button when the comparison is active.
Common properties of comparisons include
- 211 -
- 212 -
B.7.2 Memory comparisons
The additional steps are described on the help pages linked above.
• Select snapshots
The objects comparison compares two snapshot files. In this step, you select the first and the
second snapshot file for the comparison. The combo boxes contain all snapshot files that have
been added to the snapshot selector [p. 210] . The first and second snapshot files must be different.
• Recording type
In this step, you choose whether you want to compare
• All objects
This option only yields results if both compared snapshots were profiled with Java 1.5 or higher
(JVMTI). If one of the compared snapshots was profiled with Java 1.4 or lower (JVMPI), selecting
this option will generate an empty comparison.
• Recorded objects
Only objects that were recorded [p. 118] will be compared when this option is selected.
• Heap snapshot objects
All objects that were captured in a heap snapshot taken in the heap walker [p. 137] will be
compared when this option is selected. Heap snapshot must be present in both selected
snapshots to yield meaningful results. This is the only option that works for HPROF heap dumps.
• View parameters
In this steps you can select aggregation and liveness mode (only for recorded objects), just as for
the all objects view [p. 119] and the recorded objects view [p. 121] .
- 213 -
The second column incorporates a bidirectional bar chart. Increases are painted in red and to the
right, while decreases are painted in green and to the left. In the view settings dialog [p. 214] you can
choose whether you want this bar chart to display absolute changes or the percentage of the change.
The other value is displayed in parentheses. This setting also determines how this column is sorted.
The second column can show either size or instances. This is configurable in the view settings dialog
[p. 214] and is called the primary measure.
By default, only classs that have changed from one snapshot file to the other are displayed. You can
change this behavior in the view settings dialog [p. 214] .
At the bottom of the objects comparison is a view filter selector [p. 117] that filters data for specific
package or class names.
The context menu and the View menu provide actions for creating an allocation call tree comparison
[p. 216] or an allocation hot spot comparison [p. 215] for the selected class.
Please note that if the current comparison compares "All objects" (see above), the numbers will likely
not correspond with the object comparison since the allocation comparisons only compare recorded
objects.
At the bottom of the objects comparison is a view filter selector [p. 117] that filters data for specific
package or class names.
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The primary measure defines which measurement will be shown in the second column of the objects
view. That column shows its values graphically with a histogram, has percentages attached and is
the default sort column. By default, the primary measure is the instance count. Alternatively, you can
work with the shallow size, which is especially useful if you're looking at arrays.
The differences of primary measure options determine how differences in the primary measure
column are displayed and how that column is sorted.
• Sort by values
The bar chart in the primary measure column displays absolute differences. When this column
is sorted, it is sorted by absolute differences. Percentages are displayed in parentheses.
• Sort by percentages
- 214 -
The bar chart in the primary measure column displays percentages. When this column is sorted,
it is sorted by absolute percentages. Absolute differences are displayed in parentheses.
• Select snapshots
The allocation hot spot comparison compares two snapshot files. In this step, you select the first
and the second snapshot file for the comparison. The combo boxes contain all snapshot files that
have been added to the snapshot selector [p. 210] . The first and second snapshot files must be
different.
• Class selection
In this step, you choose for which class or package the comparison should be made. By default
all classed are selected, you can restrict the class selection to a single class or a single package.
• View parameters
In this steps you can select aggregation level, liveness mode and filtered classes handling, just as
for the allocation hot spots view [p. 129] .
Each row in the allocation hot spot comparison has the following columns:
The second column incorporates a bidirectional bar chart. Increases are painted in red and to the
right, while decreases are painted in green and to the left. In the view settings dialog [p. 215] you can
choose whether you want this bar chart to display absolute changes or the percentage of the change.
The other value is displayed in parentheses. This setting also determines how this column is sorted.
By default, only allocation hot spots that have changed from one snapshot file to the other are
displayed. You can change this behavior in the view settings dialog [p. 215] .
At the bottom of the allocation hot spot comparison is a view filter selector [p. 117] that filters data for
specific package or class names.
- 215 -
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The node description options control the amount of information that is presented in the description
of the call.
The size differences options determine how differences in the allocated memory column are displayed
and how that column is sorted.
• Sort by values
The bar chart in the allocated memory column displays absolute differences. When this column
is sorted, it is sorted by absolute differences. Percentages are displayed in parentheses.
• Sort by percentages
The bar chart in the allocated memory column displays percentages. When this column is sorted,
it is sorted by absolute percentages. Absolute differences are displayed in parentheses.
• Select snapshots
The allocation tree comparison compares two snapshot files. In this step, you select the first and
the second snapshot file for the comparison. The combo boxes contain all snapshot files that have
been added to the snapshot selector [p. 210] . The first and second snapshot files must be different.
• Class selection
In this step, you choose for which class or package the comparison should be made. By default
all classed are selected, you can restrict the class selection to a single class or a single package.
- 216 -
• View parameters
In this steps you can select aggregation level and liveness mode, just as for the allocation tree
view [p. 124] .
Each node in the tree has the same format as in the allocation tree view [p. 124] , except that the size
and allocations are the differences between the second and the first snapshot.
Each node has an optional bar chart at the beginning, Increases are painted in red, while decreases
are painted in green. In the view settings dialog [p. 217] you can choose whether you want this bar
chart to display absolute changes or the percentage of the change. The other value is displayed in
parentheses. This setting also determines how sibling nodes are sorted.
By default, only call stacks that are present in both snapshot files and that have changed from one
snapshot file to the other are displayed. You can change this behavior in the view settings dialog [p.
217] .
At the bottom of the allocation tree comparison is a view filter selector [p. 117] that filters data for
specific package or class names.
• Automatic
Depending on the size value, it's displayed in MB, kB or bytes, in such a way that 3 significant
digits are retained.
• Megabytes (MB)
• Kilobytes (kB
• Bytes
The node description options control the amount of information that is presented in the description
of the call.
- 217 -
If this option is not checked, method signatures are shown only if two methods with the same name
appear on the same level.
Only applicable if the aggregation level has been set to "methods".
The size differences options determine how size differences are displayed and how sibling nodes
are sorted.
• Sort by values
The bar chart on each node displays absolute differences. Sibling nodes are sorted by absolute
differences. Percentages are displayed in parentheses.
• Sort by percentages
The bar chart on each node displays percentages. Sibling nodes are sorted by absolute
percentages. Absolute differences are displayed in parentheses.
- 218 -
B.7.3 CPU comparisons
The additional steps are described on the help pages linked above.
• Select snapshots
The hot spot comparison compares two snapshot files. In this step, you select the first and the
second snapshot file for the comparison. The combo boxes contain all snapshot files that have
been added to the snapshot selector [p. 210] . You can use the same snapshot file for the first and
second snapshot file, in which case the thread selections in the next step must be different.
• Thread selection
In this step, you choose for which threads the comparison should be made. By default all threads
are selected, you can restrict the thread selection to single thread groups or single threads.
• View parameters
In this steps you can select thread status, aggregation level and hot spot type, just as for the hot
spots view [p. 177] . In addition, you can choose whether to calculate differences of total call times
or of average call times (total time divided by invocation count). Note that if "Sampling" was used
as the method call recording type [p. 74] , the invocation count is not available and this setting will
not have any effect.
Each row in the hot spot comparison has the following columns:
The second column incorporates a bidirectional bar chart. Increases are painted in red and to the
right, while decreases are painted in green and to the left. In the view settings dialog [p. 220] you can
choose whether you want this bar chart to display absolute changes or the percentage of the change.
The other value is displayed in parentheses. This setting also determines how this column is sorted.
By default, only hot spots that have changed from one snapshot file to the other are displayed. You
can change this behavior in the view settings dialog [p. 220] .
- 219 -
At the bottom of the hot spot comparison is a view filter selector [p. 117] that filters data for specific
package or class names.
• Automatic
Depending on the time value, it's displayed in seconds, millseconds or microseconds, in such a
way that 3 significant digits are retained.
• Seconds
• Millseconds
• Microseconds
The node description options control the amount of information that is presented in the description
of the call.
The time differences options determine how differences in the inherent time column are displayed
and how that column is sorted.
• Sort by values
The bar chart in the inherent time column displays absolute differences. When this column is
sorted, it is sorted by absolute differences. Percentages are displayed in parentheses.
• Sort by percentages
The bar chart in the inherent time column displays percentages. When this column is sorted, it
is sorted by absolute percentages. Absolute differences are displayed in parentheses.
- 220 -
The wizard has the following additional steps:
• Select snapshots
The call tree comparison compares two snapshot files. In this step, you select the first and the
second snapshot file for the comparison. The combo boxes contain all snapshot files that have
been added to the snapshot selector [p. 210] . You can use the same snapshot file for the first and
second snapshot file, in which case the thread selections in the next step must be different.
• Thread selection
In this step, you choose for which threads the comparison should be made. By default all threads
are selected, you can restrict the thread selection to single thread groups or single threads.
• View parameters
In this steps you can select thread status and aggregation level, just as for the call tree view [p.
172] . In addition, you can choose whether to calculate differences of total call times or of average
call times (total time divided by invocation count). Note that if "Sampling" was used as the method
call recording type [p. 74] , the invocation count is not available and this setting will not have any
effect.
Each node in the tree has the same format as in the call tree view [p. 172] , except that the time and
invocations are the differences between the second and the first snapshot.
Each node has an optional bar chart at the beginning, Increases are painted in red, while decreases
are painted in green. In the view settings dialog [p. 221] you can choose whether you want this bar
chart to display absolute changes or the percentage of the change. The other value is displayed in
parentheses. This setting also determines how sibling nodes are sorted.
By default, only call stacks that are present in both snapshot files and that have changed from one
snapshot file to the other are displayed. You can change this behavior in the view settings dialog [p.
221] .
At the bottom of the call tree comparison is a view filter selector [p. 117] that filters data for specific
package or class names.
• Automatic
Depending on the time value, it's displayed in seconds, millseconds or microseconds, in such a
way that 3 significant digits are retained.
• Seconds
• Millseconds
• Microseconds
The node description options control the amount of information that is presented in the description
of the call.
- 221 -
display type view setting (see below), these differences are either absolute differences or
percentages. Positive differences are painted in red, while negative differences are painted in
green.
• Always show fully qualified names
If this option is not checked (default), class name are omitted in intra-class method calls which
enhances the conciseness of the display.
Only applicable if the aggregation level has been set to "methods".
• Always show signature
If this option is not checked, method signatures are shown only if two methods with the same name
appear on the same level.
Only applicable if the aggregation level has been set to "methods".
The time differences options determine how time differences are displayed and how sibling nodes
are sorted.
• Sort by values
The bar chart on each node displays absolute differences. Sibling nodes are sorted by absolute
differences. Percentages are displayed in parentheses.
• Sort by percentages
The bar chart on each node displays percentages. Sibling nodes are sorted by absolute
percentages. Absolute differences are displayed in parentheses.
- 222 -
B.7.4 VM telemetry comparisons
• Heap comparison
• Recorded objects comparison
• Classes comparison
• Threads comparison
• Select snapshots
The telemetry comparisons compare two or more snapshot files. In this step, you select whether
you want to compare the snapshots that you have selected in the snapshot selector [p. 210] , or
whether all snapshot files should be compared. The default selection depends on whether you
have selected more than one snapshot in the snapshot selector.
• Memory type
This screen is only shown for the "Heap comparison" and lets you choose a memory pool for
comparison as explained on the help page of the VM telemetry views [p. 207] . Only memory pools
are shown that are contained in all compared snapshots.
• Comparison type
Each snapshot file contributes one value to the comparison graph. That value can be the
• current value
This is the value when the snapshot was saved, i.e. the rightmost point in the VM telemetry view
[p. 207] and the value that is displayed next to the legend entries there.
• maximum value
This is the maximum value during the entire time that the VM telemetry view [p. 207] was recording
data. The maximum value is evaluated separately for each snapshot file.
• value at a bookmark
In JProfiler, you can set bookmarks [p. 114] for specific points in time. In addition, there are
automatic bookmarks for recording events. If all compared snapshots contain a bookmark with
the same name, you can compare values at those times. If you choose this option you have to
select a bookmark from the combo box below. Only bookmarks that are contained in all snapshots
are displayed.
• Compared measurements
In this step you select which of the measurements from the corresponding VM telemetry view [p.
207] should be compared. You can select any combination of measurements, for each telemetry
comparison there's one preferred measurement that's compared by default. The available
measurements are:
• Heap comparison
- 223 -
Maximum, free and used heap size (default)
• Recorded objects comparison
Total number of objects (default), non-arrays, arrays
• Classes comparison
Total number of classes (default), filtered classes, unfiltered classes
• Threads comparison
Total number of threads (default), inactive threads, active threads
Any telemetry comparison behaves similarly to the VM telemetry views [p. 207] themselves, on the
horizontal axis you see the snapshot numbers from the snapshot selector, the vertical axis remains
the same. Effectively, the time axis from the VM telemetry views is replaced by an ordinal snapshot
file axis.
There are several view settings [p. 224] that influence the display of the comparison. Please see the
help on the VM telemetry views [p. 207] for more information.
- 224 -
B.8 Offline profiling
B.8.1 Offline Profiling
JProfiler's offline profiling capability allows you to run profiling sessions from the command line without
the need for starting JProfiler's GUI front end. Offline profiling makes sense if you want to
• perform profiling runs from a scripted environment (e.g. an ant build file)
• save snapshots on a regular basis for QA work
• profile server components on remote machines via slow network connections
Performing an offline profiling run for your application is analogous to remote profiling [p. 89] with
special library parameters passed to the profiling agent VM parameter -Xrunjprofiler for Java
<=1.4.2 (JVMPI) or -agentpath:[path to jprofilerti library] for Java >=1.5.0 (JVMTI):
• offline switch
Passing offline as a library parameter enables offline profiling. In this case, a connection with
JProfiler's GUI is not possible.
• session ID
In order for JProfiler to set the correct profiling settings, a corresponding session has to be configured
in JProfiler's GUI front end. The ID of that session has to passed as a library parameter: id=nnnn.
Your settings in the profiling settings dialog [p. 73] are used for offline profiling. The session ID can
be seen in the top right corner of the application settings dialog [p. 65] .
• config file location (optional)
The config file that is read for extracting the session with the specified ID has to be passed via
config={path to config.xml}. The config file is located in the .jprofiler6 directory in
your user home directory (on Windows, the user home directory is typically c:\Documents and
Settings\$USER). If you leave out this parameter, JProfiler will try to detect the config file location
automatically.
A summary of all library parameters is available in the remote session invocation table [p. 93] .
If you profile on a machine where JProfiler is not installed, you will need to transfer the contents of
the bin/{your platform} directory as well as the JAR file bin/agent.jar and the config file
{User home directory}/.jprofiler6/config.xml.
Example:
A typical invocation for offline profiling with Java >=1.5 (JVMTI) will look like this:
java "-agentpath:C:\Program
Files\jprofiler6\bin\windows\jprofilerti.dll=offline,id=109,config=C:\Users\bob\.jprofiler6\config.xml"
"-Xbootclasspath/a:C:\Program Files\jprofiler6\bin\agent.jar"
-classpath myapp.jar com.mycorp.MyApp
Please study the remote session invocation table [p. 93] to generate the correct invocation for your
JVM. Also, please don't forget that the platform-specific native library path has to be modified, just
like for remote profiling [p. 89] .
If you start your application from an ant build file, you can use the ant task [p. 227] to easily profile your
application in offline mode.
- 225 -
If you already have a local session defined, you can generate a start script for offline profiling with
the local to offline conversion wizard on the "Convert" tab of the start center [p. 41] or by selecting
Session->Conversion wizards->Convert local session to offline from the main menu.
To control CPU profiling, triggering of heap dumps and saving of snapshots during an offline profiling
session, you can use the
• Profiling API
JProfiler's profiling API [p. 229] allows you to control the profiling agent from your own code. An
example on how to use the offline profiling API is available in the
$JPROFILER_HOME/api/samples/offline directory.
• Triggers
With triggers [p. 80] , you can define all profiling actions in the JProfiler GUI.
• JProfiler MBean
On Java 1.5+, the profiling agent registers an MBean that gives access to all profiling actions.
MBeans are configurable in jconsole:
- 226 -
Most methods of the com.jprofiler.api.agent.Controller are reflected in the MBean.
For documentation of the MBean operations, please see the javadoc of
com.jprofiler.api.agent.mbean.ControllerMBean.
The MBean may also be accessible via configuration facilities of an application server or other
tools.
If wish to analyze profiling information at run-time, you can use the profiling platform that is part of
JProfiler. Please see the javadoc in $JPROFILER_HOME/api/javadoc and the sample in
$JPROFILER_HOME/api/samples/platform for more information.
<taskdef name="profile"
classname="com.jprofiler.ant.ProfileTask"
classpath="C:\Program Files\jprofiler6\bin\ant.jar"/>
<target name="profile">
<profile classname="MyMainClass" offline="true" sessionid="80">
<classpath>
<fileset dir="lib" includes="*.jar" />
</classpath>
- 227 -
</profile>
</target>
The taskdef definition must occur only once per ant-build file and can appear anywhere on the top
level below the project element.
Note: it is not possible to copy the ant.jar archive to the lib folder of your ant distribution. You
have to reference a full installation of JProfiler in the task definition.
Besides the attributes of the java task, the profile task supports the following additional attributes:
offline Whether the profiling run should No, offline and nowait cannot
be in offline mode [p. 225] . both be true
Corresponds to the offline
library parameter [p. 93] . Either
true or false.
- 228 -
configuration. If not set or zero,
the default port (8849) will be
used. Has no effect if offline is
set because in that case there's
no connection from the GUI.
Corresponds to the port library
parameter [p. 93] .
- 229 -
B.9 Command line export
B.9.1 Snapshots
In both cases you specify a number of view names together with a set of options. Each view has its
own set of options. The options can be used to adjust the presentation and the displayed data. For
each GUI component in JProfiler that lets you choose the displayed data, like aggregation level or
thread selection, an option is provided that allows you to perform the same selection for the command
line export.
Most views in JProfiler support multiple output formats. By default, the output format is deduced from
the extension of the output file:
• .html
export as HTML file. Note that a directory named jprofiler_images will be created that contains
images used in the HTML page.
• .csv
export as CSV data, the first line contains the column names.
Note: When using Microsoft Excel, CSV is not a stable format. Microsoft Excel on Windows takes
the separator character from the regional settings. JProfiler uses a semicolon as the separator in
locales that use a comma as a decimal separator and a comma in locales that use a dot as a
decimal separator. If you need to override the CSV separator character you can do so by setting
-Djprofiler.csvSeparator in bin/export.vmoptions.
• .xml
export as XML data. The data format is self-descriptive.
If you would like to use different extensions, you can use the format option to override the choice of
the output format.
When you save a snapshot, the session configuration is saved in the snapshot file. The snapshot
loses the connection to the session configuration under which is was recorded. For this reason, you
cannot edit the view settings in the original session to change presentation aspects of the HTML
export. With the global session option, you can specify a session id whose view settings should be
used for the export. The session id can be found in the application settings next to the session name.
The export will fail if
- 230 -
• an option has an invalid value
• an option leads to an invalid selection in JProfiler, e.g. if a class cannot be found
You can choose to ignore errors by using the global ignoreerrors option.
Global options:
-outputdir=[output directory]
Base directory to be used when the output file for a view is a
relative file.
-ignoreerrors=true|false
Ignore errors that occur when options for a view cannot be set and
continue with the next view. The default value is "false", i.e. the
export is terminated, when the first error occurs.
-session=[session id]
An alternate session from which the view settings should be taken. The
session id can be found in the application settings next to the
session name. By default, the view settings are taken from the session
that is embedded inside the snapshot file.
- 231 -
Expand package nodes in the package aggregation level to show
contained classes. The default value is "false". Has no effect for
other aggregation levels.
* RecordedObjects
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-aggregation=class|package|component
Selects the aggregation level for the export. The default value is
classes.
-expandpackages=true|false
Expand package nodes in the package aggregation level to show
contained classes. The default value is "false". Has no effect for
other aggregation levels.
-liveness=live|gc|all
Selects the liveness mode for the export, i.e. whether to display live
objects, garbage collected objects or both. The default value is live
objects.
* AllocationTree
options:
-format=html|xml
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
methods.
-class=[fully qualified class name]
Specifies the class for which the allocation data should be
calculated. If empty, allocations of all classes will be shown. Cannot
be used together with the package option.
-package=[fully qualified package name]
Specifies the package for which the allocation data should be
calculated. If empty, allocations of all packages will be shown.
Cannot be used together with the class option.
-liveness=live|gc|all
Selects the liveness mode for the export, i.e. whether to display live
objects, garbage collected objects or both. The default value is live
objects.
* AllocationHotSpots
options:
- 232 -
-format=html|csv|xml
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
methods.
-class=[fully qualified class name]
Specifies the class for which the allocation data should be
calculated. If empty, allocations of all classes will be shown. Cannot
be used together with the package option.
-package=[fully qualified package name]
Specifies the package for which the allocation data should be
calculated. If empty, allocations of all packages will be shown.
Cannot be used together with the class option.
-liveness=live|gc|all
Selects the liveness mode for the export, i.e. whether to display live
objects, garbage collected objects or both. The default value is live
objects.
-filteredclasses=separately|addtocalling
Selects if filtered classes should be shown separately or be added to
the calling class. The default value is to show filtered classes
separately.
-expandbacktraces=true|false
Expand backtraces in HTML or XML format. The default value is "false".
* ClassTracker
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* CallTree
options:
-format=html|xml
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
- 233 -
methods.
-threadgroup=[name of thread group]
Selects the thread group for the export. If you specify thread as well
, the thread will only be searched in this thread group, otherwise the
entire thread group will be shown.
-thread=[name of thread]
Selects the thread for the export. By default, the call tree is merged
for all threads.
-threadstatus=all|running|waiting|blocking|netio
Selects the thread status for the export. The default value is the
runnable state.
* HotSpots
options:
-format=html|csv|xml
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
methods.
-threadgroup=[name of thread group]
Selects the thread group for the export. If you specify thread as well
, the thread will only be searched in this thread group, otherwise the
entire thread group will be shown.
-thread=[name of thread]
Selects the thread for the export. By default, the call tree is merged
for all threads.
-threadstatus=all|running|waiting|blocking|netio
Selects the thread status for the export. The default value is the
runnable state.
-hotspottype=method|methodnofiltered|jdbc|jms|jndi|url
Selects the hot spot type for the export. The default value is
"method".
-expandbacktraces=true|false
Expand backtraces in HTML or XML format. The default value is "false".
* ThreadHistory
options:
-format=html
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* ThreadMonitor
- 234 -
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
* CurrentMonitorUsage
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
* MonitorUsageHistory
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
* MonitorUsageStatistics
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-type=monitors|threads|classes
Selects the entity for which the monitor statistics should be
calculated. The default value is "monitors".
* TelemetryHeap
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* TelemetryObjects
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
- 235 -
* TelemetryThroughput
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* TelemetryGC
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* TelemetryClasses
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* TelemetryThreads
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* TelemetryCPU
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
- 236 -
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
* Bookmarks
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
<taskdef name="export"
classname="com.jprofiler.ant.ExportTask"
classpath="C:\Program Files\jprofiler4\bin\ant.jar"/>
<target name="export">
<export snapshotfile="c:\home\ingo\test.jps">
<view name="CallTree" file="calltree.html"/>
<view name="HotSpots" file="hotspots.html">
<option name="expandbacktraces" value="true"/>
<option name="aggregation" value="class"/>
</view>
</export>
</target>
The taskdef definition must occur only once per ant-build file and can appear anywhere on the top
level below the project element.
- 237 -
Note: it is not possible to copy the ant.jar archive to the lib folder of your ant distribution. You
have to reference a full installation of JProfiler in the task definition.
The export task supports the following attributes:
The export task contains a list of view elements with the following attributes:
Attribute Description Required
The view element can optionally contain a list of option elements with the following attributes:
Attribute Description Required
- 238 -
B.9.2 Comparisons
In both cases you specify a number of snapshots and a number of comparison names together with
a set of options for each comparison. Each comparison has its own set of options. The options can
be used to adjust the presentation and the displayed data. For each selection step in the comparison
wizards, an option is provided that allows you to perform the same selection for the command line
comparison.
Most comparisons in JProfiler support multiple output formats. By default, the output format is deduced
from the extension of the output file:
• .html
export as HTML file. Note that a directory named jprofiler_images will be created that contains
images used in the HTML page.
• .csv
export as CSV data, the first line contains the column names.
Note: When using Microsoft Excel, CSV is not a stable format. Microsoft Excel on Windows takes
the separator character from the regional settings. JProfiler uses a semicolon as the separator in
locales that use a comma as a decimal separator and a comma in locales that use a dot as a
decimal separator. If you need to override the CSV separator character you can do so by setting
-Djprofiler.csvSeparator in bin/export.vmoptions.
• .xml
export as XML data. The data format is self-descriptive.
If you would like to use different extensions, you can use the format option to override the choice of
the output format.
The export will fail if
You can choose to ignore errors by using the global ignoreerrors option.
- 239 -
B.9.2.2 Command Line Comparison Executable
The command line comparison executable can be used to generate comparisons from a number of
saved snapshot. For more information please consult the overview [p. 239] .
The comparison executable is named jpcompare.exe on Windows and jpcompare on Unix-based
operating systems and is located in the bin directory of a JProfiler installation. If you execute it with
the -help option, you will get help on the available comparison names and comparison options:
Global options:
-outputdir=[output directory]
Base directory to be used when the output file for a comparison is a
relative file.
-ignoreerrors=true|false
Ignore errors that occur when options for a comparison cannot be set
and continue with the next comparison. The default value is "false",
i.e. the export is terminated, when the first error occurs.
-sortbytime=false|true
Sort the specified snapshot files by modification time. The default
value is false.
-listfile=[filename]
Read a file that contains the paths of the snapshot files, one
snapshot file per line.
- 240 -
Selects the aggregation level for the export. The default value is
classes.
* AllocationHotSpots
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-classselection
Calculate the comparison for a specific class or package. Specify a
package with a wildcard, like 'java.awt.*'.
-liveness=live|gc|all
Selects the liveness mode for the export, i.e. whether to display live
objects, garbage collected objects or both. The default value is live
objects.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
methods.
-filteredclasses=separately|addtocalling
Selects if filtered classes should be shown separately or be added to
the calling class. The default value is to show filtered classes
separately.
* AllocationTree
options:
-format=html|xml
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-classselection
Calculate the comparison for a specific class or package. Specify a
package with a wildcard, like 'java.awt.*'.
-liveness=live|gc|all
Selects the liveness mode for the export, i.e. whether to display live
objects, garbage collected objects or both. The default value is live
objects.
* HotSpots
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
- 241 -
specified packages and their sub-packages will be displayed by the
exported view.
-firstthreadselection
Calculate the comparison for a specific thread or thread group.
Specify thread groups like 'group.*' and threads in specific thread
groups like 'group.thread'. Escape dots in thread names with
backslashes.
-secondthreadselection
Calculate the comparison for a specific thread or thread group. Only
available if 'firstthreadselection' is set. If empty, the same value
as for 'firstthreadselection' will be used. Specify thread groups like
'group.*' and threads in specific thread groups like 'group.thread'.
Escape dots in thread names with backslashes.
-threadstatus=all|running|waiting|blocking|netio
Selects the thread status for the export. The default value is the
runnable state.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
methods.
-differencecalculation=total|average
Selects the difference calculation method for call times. The default
value is total times.
-hotspottype=method|methodnofiltered|jdbc|jms|jndi|url
Selects the hot spot type for the export. The default value is
"method".
* CallTree
options:
-format=html|xml
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-viewfilters=[comma-separated list]
Sets view filters for the export. If you set view filters, only the
specified packages and their sub-packages will be displayed by the
exported view.
-firstthreadselection
Calculate the comparison for a specific thread or thread group.
Specify thread groups like 'group.*' and threads in specific thread
groups like 'group.thread'. Escape dots in thread names with
backslashes.
-secondthreadselection
Calculate the comparison for a specific thread or thread group. Only
available if 'firstthreadselection' is set. If empty, the same value
as for 'firstthreadselection' will be used. Specify thread groups like
'group.*' and threads in specific thread groups like 'group.thread'.
Escape dots in thread names with backslashes.
-threadstatus=all|running|waiting|blocking|netio
Selects the thread status for the export. The default value is the
runnable state.
-aggregation=method|class|package|component
Selects the aggregation level for the export. The default value is
methods.
-differencecalculation=total|average
- 242 -
Selects the difference calculation method for call times. The default
value is total times.
* TelemetryHeap
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
-valuetype=current|maximum|bookmark
Type of the value that is calculated for each snapshot. Default is the
current value.
-bookmarkname
If valuetype is set to 'bookmark', the name of the bookmark for which
the value should be calculated.
-measurements=maximum,free,used
Measurements that are shown in the comparison graph. Concatenate
multiple values with commas. The default value is 'used'.
-memorytype=heap|nonheap
Type of the memory that should be analyzed. Default is 'heap'.
-memorypool
If a special memory pool should be analyzed, its name can be specified
with this parameter. The default is empty, i.e. no special memory
pool.
* TelemetryObjects
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
-valuetype=current|maximum|bookmark
Type of the value that is calculated for each snapshot. Default is the
current value.
-bookmarkname
If valuetype is set to 'bookmark', the name of the bookmark for which
the value should be calculated.
-measurements=total,nonarrays,arrays
Measurements that are shown in the comparison graph. Concatenate
multiple values with commas. The default value is 'total'.
* TelemetryClasses
options:
-format=html|csv
- 243 -
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
-valuetype=current|maximum|bookmark
Type of the value that is calculated for each snapshot. Default is the
current value.
-bookmarkname
If valuetype is set to 'bookmark', the name of the bookmark for which
the value should be calculated.
-measurements=total,filtered,unfiltered
Measurements that are shown in the comparison graph. Concatenate
multiple values with commas. The default value is 'total'.
* TelemetryThreads
options:
-format=html|csv
Determines the output format of the exported file. If not present, the
export format will be determined from the extension of the output
file.
-minwidth=[number of pixels]
Minimum width of the graph window in pixels. The default value is 800.
-minheight=[number of pixels]
Minimum height of the graph window in pixels. The default value is
600.
-valuetype=current|maximum|bookmark
Type of the value that is calculated for each snapshot. Default is the
current value.
-bookmarkname
If valuetype is set to 'bookmark', the name of the bookmark for which
the value should be calculated.
-measurements=total,runnable,waiting,netio,waiting
Measurements that are shown in the comparison graph. Concatenate
multiple values with commas. The default value is 'total'.
Objects objects.csv
AllocationTree -class=java.lang.String allocations.xml
- 244 -
B.9.2.3 Comparison Ant Task
The comparison ant task can be used to generate comparisons from a number of saved snapshots.
For more information please consult the overview [p. 239] .
You can integrate the command line comparison with your ant script (read about ant at ant.apache.org)
by using the compare task that is provided in {JProfiler installation
directory}/bin/ant.jar.
To make the compare task available to ant, you must first insert a taskdef element that tells ant
where to find the task definition. Here is an example of using the task in an ant build file:
<taskdef name="compare"
classname="com.jprofiler.ant.CompareTask"
classpath="C:\Program Files\jprofiler6\bin\ant.jar"/>
<target name="compare">
<compare sortbytime="true">
<fileset dir=".">
<include name="*.jps" />
</fileset>
<comparison name="TelemetryHeap" file="heap.html"/>
<comparison name="TelemetryThreads" file="threads.html">
<option name="measurements" value="inactive,active"/>
<option name="valuetype" value="bookmark"/>
<option name="bookmarkname" value="test"/>
</comparison>
</compare>
</target>
The taskdef definition must occur only once per ant-build file and can appear anywhere on the top
level below the project element.
Note: it is not possible to copy the ant.jar archive to the lib folder of your ant distribution. You
have to reference a full installation of JProfiler in the task definition.
The compare task supports the following attributes:
- 245 -
export is terminated, when the
first error occurs.
The compare task can contain nested fileset elements to specify the snapshots that should be
compared. If no fileset is specified, the listfile attribute of the compare task must be set.
The compare task contains a list of comparison elements with the following attributes:
Attribute Description Required
The comparison element can optionally contain a list of option elements with the following attributes:
Attribute Description Required
- 246 -