Profiler timing routine?

I have problems getting my code built in timing calls to work, the code returns zero time. It does a call to the system and I’ve tried several system routines as you can see below.

I’ve found however that if I turn on profiling, function level is the easiest, the timing calls work. My question is what does setting the profiler option in the compiler do that could allow my timing calls to work?

Note: Running PVF 12.5 in Windows 7 64-bit using Visual Studio 2008.

\


SUBROUTINE timcpu(XTIme)
IMPLICIT NONE

C*–TIMCPU5
REAL(KIND=8) XTIme
INTEGER count_0, count_1, count_rate, count_max
INTEGER time_array(8)
C
C SYSTEM TIME IN SECONDS
C
C CALL cpu_time(XTIme)
C CALL system_clock(count_0, count_rate, count_max)
CALL date_and_time(values=time_array)
C XTime = count_0 * 1.0 / count_rate
XTime = time_array (5) * 3600 + time_array (6) * 60
& + time_array (7) + 0.001 * time_array (8)
C
END SUBROUTINE timcpu

Hi Ralph,

I really wish we could get to the bottom of this one. I still think it’s some Windows configuration or library issue, but not being able to recreate it here makes it very difficult.

I’m not sure if this will be helpful, but I’d like to try a few things. First, do you have access to Microsoft’s or PGI’s C compiler? If so, please compile the following C code which calls localtime. I looked our run time code for “date_and_time” and on Windows it basically make a call to the C localtime routine.

If you don’t have a C compiler, I’ll send you my binary.

#include <time.h>
#include <stdio.h>

void main () {

    char            lbuf[16];
    time_t          ltime;
    struct tm      *ltimvar;
    int i;

    ltime = time(0);
    ltimvar = localtime(&ltime);
    sprintf(lbuf,"%2.2d:%2.2d:%2.2d",
            ltimvar->tm_hour,
            ltimvar->tm_min,
            ltimvar->tm_sec);
    for(i=0; i < 16; ++i) {
 	printf("%d ",lbuf[i]);
    }
    printf("\n%s\n",lbuf);
}



$ pgcc time.c -o time.exe
$ time.exe
49 48 58 48 57 58 52 48 0 0 0 0 0 0 0 0 
10:09:40

Thanks,
Mat

Mat,

Since the Intel Fortran compiler has no problems with timing I expect any executable I build with an Intel compiler won’t exhibit the problem.

Please send me an executable, remember it is for Windows7 64bit.