SourceForge.net Logo
Home

JLM - Java Lock Monitor

General Description

JLM provides monitor hold time accounting and contention statistics on monitors used in Java applications and the JVM itself. Functionality provided includes:


Time and time units

Time (as in hold time) is accounted for in units of cycles on all xSeries and zSeries platforms and in Time Base ticks for pSeries platforms.


Supported Java Versions and Platforms

JLM is shipped as part of the IBM Runtime Environment, v1.4.0 and above.


Usage Instructions

The best way to describe how to use JLM is via an example. The following assumptions are made:

Our example executes a Java application, called "HelloWorld".

  1. Start the Java application with the required command options
  2. Start rtdriver
  3. To start collecting JLM data enter one of the following commands at the rtdriver command prompt:
        jlmstart (collect counters and monitor hold times), or
        jlmlitestart (collect counters only)
  4. To dump JLM data enter jlmdump at the rtdriver command prompt.

    JLM dump files are named log-jlm.#_pppp where # is a sequence number, starting with 1 (one) for the first jlmdump and incrementing by one for each subsequent jlmdump, and pppp is the PID (process id) of the Java process. The files are located in the Java current working directory (i.e. the directory from where Java was started).

  5. To stop (turn off) JLM data collection enter jlmstop at the rtdriver command prompt.


JLM Reported Statistics Description

The following descriptions refer to this sample JLM output produced by JProf:
   JLM_Interval_Time 28503135251


  System (Registered) Monitors

 %MISS   GETS NONREC   SLOW    REC TIER2 TIER3 %UTIL AVER-HTM  MON-NAME
    11     91     91     10      0     0     0     1  4550728  JITC Global_Compile lock
     0   2466   2217      0    249     0     0     0     1780  Thread queue lock
     0    752    751      0      1     0     0     0    11160  Binclass lock
     0    701    695      0      6     0     0     0    71449  JITC CHA lock
     0    286    286      0      0     0     0     0   408679  Classloader lock
     0    131    131      0      0     0     0     0    26877  Heap lock
     0     61     61      0      0     0     0     0     2188  Sleep lock
     0     51     50      0      1     0     0     0      718  Monitor Cache lock
     0      7      7      0      0     0     0     0      608  JNI Global Reference lock
     0      5      5      0      0     0     0     0      780  Monitor Registry lock
     0      0      0      0      0     0     0     0        0  Heap Promotion lock
     0      0      0      0      0     0     0     0        0  Evacuation Region lock
     0      0      0      0      0     0     0     0        0  Method trace lock
     0      0      0      0      0     0     0     0        0  JNI Pinning lock

  Java (Inflated) Monitors

 %MISS   GETS NONREC   SLOW    REC TIER2 TIER3 %UTIL AVER-HTM  MON-NAME
    33      3      3      1      0     0     0     0     8155  java.lang.Class@7E8EF8/7E8F00
    33      3      3      1      0     0     0     0     8441  java.lang.Class@7E8838/7E8840
     0 3314714 3314714    809      0     0     0     3      278  testobject@104D3150/104D3158
     0 3580384 3580384    792      0     0     0     4      281  testobject@104D3160/104D3168
     0      1      1      0      0     0     0     0      735  java.lang.ref.ReferenceQueue$Lock@101BDE50/101BDE58
     0      1      1      0      0     0     0     0      833  java.lang.ref.Reference$Lock@101BE118/101BE120

 LEGEND:
                %MISS : 100 * SLOW / NONREC
                 GETS : Lock Entries
               NONREC : Non Recursive Gets
                 SLOW : Non Recursives that Wait
                  REC : Recursive Gets
                TIER2 : SMP: Total try-enter spin loop cnt (middle for 3 tier)
                TIER3 : SMP: Total yield spin loop cnt (outer for 3 tier)
                %UTIL : 100 * Hold-Time / Total-Time
              AVER-HT : Hold-Time / NONREC

Example of contention on one monitor

KEY:
         - work (thread is busy)
         | request lock
         > lock ownership granted
         ~ thread holds lock
         < thread releases lock
         * thread waiting to be granted ownership
Thread 1:   -----|>~~~~~~~~~~~~~~~~~~~~~~~~~~~<-----------------------------
Thread 2:   ------------|**********************>~~~~~~~~~~~~<---------------
Thread 3:   ------------------|******************************>~~~~~~<-------
Thread 4:   ----------------------|**********************************>~~~<--
       Hold time: |<------------------------->|
       Thread 1
                                               |<---------->|               Thread 2
                                                             |<---->|       Thread 3
                                                                     |<->|  Thread 4


Background

A monitor can be acquired in one of two ways:


Fields in the report



Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
IBM is a trademark of International Business Machines Corporation in the United States, other countries, or both
Other company, product or service names may be trademarks or service marks of others.
MMX, Pentium, and ProShare are trademarks or registered trademarks of Intel Corporation in the United States, other countries, or both.

Home