You identified the critical section that caused significant Wait time and poor processor utilization. Double-click this critical section in the Bottom-up pane to view the source. Intel® VTune™ Amplifier opens source and disassembly code. Focus on the Source pane and analyze the source code:
Understand Basic Source View Options
Source code of the application displayed if the function symbol information is available. When you go to the source by double-clicking the synchronization object in the Bottom-up pane, the VTune Amplifier opens the wait function containing this object. The source code in the Source pane is not editable.
If the function symbol information is not available, the Assembly pane opens displaying assembler instructions for the selected wait function. To view the source code in the Source pane, make sure to build the target properly.
Processor time and utilization bar attributed to a particular code line. The Self Time metric shows the time the application spent at this particular source line while the Total Time includes Self time of the function itself and Self time of all functions that were called from that function, if any.
The colored bar represents the distribution of the Wait time according to the utilization levels (Idle, Poor, Ok, Ideal, and Over) defined by the VTune Amplifier. The longer the bar, the higher the value. Ok utilization level is not available for systems with a small number of cores.
Source window toolbar. Use hotspot navigation buttons to switch between most performance-critical code lines. Hotspot navigation is based on the metric column selected as a Data of Interest. For the Locks and Waits viewpoint, this is Wait Time: Self by Utilization. Use the source file editor button to open and edit your code in your default editor.
Identify the Hottest Code Lines
Click the hotspot navigation button to go to the code line that took the most Wait time. VTune Amplifier highlights line 170 entering the critical section
rgb_critical_section in the
draw_task function. The
draw_task function was waiting for almost 27 seconds while this code line was executing and most of the time the processor was underutilized. During this time, the critical section was contended 438 times.
rgb_critical section is the place where the application is serializing. Each thread has to wait for the critical section to be available before it can proceed. Only one thread can be in the critical section at a time. You need to optimize the code to make it more concurrent. Click the Source Editor button on the Source window toolbar to open the code editor and optimize the code.