Silverfrost Logo About Us | Contact Us
 

HIGH_RES_CLOCK@

Platform

x64, Win32

Purpose

To obtain the CPU time accurate to 1 microsecond.

Syntax

REAL (KIND=2) FUNCTION HIGH_RES_CLOCK@(ALIGN)
LOGICAL (KIND=2) ALIGN

Description

This function returns the CPU time as seconds since midnight accurate to about 1 microsecond (although the cost of the function call is approximately 100 microseconds because it must call DBOS). To achieve this precision the system clock is reprogrammed in mode 2. This could in principle affect other software, although we are not aware of any problems. The clock remains programmed in mode 2 until the system is rebooted. If the ALIGN argument is set .TRUE., this function will not return until after the next clock tick to help to obtain consistent timings. Obviously the second of a pair of calls to HIGH_RES_CLOCK@ should have ALIGN set to .FALSE.. Although the function is defined as REAL (KIND=2) it actually returns an 80-bit (KIND=3) precision result.

See also

CPU_TIME, DCLOCK@.

Example

REAL (KIND=2)::T1,T2,HIGH_RES_CLOCK@
T1=HIGH_RES_CLOCK@(.TRUE.)
CALL SOME_PROCESS
T2=HIGH_RES_CLOCK@(.FALSE.)
PRINT *,'Time required = ',T2-T1

 

 

Copyright © 1999-2017 Silverfrost Limited