etime doesn't work on Windows 2003 server

Hello All,

I am using PGI’s 64-bit pgf77 FORTRAN compiler on Windows 2003 server. In one of my programs, I have used etime function to get processor run-time (user+system) for the calling process in my program, but it doesn’t work and returns 0 always. What could be the issue?

Can I use any other function, instead of etime, to get the processor run-time?

Help in this regard will be highly appreciated.

Thanks and Regards,
// Rahul

Hi Rahul,

Unfortunately, the lib3f function ‘etime’ hasn’t been ported to Windows yet and is why it currently just returns zero. Instead try using ‘dtime’ which returns the time since the first call to dtime. Of course, this means you need to add the initial call to dtime at the start of your code, but after that you should be good.

Hope this helps,
Mat

Hi Mat,

I tried with dtime and even dtime doesn’t work. As per the PIG Fortran reference, the dtime and etime routines are only available in SYSVR4 environment.

Please let me know if there is a workaround for this.

Thanks and Regards,
// Rahul

Hi Rahul,

Sorry about that. For some reason I thought dtime had been ported.

As far as I know, there is not an easy way to get user time on Windows. You might be able to write a C routine to do it, but I don’t have an example off-hand.

If you don’t mind using elapsed time, you can try using “mclock”. However, I’m not sure how accurate it is. You can also write trs@pgroup.com and PGI customer service can send you and example of ‘dclock’. It’s assembly code, but highly accurate.

  • Mat