YourKit

From Informatics

Jump to: navigation, search

Contents

Eclipse Integration

  • Download and install YourKit. You can get it from here: http://www.yourkit.com/. If you are using linux (ubuntu), the eclipse location to point to is /usr/lib/eclipse.
  • After installing, start YourKit and select Tools->Integrate with IDE. Select your eclipse version and the location of your eclipse install (not your workspace).
  • See Desktop Integration below.

Tomcat Integration

  • Add the following as Tomcat JVM option: -agentpath:"c:\Program Files\YourKit Java Profiler 7.5.7\bin\win32\yjpagent.dll".
  • Start tomcat and on the YourKit welcome page, select Connect to locally running profiled application.

Desktop Integration

You can profile your application by creating a "Profile configuration" form within eclipse (similar to how you create "Run" and "Debug" configurations).

Interpreting Results

YourKit provides the user with lots of information. Here is some basic information, but the user is encouraged to look at the YourKit documentation for an in depth view of the features. The online docs can be found here: YourKit Help.

Once the application starts, the YourKit window pops up along with the application. This window shows vertical tabs on the left hand side (each tab represents the application you are profiling) and horizontal tabs across the top (each tab represents a different type of profiling).

Both CPU and memory views have its 'live view' and 'snapshot' view. While they look similar, shapshot has more features. For example, CPU view has two views of call tree: 'all threads' and 'by thread'. 'by thread' view, which is very useful, is only available in snapshot, not in live view. Just be reminded that YourKit help pages do not specify live view or snapshot on each page.

CPU

When you start CPU profiling, you can choose 'sampling' or 'tracing'. Tracing provides more details, e.g. invocation count, but has more overhead.

Time consumed by a method is presented as 'Time' and 'Own Time' besides other fields. The difference is: 'Time' includes the time used by all subcalls; 'Own Time' excludes the time used by subcalls.

Memory

Heap Memory

  • Limit - The max value here is the -Xmx value given to geworkbench. For example, in the geworkbench run configuration in eclipse, if this is -Xmx500M, this is the max value you will see here.

Non Heap Memory

This is additional to the heap memory, and holds the reflective data such as class objects and method objects. It also holds dynamically generated classes, like the ones generated from JSPs (so this may be more useful for webapps, or when doing things like Class.forName("org.acme.foo.Foo").newInstance.

  • Allocated - This will be 100M if you set -XX:PermSize=100M in the geworkbench run configuration.
  • Limit - This will be 300M if you set -XX:MaxPermSize=300M in the geworkbench run configuration.

For the above example, the full VM args for geworkbench would look like:

-Xmx700M -XX:PermSize=100M -XX:MaxPermSize=300M

Memory telemetry has two parts in it display: on the top is the memory usage along the time; on the bottom we have a class list. This class list is a easy-to-use but very powerful tool to look into memory use. It shows the memory used by each class. Shallow size is shown live. Retained size, i.e. an object's own shallow size plus the shallow sizes of the objects that are accessible from it, can be calculated by YourKit as well from saved snapshot.

Snapshot can be taken by clicking on the snapshot button during the session. (I don't see how to name the file, so I have to accept the automatic name of the snapshot file for now.) In a snapshot, the same type of information as we see in live session is available. You compare one snapshot with another one from YourKit file menu.

There three choices of snapshot. The default is YourKit format and it seems working well.

Garbage Collection

'Garbage Collection' view is for profiling issues like excessive GC, which usually is caused by unnecessary creation of a large number of temporary objects.

Monitor Usage

Threads and Deadlocks

Summary

Personal tools