Node:How to profile, Next:, Previous:Profiling, Up:Profiling

13.1 How to profile a DJGPP program

Q: How can I profile my program to see where it spends most of its run time?

A: DJGPP includes a profiling facility. To use it, compile and link with -pg option, run your program as you usually would, then run a program called gprof:

 gprof myprog.exe

(change myprog.exe to whatever name your program is). This will print an execution profile. You can now look at the profile and try to optimize the functions which take a large proportion of the execution time.

Gprof is further documented in the Binutils docs as part of the GNU Binutils distribution.