YourKit Java Profiler

JProfiler is a leading Java profiler in the market. It is a favorable choice for many. Award winning, fully featured low overhead profiler for Java EE and Java SE platforms. Download Buy and Upgrade. YourKit Java Profiler 2021.3 released.

Yourkit Java Profiler Software YourKit Java Profiler v.7.5.3 YourKit has developed a revolutionary approach to profiling applications at both development and production stages, bringing unparalleled benefits to professional Java developers on all platforms, including.

Profiler

How do I configure YourKit Java profiler to work with CQ3.x or CQ4.x?

  1. Download the YourKit agent for your OS (see the links at the bottom of the page).

  2. Dvdfab 12.0.2.3 key. Start the YourKit profiler (JDK 1.5 is necessary to run the profiler).

    • Windows: Launch 'YourKit Java Profiler' from in the Start menu.
    • Linux, Solaris: Run YourKit Java Profiler Home > /bin/yjp.sh.
    • Mac OS X: When the downloaded application is unzipped, click its icon.

It's possible to enable profiling directly in an IDE or even J2EE server. However, it can be better to enable profiling manually to be independent of IDE or J2EE servers. The procedure differs from OS to OS.

OSAction
Windows, 32-bit Javaadd <!YourKit Java Profiler Home>binwin32 to the PATH
Windows, 64-bit Javaadd <!YourKit Java Profiler Home>binwin-amd64 to the PATH
Mac OS Xadd <!YourKit Java Profiler Home>/bin/mac to the DYLD_LIBRARY_PATH
Linux x86, 32-bit Javaadd <!YourKit Java Profiler Home>/bin/linux-x86-32 to the LD_LIBRARY_PATH
Linux AMD64, 64-bit Javaadd <!YourKit Java Profiler Home>/bin/linux-amd64 to the LD_LIBRARY_PATH
Solaris SPARC, 32-bit Javaadd <!YourKit Java Profiler Home>/bin/solaris-sparc-32 to the LD_LIBRARY_PATH
Solaris SPARC, 64-bit Javaadd <!YourKit Java Profiler Home>/bin/solaris-sparc-64 to the LD_LIBRARY_PATH
Solaris x86, 32-bit Javaadd <!YourKit Java Profiler Home>/bin/solaris-x86-32 to the LD_LIBRARY_PATH
Solaris x86, 64-bit Java (AMD64)add <!YourKit Java Profiler Home>/bin/solaris-x86-64 to the LD_LIBRARY_PATH

To check that Java can load the profiler agent, you can call the following command that prints a description of agent parameters:

Yourkit Download

  • Java 5 or 6
    • java -agentlib:yjpagent=help
  • Java 1.3 or 1.4
    • java -Xrunyjpagent:help

To be able to profile a Java application, it is necessary to provide the YourKit tool an interface to the Java application. You integrate the YourKit agent library into the JVM where the target application you want to profile is running. First, enable profiling by providing the path to the respective OS agent library where the JVM is running on (see Enabling Profiling). Include setting environment variables in the start-script of your application.

For example, in a CQ start script under Linux, do the following:

#--------------------------------------------------------------------- # enables the YourKit Java Profiler #--------------------------------------------------------------------- YJP_HOME='/home/honwai/yjp-6.0.16/bin/linux-x86-32' export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$YJP_HOME

Jconsole Vs Visualvm

This setting makes the agent library available to the JVM. Now it is a matter of telling the JVM to actually integrate this library, which differs according to the JVM version in use:

Java VersionJVM Option
1.3/1.4java -Xrunyjpagent
5 or newerjava -agentlib:yjpagent

Yourkit Java Profiler Tutorial

Now you're ready to start your application and the actual profiling. The agent library prints some information to the standard output (in case of CQ it is server(logs/startup.log):

[YourKit Java Profiler 6.0.16] Using JVMPI (Linux; 32 bit JVM)

[YourKit Java Profiler 6.0.16] *** HINT ***: Use Java 5 (or newer) when possible!

[YourKit Java Profiler 6.0.16] Profiler agent is listening on port 10001..

Hint: In CQ 4.2, the serverctl script has become more advanced, allowing for providing various options on startup. It includes the option to start the JVM with the YourKit agent library. Setting the above described env variables is still mandatory, but setting the additional JVM option is not:

linuxbox:/opt/day/cq-4.2/server# ./start --profile

To get a complete list of the available options, type ./serverctl and you get a list of all available options.

When starting an application with profiling enabled, the agent library chooses a free port that is available on the system. It is not necessary to know the port. The YourKit tool can automatically connect to a running profiled application, either locally or remotely. If it finds more than one application, you are prompted to select a particular one.

It is also possible to specify a dedicated port if local security settings (for example, firewall) don't allow for arbitrary ports to be chosen. See the following table for a complete list of options that can be passed to the agent library.

