Profiling the code to find hotspots
For code performance profiling, the executable is instrumented by a profiling tool, and every function call is counted, including the execution time. Depending on the OS and the compiler, different settings are required to enable proper application profiling.
We will now begin with a practical profiling session and search for hotspots in the code used in Chapter 14: 03_opengl_instanced_drawing
. The optimized code can be found in the folder for chapter15
in the 01_opengl_optimize
subfolder.
Profiling code using Visual Studio
Visual Studio comes with an internal performance profiler. The profiler can be started in the Debug menu of Visual Studio, as shown in Figure 15.1:
Figure 15.1: Starting the profiler from Visual Studio 2022
In the new Visual Studio tab, select Executable as the desired Analysis Target. Navigate to the chapter14\03_opengl_instanced_drawing
folder and select the executable file in the following...