Visible to Intel only — GUID: GUID-4D83FDF6-AD8C-478C-BE00-B7527EA3A897
Visible to Intel only — GUID: GUID-4D83FDF6-AD8C-478C-BE00-B7527EA3A897
Hotspots Analysis for CPU Usage Issues
Use the Hotspots analysis to understand an application flow. Identify code regions that take up a majority of the execution time. This is a starting point for your algorithm analysis.
The Hotspots analysis has two sampling-based collection modes:
User-mode sampling, which incurs higher overhead but does not require sampling drivers for collection.
Hardware event-based sampling, which provides minimum collection overhead but needs sampling drivers or Perf* to be installed.
How It Works: User-Mode Sampling
VTune Profiler uses a low overhead (about 5%) user-mode sampling and tracing collection that gets you the information you need without slowing down application execution significantly. The data collector
- Profiles your application using the OS timer.
- Interrupts a process.
- Collects samples of all active instruction addresses with the sampling interval of 10ms.
- Captures a call sequence (stack) for each sample.
In the user-mode sampling, the collector does not gather system-wide performance data but focuses on your application only. To analyze system performance, use the hardware event-based sampling mode.
VTune Profiler displays a list of functions in your application. By default, this list is ordered by the amount of time spent in each function but you can choose to sort by module, thread, or process as well. You can also see call stacks for each of these functions to understand how the hot functions are called.
A large number of samples collected at a specific process, thread, or module can imply high processor utilization and potential performance bottlenecks. Some hot spots can be removed. Other hot spots are fundamental to the functionality of the application and cannot be removed.
How It Works: Hardware Event-Based Sampling
The hardware event-based sampling mode is based on the hardware event-based sampling collection and analyzes all the processes running on your system at the moment, providing CPU time data on whole system performance. VTune Profiler creates a list of functions in your application ordered by the amount of time spent in each function. By default, the Hotspots analysis in the hardware event-based sampling mode does not capture the function call stacks as the hotspots are collected. But you still can analyze stacks for your application modules by selecting the Collect stacks option explicitly.
If you cannot run the hardware event-based sampling with stacks, disable the Collect stacks option and run the collection. To correlate the obtained hardware event-based sampling data with stacks, run a separate Hotspots analysis in the User-Mode Sampling mode.
Configure and Run Analysis
To configure and run the Hotspots analysis:
Prerequisites: Create a project.
Click the (standalone GUI)/ (Visual Studio IDE) Configure Analysis button on the VTune Profiler welcome screen.
In the HOW pane, select the Hotspots analysis from the Analysis Tree.
Configure the following options:
User-Mode Sampling mode
Select to enable the user-mode sampling and tracing collection for hot spots and call stack analysis (formerly known as Basic Hotspots). This collection mode uses a fixed sampling interval of 10ms. If you need to change the interval, click the Copy button and create a custom analysis configuration.
Hardware Event-Based Sampling mode
Select to enable hardware event-based sampling collection for Hotspots analysis (formerly known as Advanced Hotspots).
You can configure the following options for this collection mode:
CPU sampling interval, ms to specify an interval (in milliseconds) between CPU samples. Possible values for thehardware event-based sampling mode are 0.01-1000. 1 ms is used by default.
Collect stacks to enable advanced collection of call stacks and thread context switches.
NOTE:When changing collection options, pay attention to the Overhead diagram on the right. It dynamically changes to reflect the collection overhead incurred by the selected options.
Show additional performance insights check box
Get additional performance insights, such as vectorization, and learn next steps. This option collects additional CPU events, which may enable the multiplexing mode.
The option is enabled by default.
Details button
Expand/collapse a section listing the default non-editable settings used for this analysis type. If you want to modify or enable additional settings for the analysis, you need to create a custom configuration by copying an existing predefined configuration. VTune Profiler creates an editable copy of this analysis type configuration.
Click the Start button to run the analysis.
To generate the command line for this configuration, click the Command Line... button at the bottom.
View Data
When the data is collected, VTune Profiler opens it in the Hotspots by CPU Utilization viewpoint providing the following views for analysis:
Summary window displays statistics on the overall application execution to analyze 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).
What's Next
Identify the most time-consuming function in the grid and double-click it for source analysis.
Analyze the source of the critical function starting with the highlighted hottest code line and moving further with the Hotspot Navigation options.
Modify your code to remove bottlenecks and improve the performance of your application.
Re-run the analysis and verify your optimization with the comparison mode.
Fix vectorization and get code-specific recommendations with the Vectorization and Code Insights perspective in Intel® Advisor.
For further steps, explore the Insights section provided in the Summary window. This section contains information on your target performance against metrics collected in addition to standard hotspots metrics. If there are any performance issues detected, the VTune Profiler flags such a metric value and provides an insight on potential next steps to fix the problem.
Information provided by Hotspots analysis is important for tuning serial applications as well as the serial sections of parallel applications. The Hotspots analysis data helps you understand what your application is doing and identify the code that is critical to tune. For parallel applications running on multi-core systems, consider running the Threading or HPC Performance Characterization analyses in addition..