[J3] [EXTERNAL] Re: SYSTEM_CLOCK

Bill Long longb at cray.com
Tue Jan 26 22:08:29 UTC 2021



> On Jan 26, 2021, at 4:00 PM, Steve Lionel via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> On 1/26/2021 4:57 PM, Clune, Thomas L. (GSFC-6101) via J3 wrote:
>>     > The biggest issue I see is that SYSTEM_CLOCK can be called with just a single argument but it takes two or more calls to do something useful.
>> 
>>     I don't agree with that characterization.  The vast majority of calls to system_clock have only one argument - the COUNT argument. 
>> 
>> I think Steve was referring to the fact that you need a start tick and a stop tick to do anything useful - 2 distinct calls.    Perhaps 1 argument in each, but still 2 calls.
>> 
>> 
>> 
> Yes - the way I use it I call SYSTEM_CLOCK with a COUNT and COUNT_RATE argument at the start and then again with just COUNT at the end, subtract the count differences and divide by the rate. You can't reasonably omit fetching the rate.
> 

Yes, this a common pattern.  The alternate version I see often is the call system_clock once at the beginning to get the COUNT_RATE and then stash away rrate =  1./rate for later conversions of count intervals to times in seconds.  Both versions are assumed to work correctly, and we need to be careful to not break either one. 

Cheers,
Bill



> Steve

Bill Long                                                                       longb at hpe.com
Engineer/Master , Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Hewlett Packard Enterprise/ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425






More information about the J3 mailing list