Intel® VTune™ Amplifier
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 :
1) objects usually used for synchronization between threads, such as Mutex or Semaphore;
2) objects associated with waits on I/O operations, such as Stream.
To use the Locks and Waits analysis, explore:
Configuration options (knobs)
To configure options for the Locks and Waits analysis:
Click the
New Analysis button on the
Intel® VTune™ Amplifier
toolbar.
The New Amplifier Result tab opens with the Analysis Type window active.
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.
Configure the following options:
|
CPU sampling interval, ms spin box |
Specify an interval between CPU samples: a number (in milliseconds) between 1 and 1000. Default sampling interval is 10 ms. |
|
Analyze user tasks check box |
Analyze tasks on the certain tasks in your code specified via Task API. |
|
Analyze Intel runtimes and user synchronization check box |
Analyze thread synchronization by profiling User synchronization API used by Intel runtimes like OpenMP* and Intel® Threading Building Blocks (Intel TBB) or by the user. This option causes higher overhead and increases result size. |
|
Analyze GPU usage (Intel HD Graphics only) check box |
Analyze GPU usage and identify whether your application is GPU or CPU bound. |
|
Analyze Processor Graphics hardware events drop-down menu |
Enable to analyze performance data from Processor Graphics based on the predefined groups of GPU metrics. This option is available only for supported platforms with the Intel® graphics driver installed. |
|
Trace OpenCL and Intel Media SDK programs (Intel HD Graphics only) check box |
Capture the execution time of OpenCL™ kernels and Intel Media SDK programs on a GPU, identify performance-critical GPU tasks, and analyze the performance per GPU hardware metrics. NoteIntel Media SDK programs analysis is supported for Linux targets only. |
|
Details button |
Explore a section listing the default non-editable settings used for this analysis type. If you want to modify the settings for the Locks and Waits analysis, click the Copy button in the upper right corner of the configuration pane. VTune Amplifier creates an editable copy of the user-mode sampling and tracing configuration and locates it under the Custom Analysis branch in the analysis tree. |
You may generate the command line for this configuration using the Command Line... button at the bottom.
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:
Summary window displays statistics on the overall application execution, identifying CPU time and processor utilization.
Bottom-up window displays hotspot functions in the bottom-up tree, CPU time and CPU utilization per function.
Top-down Tree window displays hotspot functions in the call tree, performance metrics for a function only (Self value) and for a function and its children together (Total value).
Caller/Callee window displays parent and child functions of the selected focus function.
Platform window provides details on CPU and GPU utilization, frame rate, memory bandwidth, and user tasks (if corresponding metrics are collected).
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.