MSVS2015提供了性能分析的工具可供使用。
链接:https://msdn.microsoft.com/en-us/library/mt210448.aspx
LINUX下参考这篇文章:
http://baptiste-wicht.com/posts/2011/09/profile-c-application-with-callgrind-kcachegrind.html
Callgrind is a tool in part of the Valgrind toolchain.
MS VS下操作的详细步骤参考
Beginners Guide to Performance Profiling
https://msdn.microsoft.com/en-us/library/ms182372(v=vs.110).aspx准备工作:
Prerequisites
These are a few things that you can do before you start profiling to make sure that you do not encounter unnecessary problems.
Run as administrator If you are not an administrator on the computer that you are using, you should run Visual Studio as an administrator to make sure that you have the permissions that are necessary for some of the features in the profiling tools. To do this, click the Start button, locate the Visual Studio application icon, right-click the icon, and then click Run as administrator.
Set the active build configuration to Release Debug builds insert additional diagnostic code into your application and do not include optimizations that the compiler performs in release builds. Profiling the release version of your application provides more accurate data about the performance of your application. To change the active configuration, on the Build menu click Configuration Manager and in the dialog box, under Active solution configurations, select Release.
Get Windows symbols files If you profile code that calls Windows functions, you should make sure that you have the most current .pdb files. Without these files your report views will list Windows function names that are cryptic and difficult to understand. For more information about how to make sure that you have the files you need, see How to: Reference Windows Symbol Information.
We recommend that you begin analyzing your data by examining the Hot Path, then the list of functions that are doing the most work, and finally by focusing on other functions by using the Summary Timeline. You can also view profiling suggestions and warnings in the Error List window.