For C++, we will be using the Visual Studio built-in Performance Profiler tool.
Note that you need an executable file to proceed with this profiling step. Make sure to run the application at least once before proceeding to the next steps!
To profile your code, follow the below steps:
- Make sure to enable the benchmark test case in test/BenchmarkTest.cpp
- Go to
Debug>Performance Profiler... - Click on the
Change Targetdrop-down button, and chooseExecutable - Make sure the
Performance Wizardcheckbox is checked - Click on the
Startbutton. This should open the windowPerformance Wizard - Choose the
CPU Samplingoption then clickNext - Choose the
An executable (.EXE file)option then clickNext - From
What is the full path to the executable?, select the .exe file associated with this kata. It should be under cpp/build/bin/Debug. - Click
Next - Make sure the box
Launch profiling after the wizard finishesis checked - Click on
Finish - Once the report is finalized, you can go to the
Call Treeview to analyze the time consumed by each function. - Improve your code and redo steps 1 to 8
- Make sure to enable the benchmark test case in test/BenchmarkTest.cpp
- Go to
Debug>Performance Profiler... - Click on the
Change Targetdrop-down button, and chooseExecutable - From
Path to the executable?, select the .exe file associated with this kata. It should be under cpp/build/bin/Debug. - Click
OK - Select
CPU Usage - Click on
Startbutton - Once the report is finalized, you can set
Current Viewdropdown toFunctions - Improve your code and redo steps 1 to 8