ABAP Keyword Documentation → ABAP − Reference → program editing → Testing and Checking Programs → Runtime Measurements
SET RUN TIME CLOCK RESOLUTION
Other versions: 7.31 | 7.40 | 7.54
Syntax
SET RUN TIME CLOCK RESOLUTION {HIGH|LOW}.
Effect
This statement specifies the precision with which the statement
GET RUN TIME is measured. It can be changed in a program only before the statement GET RUN TIME
is executed for the first time, otherwise a non-handleable exception is raised.
Specifying HIGH
defines a level of precision of one microsecond. If the level
of precision is high, this can produce false time values for multi-processors, since the clocks of the
individual processors are not always regularly synchronized on all platforms. The high level of precision on the following platforms always returns correct values:
- AIX
- SINIX
- SUN-OS
- Linux
- IBM i5/OS (previously OS/400)
-
Windows
To avoid incorrect time values on the other platforms, LOW
can be used to specify a low precision measurement whose resolution depends on each platform.
Without the preceding statement SET RUN TIME CLOCK RESOLUTION
, GET RUN TIME
uses the high precision measurement implicitly.
Notes
- To execute multiple measurements with different levels of precision within an internal session, the class CL_ABAP_RUNTIME can be used (see Class for Runtime Measurements).
-
No exception is raised if
SET RUN TIME CLOCK RESOLUTION
is used after the statementGET RUN TIME
as long as the level of precision is not changed.
Example
Uses SET RUN TIME CLOCK RESOLUTION
in front of GET RUN TIME
.
SET RUN TIME CLOCK RESOLUTION LOW.
GET RUN TIME FIELD DATA(t1).
wait UP TO 1 SECONDS.
GET RUN TIME FIELD DATA(t2).
cl_demo_output=>display( t2 - t1 ).
Exceptions
Non-Handleable Exceptions
-
Cause: An attempt was made to change the level of precision after
GET RUN TIME
usingSET RUN TIME CLOCK RESOLUTION
.
Runtime error:SET_RUN_TIME_CLOCK_ERROR