Profiling With GCC|
Here's a newbie tip for gcc users, mostly to break the neverending
stream of MSVC tips ;).
You can make gcc generate profiling code by passing it the parameter -pg
on when both compiling and linking.
gcc -c -pg mytest.cc
gcc mytest.o -pg -o mytest
Then, when you run the program...
...a file called 'gmon.out' will be left in the current directory. This
is the stastical data from your programs run. To actually gain something
useful from this data you run it through a program called 'gprof'
This will dump screens and screens of profiling information including a
call graph and a flat profile.
Quite helpful for finding those bottlenecks, although interpretation is
half the battle.
The zip file viewer built into the Developer Toolbox made use
of the zlib library, as well as the zlibdll source additions.