OptionDescription
disablealloc(Java 5 and newer / JVMTI only) Don't instrument bytecode with instructions needed for object allocation recording.
disablecounts(Java 5 and newer / JVMTI only) Don't instrument bytecode with instructions needed for CPU tracing. Only CPU sampling is available.
disablej2ee(Java 5 and newer / JVMTI only) Don't instrument bytecode with instructions needed for J2EE profiling.
samplingLaunch Java application with CPU sampling turned on. You do not have to profile CPU right from the start. Instead, in many cases you'd better start or stop the measuring later from the user interface or using Profiler API.
tracingLaunch Java application with CPU tracing turned on. You do not have to profile CPU right from the start. Instead, in many cases, you'd better start or stop the measuring later from the user interface or using Profiler API. This option cannot be used in combination with 'disablecounts'.
noj2eeDon't perform J2EE high-level profiling. This option only affects CPU profiling started with 'sampling' or 'tracing'.
allocLaunch Java application with started object allocation recording. All objects are recorded. You do not have to record allocations right from the start; instead, you can start or stop recording later from the Profiler or using Profiler API. This option cannot be used in combination with 'disablealloc'.
allocadaptiveLaunch Java application with started object allocation recording. As many objects as possible are recorded, keeping overhead at moderate level. You do not have to record allocations right from the start; instead, you can start or stop recording later from the Profiler or using Profiler API. This option cannot be used in combination with 'disablealloc'.
usedmem=<percent>Automatically capture memory snapshot when used heap memory reaches the threshold.
onexit=memoryAlways capture memory snapshot on exit. CPU snapshot iscaptured automatically if CPU profiling is enabled when the profiled application exits.
onexit=telemetryCapture telemetry snapshot on exit. This option is automatically used when the profiled application is started from the IDE.
port=<value>Specify port that the profiler agent listens on for communication with the Profiler. By default any free port is chosen.
onlylocalAllow only local connections to profiled application
dir=<directory for='for' snapshots='snapshots'>Specify directory where snapshots are created. By default, <user home='home'>/Snapshots directory is used.
quietSuppress diagnostics messages that the profiler agent prints to the console.
helpPrint short description of agent parameters.

Separate multiple options with commas. Pay attention that Java requires : after -Xrunyjpagent but = after -agentlib:yjpagent.

Tutorial

Examples (Java 5 or newer):

Jdk Profiler

java -agentlib:yjpagent FooClass java -agentlib:yjpagent=onexit=memory,dir=c:MySnapshots FooClass java -agentlib:yjpagent=usedmem=70 FooClass

Yourkit Java Profiler Intellij

Examples (Java 1.3/1.4):

Profiler

java -Xrunyjpagent FooClass java -Xrunyjpagent:onexit=memory,dir=c:MySnapshots FooClass java -Xrunyjpagent:usedmem=70 FooClass

Once the YourKit profiler is installed, there's extensive HTML documentation in the installation directory, in <!YourKit Java Profiler Home>/docs/help/index.html. It explains in detail how to integrate the agent library on the target application that is the subject of profiling. It also provides many useful options that can be passed to the agent. For example:

  • generate a heap-dump once the application exits
  • generate a heap-dump once a certain threshold is reached

These options can be found in <!YourKit Java Profiler Home>/docs/help/agent.html.

The current 7.0 release doesn't come with documentation, you can find it on our setup server:

  • setupinstallprofilingyjp-6.0docshelpindex.html

更多此类内容

Yourkit Java Profiler 2020.9

Join the DZone community and get the full member experience.

Join For Free
YourKit, LLC is glad to announce immediate availability of YourKit Java Profiler 9.5
It can be downloaded at http://www.yourkit.com/download/
MOST NOTABLE CHANGES AND NEW FEATURES:
NEW FEATURE: ATTACH MODE:
- Ability to profile Java applications started without the profiler agent
MEMORY PROFILING:
- Choose in UI objects of which reachability scope (strong/weak/soft/finalizer) to analyse
- New inspection 'Objects with biggest distance to nearest GC root'
helps finding longest chains of objects such as linked lists, queues, trees etc.
- New inspection 'HashMap hash code distribution'
helps finding maps with bad performance due to hash collisions
- New inspection 'Duplicate Arrays' finds potential memory waste
- Ability to capture HPROF snapshots for JRockit R28.0.0 and newer
- HPROF snapshots: thread stacks at the moment of snapshot capture are shown in 'Threads' tab
- HPROF snapshots: compressed pointer mode supported (-XX:+UseCompressedOops)
- HPROF snapshots: more accurate size calculation for some arrays
- First elements of primitive arrays are immediately shown in object explorers
- Default number of array elements shown in object explorer can be configured
- New action 'Memory Class Itself (java.lang.Class) by Name..' (Ctrl+Shift+C)
- Improved Garbage collection view
- Allocation views UI cleanup
- Quick info shows text presentation for char[] and java.lang.String in scrollable text area.
In particular, this allows to inspect long strings.
- Quick info allows to export entire string or primitive array to a file
- Quick info: text presentation is shown initially positioned at beginning of the text.
Also, long lines are wrapped.
CPU PROFILING:
- UI improvements
TELEMETRY:
- Threads view optionally shows all threads, only live threads or only finished threads
- UI improvements and bug fixes
PROBES:
- New built-in probe to monitors processes launched via Runtime.exec() and ProcessBuilder
- Improved performance and reduced garbage collector load
- Startup option 'noprobe' allows not to register particular built-in probe on startup
IDE INTEGRATION:
- Eclipse: Maven run configuration type supported
- NetBeans: Maven projects supported
- IntelliJ IDEA X (EAP) supported
- Eclipse: optional flat UI for the plugin settings
- Eclipse: ability to install the profiler plugin with limited internet access
USER INTERFACE:
- To save vertical space for other components, the help bar height was reduced.
Also, there is an option to hide the help bar and/or the status bar.
- 'Thread name' filter in 'Threads' tab (and similar filters in other views)
now optionally accepts full regular expression syntax
MISCELLANEOUS:
- Automatic deadlock detector now also supports ownable synchronizers
(java.util.concurrent.locks.*)
- Command line tool to control profiling: new commands clear-cpu-data, clear-alloc-data,
clear-monitor-data
- Solaris: profiler UI startup script yjp.sh automatically uses JDK 6 in standard location;
this means that on most machines it will run out of the box
- Offline Help is available
See complete list of changes at http://www.yourkit.com/changes/
Sincerely,
YourKit Team

Opinions expressed by DZone contributors are their own.

Popular on DZone