NAG Library Routine Document

x05baf  (cpu)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

x05baf returns the amount of processor time used since an unspecified previous time, via the routine name.

2
Specification

Fortran Interface
Function x05baf ( )
Real (Kind=nag_wp):: x05baf
C Header Interface
#include nagmk26.h
double  x05baf_ ()

3
Description

x05baf returns the number of seconds of processor time used since some previous time. The previous time is system dependent, but may be, for example, the time the current job or the current program started running.
If the system clock of the host machine is inaccessible for any reason, x05baf returns the value zero.

4
References

None.

5
Arguments

None.

6
Error Indicators and Warnings

None.

7
Accuracy

The accuracy of the value returned depends on the accuracy of the system clock on the host machine.

8
Parallelism and Performance

x05baf is not threaded in any implementation.

9
Further Comments

Since the value returned by x05baf is the amount of processor time since some unspecified earlier time, no significance should be placed on the value other than as a marker to be compared with some later figure returned by x05baf. The amount of processor time that has elapsed between two calls of x05baf can be simply calculated as the earlier value subtracted from the later value.

10
Example

This example makes an initial call to x05baf. In a loop it performs some computations and makes another call to x05baf; the difference between the value from this call and the initial is used to track the time taken by those computations. The loop is exited if an allotted time limit is exceeded.

10.1
Program Text

Program Text (x05bafe.f90)

10.2
Program Data

None.

10.3
Program Results

Program Results (x05bafe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017