Profiling Locks

This page describes the Locks profiling mode.


When running in Locks mode (see First Profiling Session for details on starting a profiling session) the profiler collects lock contention data. The profiling session is started by simply clicking the Profile or Attach button in toolbar. The other toolbar buttons are described in the Toolbar Buttons section.

Toolbar Buttons

  • View by dropdown controls aggregation of data in the results table: Threads mode displays the data by threads, Monitors mode displays the data by locks.
  • Take thread dump action takes snapshot of all threads in the profiled JVM including their call stacks and displays it in a separate view. See the Thread Dump chapter for details.
  • Take heap dump action saves a snapshot of all objects currently stored in the heap memory in a .hprof format and optionally opens it in a heap viewer. See the Heap Dump chapter for details.
  • Request garbage collection action requests garbage collection in the profiled JVM. There's no guarantee when or if at all the garbage collection will be performed. To make sure GC will be run, the action should be invoked several times.

Locks View

The locks view displays threads and locks of the profiled process and their relation (thread T has been blocked by lock L owned by another thread X) and information about time spent by waiting and number of waits to acquire a lock. The view provides the following data columns:

  • Locks and Threads column shows name of a lock or thread or their relation - held, was blocked by, blocked or owned by.
  • Time column shows total time spent by waiting to acquire the lock.
  • Waits column shows number of waits to acquire the lock.

Tip: The columns can be displayed or hidden using the right corner button in the view header by clicking the dropdown arrow (or right clicking the header on Mac OS X). The relative value bar can be displayed or hidden for every column which displays a relative value by resizing the column.

Searching Results

A lock or thread can be found in results using the Find stripe which opens by invoking the Find action in results context menu or IDE Edit menu or using the Ctrl+F keyboard shortcut. Values of the Locks and Threads column are searched for the entered substring, optionally matching case if selected. Once a search has been performed, it can be repeated using the F3 or Shift+F3 shortcuts.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo