Profiling Using gprof and kprof
- 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:
gprof -b
- 'Kprof' is a graphical tool to view the profiling data in a meaningful
way.
- Why not try it yourself, with some
simple source code? (Here is how the output might look)
Originally written by
guy keren