# Profiling option - Testing Tools

While developing embedded software on the host system, you need to check how much time it takes to execute some of the functions/modules. This information is required to find out the time-consuming functions so that either you can optimize the code or you can write computationally intensive portions of the code in assembly language for faster execution.

The command "gprof" gives the timing of different functions. To obtain the timings, you need to compile the program with profiling option as below:

$gcc -pg -o program program. Now you can run the program using the command:$./program A file with the name gmon.out is created.

The output will display the time taken by various functions. You can analyze the timings to find out which portions of the code are taking longer time.

Note: In embedded/real-time software development, if proper timing analysis is not done during the design stage, only during testing time the performance limitations will be evident. The profilers are of immense use during module testing to do the timing analysis.