[J3] SYSTEM_CLOCK
John Reid
John.Reid at stfc.ac.uk
Tue Jan 26 22:06:19 UTC 2021
Steve Lionel 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.
> That COUNT_RATE can be REAL is an additional complication, as the
> standard cannot possibly impose any restriction on how that relates to
> integer kinds used for the other arguments. Note also that a program
> might be timing two or more different segments, and there's no reason
> to force them all to use the same clock.
>
> Here is the best I can think of...
>
> * Say that it is processor-dependent whether there is more than one
> clock (each with their own set of COUNT_RATE and COUNT_MAX values)
>
Agreed.
>
> * For processors that do have more than one clock, the selection is
> keyed off of the integer kind of COUNT if it is present. If COUNT
> is not present but COUNT_MAX is present, the integer kind of
> COUNT_MAX is used to select. If COUNT_RATE is supplied but not
> COUNT or COUNT_MAX, and it is an integer, its kind is used to select.
>
Requiring all the integer kinds to be the same (next bullet) makes this
simpler to say.
>
> * Otherwise the default integer kind is used for selection. (So
> REAL kinds for COUNT_RATE have no effect on selection - this may
> conflict with some implementations.)
>
I think this could be made processor dependent. If there is more than
one clock, the user should to add an integer argument to specify which
he/she wants.
> *
>
>
> * Add a constraint that if more than one integer argument is
> supplied in a call, all must be of the same integer kind
> (potential incompatibility)
>
Agreed.
>
> *
>
>
> * Add a note warning of unpredictable results if integer kinds are
> mixed across calls
>
Do we really have to say anything about doing obviously stupid things
like looking at the difference between COUNT values from different clocks?
> * Add a note recommending that processors document the relationship
> of RATE and MAX to the various integer kinds
>
I don't see the need for this. All the user has to do is call
SYSTEM_CLOCK with appropriate arguments.
>
> This really is an unholy mess. I suppose it needs an interp.
>
I think you exaggerate the extent of the mess. The user can see that it
makes no sense to mix kinds. And the concept of
there possibly being more than one clock is simple enough to understand.
Cheers,
John.
>
>
More information about the J3
mailing list