Viewing profiling information with showpdf

To collect and view detailed information on function call and block statistics, compile with the -qshowpdf option and then use the showpdf utility. The following example shows how you can use profile-directed feedback (PDF) with the showpdf utility to view the call and block statistics for a Hello World application.

The source for the program file hello.c is as follows:
#include <stdio.h>  
void HelloWorld()
{
printf("Hello World");
}
main()
{
HelloWorld();
return 0;
}
  1. Compile the source file.
    xlc -qpdf1 -qshowpdf -O hello.c
  2. Run the resulting executable program a.out using a typical data set or several typical data sets.
  3. Run the showpdf utility to display the call and block counts for the executable file. If you used the -qipa=pdfname option during compilation, use the -f option to indicate the instrumentation file.
    showpdf -f instr1
The results look similar to this:
HelloWorld(4):  1 (hello.c)

Call Counters:
5 | 1  printf(6)

Call coverage = 100% ( 1/1 )

Block Counters:
3-5 | 1
6 |
6 | 1

Block coverage = 100% ( 2/2 )
  
-----------------------------------
main(5):  1 (hello.c)

Call Counters:
10 | 1  HelloWorld(4)

Call coverage = 100% ( 1/1 )

Block Counters:
8-11 | 1
11 |

Block coverage = 100% ( 1/1 )

Total Call coverage = 100% ( 2/2 )
Total Block coverage = 100% ( 3/3 )