Profiling with Intel¶
Profiling an application means augmenting the compiled binary with information on execution counts per source-line (and basic blocks) -- e.g. one may see how many times an if-statement has been evaluated to true. To do so, compile your code with the profile flag:
icc -p ex.c -o ex.
Using the gprof tool, one may manually inspect execution count of each executed line of source code.
For compiler optimization, recompile your source using
icc -prof-gen ex.c -o ex
then execute the most co]]mmon and typical use-case of your application, and then recompile using the generated profile count (and using optimization):
icc -prof-use -O2 ex.c -o ex