CALL SYSTEM_CLOCK and COUNT_RATE

Hi,

I am using the SYSTEM_CLOCK function in a simple timing logic:

CALL SYSTEM_CLOCK (COUNT, COUNT_RATE, COUNT_MAX)

All 3 arguments are optional and get changed in this program. I am finding that the second argument can be 10000 or 1000000 depending on the compiler used.

Using the Portland compiler it is 1000000 on 3 different tested operating systems (WinXP, Vista 32 and Vista 64). This seems to be independent of what processor I run it on.

Since all 3 arguments seem to always be INTEGER*4 based, independently how I declare them, the longest possible time obviously depends on that clock rate (which I divide by to get the time).

The Portland documentation says that COUNT_RATE is always 1000 (??)

I already have a workaround (timing can be done many ways) but I am interested to find out

  • whether the documentation might need an update
  • whether maybe there is an option to change the COUNT_RATE used
  • what the clock rate depends on. I assume it’s not always the real clock rate since I am getting different values with different compilers but a constant value with different computers/processors

Thanks,

Tom

Hi Tom,

Maybe 20 years ago when this doc was first created was the number of tics was 1000, but it’s been 100000 as far as I can recall. Though, it could just be a typo. In any case, we’ll get the doc fix.

Since all 3 arguments seem to always be INTEGER*4 based, independently how I declare them, the longest possible time obviously depends on that clock rate (which I divide by to get the time).

The function arguments use the default integer kind. You can change the default kind INTEGER*8 by compiling with “-i8”.

  • whether maybe there is an option to change the COUNT_RATE used

No, it’s hard coded.

  • what the clock rate depends on. I assume it’s not always the real clock rate since I am getting different values with different compilers but a constant value with different computers/processors

I believe it’s based upon the resolution of the gettimeofday (or equivalent) function.

  • Mat

Hi Mat, thanks for your reply.

I have already used -i8 but I found that COUNT_MAX always gets returned as 2,147,483,648, even when declared as -i8. That leaad me to believe it’s treated as Integer*4.

Tom