Profiling Lab
Profiling is an essential step in performing any kind of optimization. When
trying to optimize performance, there is no effective technique to achieve
speedup without knowing how much time is spent each region of code. In order
to determine the amount of time spent in each region, we must profile the
application. Although profiling is generally done to determine performance
information, profiling can be used for any type of optimization,
such as reducing power or energy.
In this lab, you will be using gprof in order to determine where most of the
execution time is being spent in a program.
Gprof is a standard GNU profiler that can
be used with any application that is compiled using gcc. Once you have
determined where the execution time is being spent, you must optimize the C
code for the application in order to achieve a significant speedup.
-
Download g3fax.c
-
Read the man page on gprof in order to determine how to compile the program
for use with gprof, and how to get the profiling results from gprof.
-
Compile the program, profile the program, and optimize the C code. Repeat
this process until you can no longer achieve any speedup.
-
Make sure when you time the optimized program, you recompile without the
profiling flags. These flags add extra instructions that are required in order
to profile.
-
You can time the program using the unix command "time". Read the man page
for more information.
-
Make sure that your optimizations do not affect the correctness of the
program. The program should output "success" if the program worked correctly.
-
When you have achieved a reasonable speedup, have the TA check you out.
You will be graded on the execution time you achieve, so make sure to
have the TA record your execution time.
-
Make sure to turn in the optimized C code online.