Learning Resources for Software Engineering Students »
Author: Ong Heng Le
A performance profiler is a tool which collects data (such as function timings) about your program to identify the areas with performance issues, commonly used in code optimization. There are two common types of performance profiling methods.
Learn which profiling method to use for your program when choosing between CPU sampling and instrumentation.
This article provides resources to help you identify the performance issues as you perform profiling on your program for the first time. The general steps in profiling a program for the first time are:
Most profilers are similar in their functionalities, user interface, and use of technical terms. You may adapt the tutorials in this article to your preferred profiling tools on your own project.
CPU sampling captures data at fixed intervals, usually based on CPU cycles or time. Many profilers offer the option to set a custom interval or perform sampling based on events, such as page faults or system calls, in the sampling settings.
Instrumentation profiling incurs a substantial overhead, which is an increase in file size and execution time of the program. This makes it unsuitable for large projects. In such cases, it is recommended to limit instrumentation to a specific portion of your project.
To reduce instrumentation overhead, some profilers may exclude small functions, which are short functions that do not make any function calls, and treat the time as being spent in their calling functions. This behavior is usually enabled by default, which may be undesirable when you want to examine small functions carefully. Most profilers offer the option to change this behavior.
Other than collecting performance statistics and timing data, profilers are also able to collect other information such as memory allocation and GPU usage.
For Visual Studio 2015: