JProfiler is a Java profiler combining CPU, Memory and Thread profiling in one application. It is developed by ej-technologies and currently in. JProfiler: Code Coverage Analysis Tool for OMP Project .. ³ ej-technologies' lack of explicit tutorials is partly compensated by some demo. JProfiler is a Java profiler combining CPU, Memory and Thread profiling in one application. It is developed by ej-technologies and currently in version
|Language:||English, Spanish, Dutch|
|ePub File Size:||16.76 MB|
|PDF File Size:||11.65 MB|
|Distribution:||Free* [*Register to download]|
JProfiler Manual. © ej-technologies GmbH. All rights reserved. Page 2. Index. JProfiler help. .. B JProfiler's start center. Method calls. This is commonly called "CPU profiling". Method calls can be measured and visualized in different ways. The analysis of method calls helps you to. JProfiler eBook. If you would like to print the manual, view it offline, or take it with you on a mobile device, you can download it in the following formats: as a PDF.
It is developed by ej-technologies and currently in version 1. JProfiler offers two different kinds of sessions: Local sessions which allow you to assemble the information required to start and profile your application in a point and click interface. Remote sessions which allow you to attach to any externally started Java application, even on a different computer. This type of session can be used to profile virtually any Java application server. For the example used in this article, we will profile a GUI application using a local session. While Jclasslib provides a lot of insight into the Java class file format, the bytecode display seems to be quite memory intensive and fairly sluggish for displaying large methods.
YourKit has an interesting CPU profiling feature that allows focused profiling on certain areas of our code such as methods or subtrees in threads. This is very powerful as it allows for conditional profiling through its what-if feature.
Figure 5 shows an example of the thread-profiling interface: Figure 5. It even provides a view for actual queries that were executed. Though this is not a technical consideration, the permissive licensing model of YourKit makes it a good choice for multi-user or distributed teams, as well as for single-license downloads. Its operation relies on other standalone tools provided in the JDK, such as JConsole, jstat, jstack, jinfo, and jmap.
Below, we can see a simple overview interface of an ongoing profiling session using Java VisualVM: Java VisualVM local tomcat server app profiling One interesting advantage of Java VisualVM is that we can extend it to develop new functionalities as plugins. We can also choose to either enable real-time profiling with instant updates typically every 2 seconds. Below, we can see the memory outlook of a Java application profiled using Java VisualVM: With the snapshot feature of Java VisualVM, we can take snapshots of profiling sessions for later analysis.
All other profilers discussed above provide plugins to enhance IDEs integration. Remote sessions which allow you to attach to any externally started Java application, even on a different computer. This type of session can be used to profile virtually any Java application server. For the example used in this article, we will profile a GUI application using a local session. We have selected the Jclasslib class file browser as our application available from http: While Jclasslib provides a lot of insight into the Java class file format, the bytecode display seems to be quite memory intensive and fairly sluggish for displaying large methods.
We'll use JProfiler to identify the bottleneck. If we were starting Jclasslib from the command line, we would use java -cp "C: First, we create a new session to start the application, then we fill in the same details we would use on the command line: The VM parameters field here is used to change the look and feel of the class file browser.
JProfiler lets you specify which packages you want included in the profile report. This useful feature allows you focus on the bottlenecks separately from the various components of an application. The Jclasslib package starts with org. This ensures that org. Now we have configured our session with all the necessary information, we save the session and start it. A terminal window appears, capturing the stdout and stderr output of the profiled application Jclasslib in this example and the Jclasslib class file browser appears.
During the startup phase JProfiler immediately starts displaying live information in all its views. If you'd rather have static snapshots on demand, there are buttons for freezing all views and fetching data manually in the toolbar. To identify the bottlenecks in Jclasslib, we now select a very large method to display in the Jclasslib browser window: Before we select the method for display, we reset the CPU data in JProfiler to eliminate the profiling information collected during startup of Jclasslib.
We are interested in profiling the Jclasslib display action, not the Jclasslib startup. Displaying the javax. This is the inefficient action we want to look at for our example. We freeze all the views in JProfiler and start working on the analysis. First, we look at the performance problem. The key to finding out where all the time is spent is JProfiler's "Hot spots view". The top level entries are the most time consuming methods. We can see immediately that most of the time is spent in javax.
By expanding the top level nodes we get the backtraces showing the various ways the hot spot method was called. If you turn to a profiler with a problem in your application. For that case. Even though an application may prove to be "good enough" in test cases. The start center is composed of three tabs: Some bugs revolve around complex call stack scenarios have a look at the CPU section [p. With the reference views [p. The "Wait for connection" is recommended at first.
After you finish configuring your session. If a session is currently active upon opening a session. Only choose the other modes later on once you are familiar with JProfiler. Please follow the instructions presented by the wizard.
For technical reasons. The latter will also collect all files for the agent that are necessary to get the agent running on remote machines. The second step asks you whether the profiled application or application server is running on the local computer or on a remote machine. The subsequent steps depend on this choice. In the third step you choose the desired startup mode which is one of "Wait for connection". During the first step of the wizard you are asked to specify the product which is to be integrated.
A new main window of JProfiler will be opened. The [New remote integration] and [New applet integration] buttons are convenience shortcuts. The existing local session that is chosen for conversion will not be modified. It can be invoked in one of two ways: When you choose not to open a profiling session for an empty window and exit the start center by clicking the [Cancel] button.
To bring up the integration dialog. After completing the instructions. Select the desired IDE from the drop down list and click on [Integrate]. See here [p. The console integration wizard will create a config file that can be imported [p. If you miss support for a particular product.
If you don't have a key. You can enter your license key in one of two ways: The name of the config file is config. Everything you enter here can be changed at a later time through the menus of a running instance of JProfiler. JProfiler cannot be started. The setup wizard inquires about: JProfiler 5 does not work with license keys for lower versions. Please upgrade your license on our website.
This step can be used to migrate a JProfiler configuration to a different computer. By selecting the desired integration and clicking [Integrate] button you start the integration process.
If you have already obtained an evaluation key and were not able to evaluate JProfiler. Please read the included file license. To make it easier for you to enter the license key. Together with your license key. If a valid license key can be found in the clipboard content. Main toolbar with "Profile" button. After acknowledging the completion message. Now select the desired IDE from the drop down list. IDEA 4. If you are performing the installation from JProfiler's setup wizard [p. JProfiler can be invoked from within the IDE without any further need for session configuration.
All integrations insert toolbar buttons and menu entries into the respective IDE that run the application in the IDE with profiling enabled.
If JProfiler is not running. Depending on the run configuration type. To configure further settings. The screenshot below shows the startup settings for a local server configuration.
JProfiler is also started. For eclipse 3. The profiled application is then started just as with the usual "Run" commands. 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. In the following text.
If no instance of JProfiler is currently running. The eclipse 2. The integration wizard [p. Main toolbar with "JProfiler" button. A file selector will then prompt you to locate the installation directory of eclipse. Please close eclipse while performing the plugin installation. To profile your application from eclipse.
The installation of the eclipse plugin is started by selecting "eclipse 2. For WSAD. JProfiler immediately starts a new profiling session.
All profiling settings and view settings changes are persistent across session restarts. When you close the window. You will then be able to start it from the start center [p. Choose the desired configuration and press [OK]. If you answer with yes. JProfiler asks you if you want to save the session for standalone execution.
Otherwise the last used main window will accommodate the profiling session. JProfiler is started. When JProfiler is used with the eclipse integration. With this information. If JProfiler has already been opened from eclipse. The information contained in the launch configuration is transmitted to JProfiler.
JProfiler will show a collision message dialog at startup. This is to avoid a common Eclipse 3. To configure a native library path. Please close eclipse while performing the plugin installation.. Please go to the plugin directory in your eclipse installation and delete the plugins that are specified in the warning message in order to guarantee that JProfiler will be used when you click on one of the profiling actions.
Main eclipse toolbar with "Profile" button. The profile commands are equivalent to the debug and run commands in eclipse and are part of eclipse's infrastructure. The JProfiler integration does not work with partial installations of the eclipse framework. If another profiler has registered itself in eclipse. The installation of the eclipse plugin is started by selecting "eclipse 3.
When you upgrade to a newer version of JProfiler. For eclipse 2. The eclipse 3. The window policy can subsequently be configured in the JProfiler settings in eclipse see below. Every time a run configuration is profiled.
To get rid of this dialog. You can also open JProfiler snapshots from eclipse. This is the default setting. The way in which eclipse selects the profiler that's bound to the "Profile" buttons is undefined. With the corresponding checkbox. However there are a few important points to notice about the integration process as well as the usage of the plugin.
As it happens. Both these settings are trouble-shooting options and should normally not be selected. The installation directory must contain an eclipse directory.
To get rid of the collision message that is shown at startup. While eclipse does not ship with any profilers. Finding this file can be a little difficult. Activate this optimizer and then click [OK]. Please close JBuilder while performing the OpenTool installation. Please note that the quotes are part of the search and replace expressions.
JProfiler requires at least JBuilder 7. A file selection box will then prompt you to locate the installation directory of JBuilder. The Websphere integration wizard asks you to locate the server. Only launch configuration types that exist in eclipse 3. For these servers. If an optimizer type with the name "JProfiler" exists on this tab. This is necessary since otherwise RAD does not notice the above change.
If you remove JProfiler. The plugin cache will be rebuilt on the next startup of RAD. Main toolbar with "Optimize" button. Optimizer configuration dialog To profile your application from JBuilder. The window policy can subsequently be configured in the optimizer settings in JBuilder see below. When JProfiler is started from JBuilder. To profile your application from JDeveloper. Please close JDeveloper while performing the addin installation. A file selection box will then prompt you to locate the installation directory of JDeveloper.
JProfiler requires JDeveloper The window policy can subsequently be configured in the "JProfiler" node in the settings dialog of JDeveloper see below. When JProfiler is started from JDeveloper.
The Netbeans updater is then invoked and the module is installed. This is a version-specific directory under. Please close Netbeans while performing the module installation. Netbeans 5. For free form projects. JProfiler will add a target named "profile-jprofiler" to it with the same contents as the debug target and will try to modify the VM.
You can profile standard and free form projects in Netbeans. A single user installation is mostly of interest in network installations where the user cannot write to the Netbeans installation directory. You should now see a menu entry JProfiler top-level menu in Netbeans' main menu.
A file selection box will then prompt you to locate the installation directory of Netbeans. If you decide for a single user installation. Please make sure to stop the application server before trying to profile it. You can profile web applications with the integrated Tomcat or with any other Tomcat server configured in Netbeans.
If you have problems profiling a free form project. Please make sure to stop the Tomcat server before trying to profile it. To profile your application from Netbeans. When your main project is a web project. Main toolbar with "JProfiler" button "JProfiler" menu. When JProfiler is used with the Netbeans integration.
Explorer context menu with "JProfiler" action The profiled application is then started just as with the usual "Run" commands. You can also open JProfiler snapshots from Netbeans. Profiling sessions are closed by closing the corresponding tab. When a profiling session is started.
On that tab you can ask JProfiler to always use interpreted mode for profiling. The license key is automatically included in the subject of the e-mail. Allows you to enter your license key [p. Apart from telemetry data.
The session settings dialog is divided into 4 sections: If you use an IDE integration [p. When upgrading JProfiler. Sessions are edited. The actions are also executed during offline profiling [p.
CPU or memory profiling. With triggers. Defining appropriate filters will help you to reduce data overload and minimizing CPU profiling overhead. If you change filter. View settings on the other hand. Remote sessions are most convenient for profiling server applications on remote machines and application servers where you write classes which are loaded and invoked within the framework of the application server.
The application of the new profiling settings may take some time. Your application will be started in a separate terminal window.
The profiling agent listens on the default port of which can be changed in the agent's initialization parameters. Local sessions are most convenient for profiling GUI and console applications where you have written the main class yourself. It is also used for the title of the main window and the terminal window.
When profiling settings are updated. Depending on this choice. If you profile a pre If the applet viewer is too restrictive for your applet. You have to specify the virtual machine.
Next to the name text field you see an ID which is used for choosing the session in offline profiling [p. JProfiler brings up a directory chooser and asks for the root directory against which relative paths should be interpreted. The source path is is used by the source code viewer [p. If no new path entry could be found.
When clicking the add button you can select multiple path entries to the path list in one go from the file chooser. All subsequent relative paths will be interpreted against this root directory. The class path is also used by the bytecode viewer [p. The name of the native library envrironment variable depends on the operating system. JProfiler will only add unique path entries into the list.
You only have to specify the native library path when you load native libraries by calling java. Note that the sources of the selected JDK contained in src. Adjusting the class and source path during an active session is effective for the source code and bytecode viewer [p. Please set the browser start command [p.
As long as you have not selected a particular directory. A dialog box will ask you whether to add the associated class path root directory to the class path. Arguments that contain spaces must be surrounded with double quotes like "a parameter with spaces".
If you enter a main class. Clicking on the [. If this is your local computer JProfiler polls this URL until it becomes available. If the applet view is too restrictive for your applet. The application server integration wizard uses start commands to make it easy to profile application servers. In this case JProfiler has full control over the life cycle of the profiled application.
This default can be restored by clicking the [Default] button on the right side of the text field.. AppletViewer from the tools. If the terminal window is closed. If you have not supplied a port parameter [p. The application server integration wizard uses stop commands where possible. JProfiler will execute this command when disconnecting from the remote application. The [config synchronization options] button brings up the config synchronization options dialog [p.
By clicking on the [. The main class sun. 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.
Choose the port on which the remote profiling agent is listening. If the first filter is inclusive.. One exception where the filters configured in this section will not be used is if the "Disable all filters for sampling" setting is activated on the method call recording [p. There are two types of filter rules: For background information on filters. If the first filter is exclusive. All calls from profiled classes are shown in the call tree regardless of whether the called class is profiled or not.
The filter settings section is grouped into several tabs: MyClass calls a method in java core classes. Just select all filters that you wish to group and select the appropriate action from the context menu. Filter rules are evaluated from top to bottom.
Whenever you find that the default list is not suitable. To add a new filter rule to an existing filter group. All current filter settings will be lost in that case. Filter rules in filter groups are sorted alphabetically. The name of a filter group is only informational. All other classes are included.
If the first node in the tree is an "all other packages" inclusive node. Filter configurations can be saved to filter templates [p. You are then prompted to name the group.
Package filters include all sub-packages. The context menu also offers an action to ungroup selected groups. To analyze the overall filter configuration. This dialog can be shown by clicking [Show filter tree] on the Define Filters [p. On the session defaults [p.
Adjacent filter rules of the same type can be grouped together. 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. In the call tree view [p. When you register a method for exceptional method recording.
If many other method runs are slower later on. Exceptional methods can be used to investigate outliers in the performance of selected methods. After the invocation completes. In the call tree view. If the first filter rule on the Define Filters [p.
The number of separately retained invocations can be configured in the profiling settings [p. For any call stack. Please note that this is a read-only representation of the filter configuration. For the concerned method nodes.
By definition. Exceptional method runs are displayed differently in the call tree view [p. The filter template dialog can also be invoked from the session defaults [p.
The filter template dialog allows you to reorder. When saving a filter template. Note that the thread status selection in the CPU views [p. The other invocations will be merged into a single method node as usual. The "current exceptional run" shows the separately maintained tree for the current invocation. For defining filter rules. When discriminating slow method invocations. If the first filter rule is inclusive.
To alleviate the problem with dynamic instrumentation. You can click on that status bar entry to review the detected overhead hot spots and choose to accept them into the list of ignored methods. Finally you have to select a method from the selected class. To check the statistical properties of the distribution of call times of certain methods of interest.
An example is the method of an XML parser that reads the next character. 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. Apart from removing previously configured exceptional methods. This method returns very quickly.
There may be classes in the classpath that have not been loaded. If the method call recording type [p. After the selection you will be asked whether to expand the classpath with the current selection. JProfiler has a mechanism called auto-tuning. The following ways for selecting methods are available: This creates some overhead which is significant for methods that have very short execution times.
The JNI format of the method signature is explained in the javadoc of com. If the selection is a JRE file. Those classes will not be shown in the class chooser. The same context action is available in the call tree view [p.
These ignored methods will then not be instrumented. This problem is not present when the method call recording type [p. In the status bar. If such methods are called very frequently. The context menu for the list of methods offers the option to edit existing entries.
For remote sessions. When a session is terminated. You can save new profiling settings templates with the [Save as template] button. The profiling settings template dialog [p. As different templates in the drop down list are selected. Please see the detailed discussion in the help topic on profiling settings [p. If you customize the profiling settings. If you find later on. All ignored methods will be missing in the call tree.
In case that you do not want to see messages about auto-tuning. You can also add ignored methods directly on this tab of the filter settings. Both description and performance indicators should help you choose the best template for your task at hand. The profiling settings dialog is grouped into several tabs: The profiling settings section displays a list of pre-configured profiling settings templates that are targeted at a variety of situations. If you click on the [Customize profiling settings] button below the drop down list.
Their execution time will be added to the inherent time of the calling method. Java core classes java. JProfiler modifies filtered classes on the fly as they are loaded by the JVM to include profiling hooks.
Other settings. To temporarily switch off all filters. Only methods that take longer than the sampling period or methods called frequently are captured by sampling. Accuracy of non-timing related stack information like allocation information is high.
The overhead and timing accuracy varies depending on what classes are instrumented. You might want to record allocations without the overhead of recording the allocation call stacks: If you don't need the allocation view [p. View settings are persistent as well and are saved automatically for each session.
These settings affect all memory views. JProfiler inspects the call stacks of all threads periodically. These settings affect CPU views only. These settings affect all views in the thread section. JProfiler collects information about the call tree. Sampling is ideally suited for use without any method call filters. The following options are available: Configure method call recording options for the session.
Sampling has extremely low overhead even without any filters. This will speed up profiling considerably and reduce memory usage. These settings affect CPU views and memory views with allocation information. These settings influence the detail level of CPU profiling data and the profiling overhead. Accuracy of non-timing related stack information like allocation information is low and invocation counts are not available.
They only apply to the views in the CPU view section [p. If sampling is enabled. A lower sampling frequency incurs a slightly higher CPU overhead when profiling. The default value is 5 ms. If the aggregation level is set to "methods" and a method calls another method multiple times in different lines of code. If you enable show line numbers for sampling and dynamic instrumentation. Backtraces in the hotspot views will also show line numbers.
Note that if the thread state selector [p. 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.