When using pgprof with ‘-c’ option all the subroutines of the profiled program appear 100% covered, which is impossible in my case.
The program was compiled with pgf77 (v4.1.2) using -Mprof=func,lines option.
I also wrote a small C program containing the following instruction
if ( 1 == 0 ) printf (“test”);
Obviously such program cannot be 100% covered, although pgrpof displays full coverage of it.
Anyone can find an explanation of this behaviour? Thanx a lot.
Unfortunately I tested your helo.c program and I still have the same 100% coverage problem.
pgcc -O0 -Mprof=func,lines hello.c => a.out
pgprof -s -c
pgprof> select all
pgprof> p
Coverage output - Fri Jan 13 09:33:42 2006
Program : a.out
Datafile : pgprof.out
Process : 0
Sort by coverage
Select all
Coverage Total Lines Function
(%) Lines Covered Name:
-----------------------------------------
100.0 7 7 main (hello.c:3)
pgprof> display all
pgprof> p
Coverage output - Fri Jan 13 09:33:57 2006
Program : a.out
Datafile : pgprof.out
Process : 0
Sort by coverage
Select all
Coverage Total Lines Min Avg Max Min Avg Max Function
(%) Lines Covered Covered Covered Covered Pct Pct Pct Name:
----------------------------------------------------------------------------------------
100.0 7 7 7 7 7 100.0% 100.0% 100.0% main (hello.c:3)
pgprof> li main
Function: main (hello.c:3)
Cover(%) : 100.0
Total Lines : 7
Covered Lines : 7
Process : 0
Covered Line#
----------------------------------------------------------------------------------------
1
2 int main()
3 {
4 if (1 == 0) printf ("test");
4
5 if (1 == 0)
6 {
7 printf ("test");
8 }
9 return 0;
10 }
Ok I’m confused now. Coverage should be 5 lines not 7 in Main. (It is if you bring up the details of the routine.) So it appears to me that the summary is getting the coverage of total executed lines not total lines.
I’ve passed this on to one of our tools engineers to see if he can shed some light as to what’s going on.
Our tools engineer determined that it’s a bug and he’s filed a techinical problem report (TPR) #3705. It should be fixed in an up coming release. Thanks for finding it.