20.10 Profiling with Visual Studio, Version 6.0

Visual Studio, Version 6.0, came with a useful profiler tool for finding out how much time you are spending inside each of your functions. Unfortunately, Microsoft has removed this utility from the Visual Studio.NET, Version 7.0 release. It's almost worthwhile keeping a copy of Version 6.0 around just for the profiler! Otherwise you will need to get a third-party profiling tool to use with Visual Studio.NET.

In any case, let's briefly describe the use of the Visual Studio, Version 6.0, profiler. The Version 6.0 profiler is useful in figuring out how to make your program run faster. To get a dialog for starting the profiler, select Build | Profile...

  • Because the profiler is basically a command-line utility, it will only work if the directory-name for your program has no spaces in it.

  • The Version 6.0 profiler only works if the project is built in Version 6.0 with the Project | Settings... | Link | Enable profiling selection checked in the Version 6.0 project file. The default Pop Framework *.dsw settings for Version 6.0 have profiling enabled for the Debug build and not enabled for the Release build, but you may need to recheck that this selection is really turned on, particularly if you've used Visual Studio.NET first. [The Enable profiling selection doesn't exist in Visual Studio.NET.]

  • The Profile dialog allows you to set the profiler to check various things such as speed and coverage. In order to check for speed, good settings to use are to select Profile Type | Function Timing and to type into the Advanced settings: box the parameters

    /AT /STACK 1 
  • The program runs fairly slowly while in profiling mode. Let it run for a while so as not to have your data swamped by the statistics of the functions called during the (anomalous) startup period. Thus, if you don't wait very long, you'll see CWinApp::DoMessageBox as the most time-consuming call of a Pop program run ? this originates from the message box that asks you to press Enter. When you've let the program run for a bit, terminate it normally.

  • The output of the profiler appears in your Output window of Visual Studio. Scroll the window up to the top so you can see the more frequently called functions, which are the ones you care about. Don't wait for the output to finish listing all of its info before you scroll, otherwise the important information at the start may get truncated.

Check the Help menu in the Profile dialog for more suggestions.

    Part I: Software Engineering and Computer Games
    Part II: Software Engineering and Computer Games Reference