c++visual-studioprofiling

Debug information impacts profiling results c++


I'm using IBM Quantify to try to compare run time of different function calls in my program, but a headache is many function calls has DEBUG macro outputing stuff like this,

#ifdef DEBUG
cout << "Value is "<< value << endl;
#endif

When I do profiling I found these IO operations take most of time, and of course what I care is the real run time for the released version. Is there anything I can do to get a more accurate result for released version instead of manually removing these DEBUG macros?

I'm building the code using Visual Studio compiler in debug mode, when I build it with -o option, it cannot be run for profiling saying no debug information available.


Solution

  • You'll definitely want to use a release build for profiling. You can modify the project settings to have PDBs emitted for release builds.