Please enable JavaScript to view this site.

Thread Validator Help

The All Locks tab displays information about all critical sections, and WaitForXXXObject calls in the application being monitored.

 

interactiveRead on, or click a part of the image below to jump straight to the help for that area.

 

lock-tab

 

 

The Locks View

 

The Locks view shows information about each critical section used by the target application.

 

Each critical section is shown once and the display can be sorted by different criteria by clicking on the appropriate column header.

 

The table highlights error and status conditions using the user defined lock colours. In the example above, red col-deadlock indicates a deadlock, yellow col-contended contention and cyan col-recursion recursion.

 

Lines highlighted in grey denote an active status, meaning that the critical section has been entered, while the white lines show sections where nothing of interest has happened yet.

 

 

What data is available?

 

The following table lists all the available columns of data:

 

Attribute

Description

 

Address

Address of the critical section, the handle for a WaitForSingleObject call, or the number of handles for a WaitForMultipleObjects call.

 

Lock

Number of times the critical section has been locked by any thread.

 

Recursion

Number of times the critical section has been re-entered whilst locked by the current thread.

 

Contention

Number of attempts a thread has made to acquire the critical section but has had to wait because it is owned by another thread.

 

Wait Time

Total time spent waiting by all threads to gain access to this critical section.

 

Sequence

The sequence id is an internal monotonic integer that is incremented for each synchronization object event. This integer allows you to identify the order in which events occurred.

 
Note that this can be misleading if the windows scheduler switches threads at the wrong time.

 

Thread

Thread id (in decimal notation) of the thread that currently owns the critical section.
A number in brackets is the number of other threads waiting to gain access.
 
If the thread has been given a name, it is displayed.

 

State

Current state of the thread, obtained by polling the operating system for data at regular intervals.
This information may not match the other data at all times, but it's very useful for identifying thread conditions when thread states don't change for long periods, e.g. long wait states and deadlocks.

 

Owning Module

One or more of the following values if available, shown in order of priority with most important first:

 

Symbol name (within 256 bytes of the critical section address) for the critical section

Filename and line number of the code location that acquired the lock, determined from the callstack (if  collected)

Filename and line number of the critical section

Name of the owning module, if the critical section is static data inside a module (DLL or EXE)

Data indicating dynamic memory or stack space

 

Some of these details can be optionally hidden using the Display options.

 

 

Percentage bars and markers

 

All the cells in the table that show timing or count data have a percentage bar indicating the item's value relative to the maximum value in the column.

 

locks-highlighted-cells

 

Not all bars are percentages. In the Sequence column, the markers indicate the relative position of the sequence id (see table above) with respect to the first sequence id and most recent sequence id.

 

lock-sequence-bars

 

 

Updating the display

 

Update Interval instructionStep automatically updates the display at your choice of interval, from 0.1 to 60 seconds

 

This should be set depending on the complexity of your application.

 

 note An update interval that is too short may mean Thread Validator spends too much time updating the display.

 

Refresh instructionStep updates the display - as does the refresh button on the Tools menu and toolbar

 

 

Sorting the data

 

You can sort the data in the table by clicking in the table header.

 
See what data is available for descriptions of each column.

 

note Note that while your application is executing, the sorted data is live. Sorting may not complete correctly as the data may change during the sort. Only when your program has finished executing is the sorted data guaranteed accurate.

 

 

Display settings

 

The Locks Settings dialog controls a small number of highlighting and display options.

 

Display... instructionStep show the Locks Settings dialog:

 

locks-settings-dialog

 

Highlighting settings:

 

Highlight active instructionStep initialised (entered) critical sections are shown in the active colour (grey col-entered by default)

 

Highlight contended instructionStep critical sections that have had to wait are shown in the contending colour (yellow col-contended )
 

Highlight recursion instructionStep re-entered critical sections are shown in the recursion colour (cyan col-recursion )

 

The next three display settings control the display of Module, Filename and Class in the Owning Module data column.

 

Other options include:

 

Reset instructionStep resets these values to their startup values (all checked)

 

Apply instructionStep apply the settings to the Locks view without closing the dialog

 

 

Locks menu optionsright_mouse_button

 

The following popup menu is available over the data area to add filters, examine more details or edit code.

 

Menu actions apply to the function for the row at the menu-click location.

 

locks-view-menu

 

 

right_mouse_buttonMenu options: Information about lock or wait

 

Information about lock/wait... instructionStep shows the relevant information dialog from those below, and depending on the type of item selected

 

These information dialogs do not block the application so you can show as many as you need, either from this tab or others, and leave them open to compare or investigate later.

 

thread-information-dialog

 

critical-section-information

 

waitforsingleobkect-information-dialog

 

 

 

 

right_mouse_buttonMenu options: Lock acquisition order

 

Lock Acquisition Order instructionStep shows the Locks and Waits in Sequence Order dialog

 

This dialog displays the order...

 

in which critical sections are locked and waited upon

 

that waits are entered into
 

in which threads sleep and are suspended

 

 

right_mouse_buttonMenu option: editing source code

 

Edit Source Code... instructionStep opens the default or preferred editor to edit the source code

 

 

right_mouse_buttonMenu options: creation callstack

 

Show Creation Callstack... instructionStep shows the Critical Section Callstack dialog for the creation of this item, i.e. the locked or waiting critical section and thread

 

 

right_mouse_buttonMenu options: contended / recursion callstack

 

The following menu item is only available over contended critical sections (highlighted in yellow col-contended by default)

 

Show contended callstacks... instructionStep shows the Contended Critical Sections dialog for this item

 

 contended-critical-sections-dialog

 

 This dialog can only be shown if the callstack information is still available. If not you'll hear a beep.

 

The following menu item is only available over recursing critical sections (highlighted in light blue col-recursion by default)

 

Show recursion callstacks... instructionStep shows the Recursing Critical Sections dialog for this item

 

 This dialog is very similar to the one for contentions, above.

 

 As above, this dialog can only be shown if the callstack information is still available. If not you'll hear a beep.

 

Show busy lock callstacks... instructionStep shows the busy Critical Sections dialog for this item

 

 This dialog is very similar to the one for contentions, above.

 

 As above, this dialog can only be shown if the callstack information is still available. If not you'll hear a beep.

 

Show slow lock callstacks... instructionStep shows the slow Critical Sections dialog for this item

 

 This dialog is very similar to the one for contentions, above.

 

 As above, this dialog can only be shown if the callstack information is still available. If not you'll hear a beep.

 

Show lock callstacks... instructionStep shows the Critical Sections dialog for this item

 

 This dialog is very similar to the one for contentions, above.

 

 As above, this dialog can only be shown if the callstack information is still available. If not you'll hear a beep.