In early summer, Gary Brooks of Convex suggested that four issues still needed to be dealt with. Each is described below. Responses from other committee members are appended.
void PTR_get_wall_tick(double *val, int *status);
void PTR_get_usr_tick(double *val, int *status);
void PTR_get_sys_tick(double *val, int *status);
void PTR_get_wall_resolution(double *val, int *status);
void PTR_get_usr_resolution(double *val, int *status);
void PTR_get_sys_resolution(double *val, int *status);
void PTR_get_wall_rollover(double *val, int *status);
void PTR_get_usr_rollover(double *val, int *status);
void PTR_get_sys_rollover(double *val, int *status);
void PTR_get_wall_overhead(double *val, int *status);
void PTR_get_usr_overhead(double *val, int *status);
void PTR_get_sys_overhead(double *val, int *status);
DOUBLE PRECISION VAL
INTEGER STATUS
CALL PTR_GET_SYS_OVERHEAD(VAL, STATUS)
The reason for having these as subroutines and not as functions
is the same reason why the tick-collecting routines were originally
designed as subroutines as well. Here is a snippet from May 95
PTR working group report:
> However, two of the reasons for having the manifest constants > in the first place still remain valid: > - to provide enough information to the user about timers > - to provide efficient access to such informationwould actually go away. That is, the user could choose whether to obtain the values on-the-fly, or retrieve them ahead of time and compile them as constants in his/her executable.
It would also let the user obtain the info ahead of time and use that data to help decide how many timer calls to insert, and at what points in execution, in order to avoid timer rollover (which was one of the reasons for having them available via the include file).
In addition to the issue of insulating the user and interval-calculating routines from calibrations, there is the issue of when to calibrate. We can think of two different junctures to calibrate the timer parameters:
Compile-time/Install-time: This is done when the PTR library is being compiled on a system. The compilation setup can find out the most appropriate values for the timer parameters and place them in the source code before compilation. This might mean setting the initial value of a process-wide global variable. With this methodology, the timer parameter values are hard-coded in the library after installation. But this alone might be sufficient on certain platforms. Note that this calibration is not exposed to the user at all.
Runtime: This type of calibration is appropriate when one wants to capture the latest status of the system in its effect on the timer parameters. We propose that the runtime calibration capability be provided to the user via the init routines. The impact of calibrating at run-time is two-fold:
We have to specify what the user needs to provide for calibration. The common consensus seems to a time period for which the calibration has to run for.
void PTR_init__timer(double* opt_ticksize,
double init_level,
int *status);
where:
opt_ticksize - if 0, then ticksize will be calculated
init_level - amount of time to be spent calibrating
status - int* where status code will be returned
void PTR_init_wall_timer(double len, int *status);
void PTR_init_usr_timer(double len, int *status);
void PTR_init_sys_timer(double len, int *status);
If 'len' is 0, no calibration is done. But the timer parameters
are set to what is most appropriate for the system without calibration.
This might be making a system call to find out what the appropriate
values are or might be setting a variable from a #defined constant.
The vendor is free to do what is most appropriate for his/her
implementation.
If 'len' is non-zero, and the vendor supports calibration, the timer parameters are calibrated. One should note that it is not within the PTR realm to decide what kinds of calibrations are possible. It is up to the vendor to document and support various kinds of calibration.
Any error codes or status codes are returned via the 'status' argument.
PTR_NOT_AVAILABLE = -1
PTR_ROLLOVER_DETECTED = -2
PTR_CANNOT_CALIBRATE -3
PTR_OTHER_ERROR = -4
But it doesn't provide a status value for successful completion.
PTR_OK = 1
to the list of possible status values.
But I suggest that we add PTR_OK = 0
to conform to the common practice of using zero to represent successful
completion.
For further information, contact kennino@cs.orst.edu.