Profiling Using gprof and kprof
Originally written by
- To profile our code, we need to compile each source file with the
extra '-pg' flag of gcc, and link with the same '-pg' flag.
- Running this code will generate a file named 'gmon.out'.
- To view the output:
- 'Kprof' is a graphical tool to view the profiling data in a meaningful
- Why not try it yourself, with some
simple source code? (Here is how the output might look)