[next] [prev] [prev-tail] [tail] [up]

### 10.4 Support for gprof, the g n u profiler

You can compile your programs with profiling support. For this, you just have to use the compiler switch -pg. The compiler will insert the necessary stuff for profiling.

When you have done this, you can run your program as you would normally run it:

yourexe

Where yourexe is the name of your executable.

When your program finishes, a file called gmon.out is generated. Then you can start the profiler to see the output. You can benefit from redirecting the output to a file, because it could be quite a lot:

gprof yourexe > profile.log

Hint: you can use the --flat option to reduce the amount of output of gprof. It will then only output the information about the timings.

For more information on the g n u profiler gprof, see its manual.

[next] [prev] [prev-tail] [front] [up]