Intel® VTune™ Amplifier XE and Intel® VTune™ Amplifier for Systems Help

Locks and Waits Analysis

While Concurrency analysis helps identify where your application is not parallel, Locks and Waits analysis helps identify the cause of ineffective processor utilization. One of the most common problems is threads waiting too long on synchronization objects (locks). Performance suffers when waits occur while cores are under-utilized.

Locks and Waits analysis uses user-mode sampling and tracing collection. With this analysis you can estimate the impact each synchronization object has on the application and understand how long the application had to wait on each synchronization object, or in blocking APIs, such as sleep and blocking I/O.

There are two groups of synchronization objects supported by the Intel® VTune™ Amplifier:

To use the Locks and Waits analysis, explore:

Configuration Options

To configure options for the Locks and Waits analysis:

  1. Click the New Analysis button on the Intel® VTune™ Amplifier toolbar.

    The New Amplifier Result tab opens with the Analysis Type window active.

  2. Select the Algorithm Analysis > Locks and Waits analysis type from the analysis tree on the left pane.

    The Locks and Waits pane opens on the right.

  3. Configure the following options:

CPU sampling interval, ms spin box

Specify an interval (in milliseconds) between CPU samples.

Possible values - 1-1000.

The default value is 10.

Analyze user tasks, events, and counters check box

Analyze the tasks, events, and counters specified in your code via the ITT API. This option causes a higher overhead and increases the result size.

The default value is false.

Analyze Intel runtimes and user synchronization check box

Analyze thread synchronization by profiling User synchronization API used by Intel runtimes like OpenMP and Intel TBB or by user. This option causes higher overhead and increases result size.

The default value is false.

Details button

Expand/collapse a section listing the default non-editable settings used for this analysis type. If you want to modify these settings for the analysis, you need to create a custom configuration by right-clicking the analysis entry in the analysis tree and selecting Copy from Current from the context menu. VTune Amplifier creates an editable copy of this analysis type configuration and locates it under the Custom Analysis branch in the analysis tree.

Note

You may generate the command line for this configuration using the Command Line... button at the bottom.

Viewpoints

You can choose to view Locks and Waits analysis results in any of the following viewpoints:

Viewpoint

Description

Hotspots

Helps identify hotspots - code regions in the application that consume a lot of CPU time.

Hotspots by CPU Usage

Helps identify hotspots - code regions in the application that consume a lot of CPU time. CPU time is broken down into CPU usage states: idle, poor, fair, and good.

Hotspots by Thread Concurrency

Helps identify hotspots - code regions in the application that consume a lot of CPU time. CPU time is broken down into thread concurrency states: idle, poor, fair, good, and over.

Locks and Waits

Shows how your application is utilizing available CPU cores and helps identify the cause of ineffective utilization, for example: threads waiting too long on synchronization objects (locks), I/O, or timers while CPU cores are underutilized. CPU time is represented by bars colored according to the CPU utilization level during the wait.

By default, the VTune Amplifier displays the results of Locks and Waits analysis in the Locks and Waits viewpoint where:

What's Next

Identify the objects that caused contention and go to the source code to fix the problem. Concentrate your tuning on objects with long Wait time where the system is poorly utilized (red bars) during the wait. Consider adding parallelism, rebalancing, or reducing contention. Ideal utilization (green bars) occurs when the number of running threads equals the number of available cores.

After modifying your code, run the comparison analysis to identify the performance boost you gain and more possible areas for improvement.

See Also