What is profiling and how do I profile a program ?
Ans: Profiling is a way to examine where and which functions time is being spent on, the number of calls made to a certain function and total execution times. It is a good way to optimize code and look at where time is being unnecessarily wasted. To enable profiling all objects and linking must be compiled with the -p flag. See question (15) on where to get the libraries necessary for profiling. To actually get a graph profile you need also the program `gprof’. You will find it included in the binutils package. Again, find it at your favorite Linux archive site. Eg: tsx-11.mit.edu:/pub/linux/packages/GCC/binutils-2.5.2.6.bin.tar.