PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

PGPROF : Coverage problem

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling
View previous topic :: View next topic  
Author Message
blagaa



Joined: 12 Jan 2006
Posts: 2

PostPosted: Thu Jan 12, 2006 2:29 am    Post subject: PGPROF : Coverage problem Reply with quote

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.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5871
Location: The Portland Group Inc.

PostPosted: Thu Jan 12, 2006 10:14 am    Post subject: Reply with quote

Hi blagaa,

At low opts, the "if (1==0)" statement is evaluated so would show-up in the profiler. Changing the line to:
Code:
if (1==0) {
      printf("test");
}

would show that the "if" statement is executed but not the printf. Note that "-O2", dead code elimiation would remove this line altogether.

Example:
Code:
Profiled: a.out on Thu Jan 12 09:12:18 PST 2006 for 0.00015 seconds

Line hello.c@main                  Process Time           

 3   int main () {                                         
 4     if (1 == 0) printf("test"); 0 (4)    0.000031 = 21%
 5     if (1 == 0) {               0 (5)    0.000021 = 14%
 6       printf("test");                                   
 7     }                                                   
 8     return 0;                   0 (8)    0.000037 = 25%
 9   }                             0 (9)    0.000028 = 18%
10   


Hope this clears things up,
Mat
Back to top
View user's profile
blagaa



Joined: 12 Jan 2006
Posts: 2

PostPosted: Fri Jan 13, 2006 1:45 am    Post subject: Reply with quote

hank you very much for your help.

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

Code:

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    }
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5871
Location: The Portland Group Inc.

PostPosted: Fri Jan 13, 2006 2:38 pm    Post subject: Reply with quote

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.

Thanks,
Mat
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5871
Location: The Portland Group Inc.

PostPosted: Tue Jan 17, 2006 9:01 pm    Post subject: Reply with quote

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.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group