Use the Profiler

Posted in Computer Games, Software Engineering, Technology
Monday, January 10, 2000

I know somebody is reading this because I received the most cryptic email yesterday. *shrug* If you send me questions, please be more specific than “show me how to program”.

CODING TIP: Do Not Fear the Profiler. So now that you have written your program, you would like to optimize it to run better. A profiler tool helps identify the areas in which you spend the most time and of which you call most often. These areas are good candidates for optimization. As an aside I would love to see debuggers and profiling tools for the next generation of in-game scripting languages.

Profiling tools work by doing two things. First of all code is automatically added by the tool to the prologue of each function. When the calling program enters a function, the function name and program time are recorded in a file. Secondly, a profiler has a clock-driven information gatherer. At regular intervals the profiler examines the location of the program instruction pointer and records the function in which it is located to a file. This data is then analysed to produce a call graph and do statistical analysis.

Armed with this analysis you can target those functions where optimization will give you the best payoff. I will mention optimization techniques in future plan updates. For a good discussion of graphic code optimization check out M. Abrash’s Black Book of Graphics Programming.


Like what you see? Subscribe to the RSS feed.