Example of compilation with pdf and showpdf

The following example shows how you can use 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 program executable a.out.
  3. Run the showpdf utility to display the call and block counts for the executable:
    showpdf
    

The results will look similar to the following:

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 )