Profiling Your Code:

At some point in the semester (particularly if you choose to write an interactive raytracer), you will need to identify bottlenecks in your program, i.e., what parts of your program take the most CPU time. This process is called profiling your code, and there are various tools that can do this for you. Below are instructions for using the GNU profiler ("gprof") to profile your code.
  1. Compile your program with the '-g' and '-pg' flags to gcc/g++.
  2. Run your program, with any necessary command line parameters, as usual.
  3. Run the profiler on the output file "gmon.out".
  4. Open up the file "myProfile.txt" so see your program's profile data.
Unfortunately, for those of you using Windows, I am unaware of any free profiler that works in Visual Studio.NET. Microsoft claims that VS.NET 2005 includes a profiler, but my searching suggests this is only included in the "Team Development Edition," which you probably don't have. My only suggestion is that you write portable code, and compile under Linux (or Cygwin) so you can profile with "gprof".


Last Modified: Wednesday, January 3, 2007

Chris Wyman (cwyman@cs.uiowa.edu)