ABAP Keyword Documentation →  ABAP − Reference →  program editing →  Testing and Checking Programs →  Runtime Measurements → 

GET RUN TIME  Syntax Diagram

Short Reference

Syntax

GET RUN TIME FIELD rtime.

Effect

When GET RUN TIME is executed for the first time after an internal session is created, the value 0 is passed to the variable rtime. After each further execution in the same internal session, the program runtime that has elapsed since the first execution, in microseconds, is passed to the variable rtime. The return value of the statement is of the data type i. The following can be specified for rtime:

Notes

Example

Determines the calculation time for calculating the tangent of 1. Since the runtime of the statement is less than a microsecond, the runtime of multiple executions in an inner loop is measured. The execution time for the loop itself is also measured to deduct it as an offset. These measurements are executed more than once in an outer loop and the mean value is calculated using division by n0. Division by ni determines the runtime of an individual statement.

DATA: t0    TYPE i,
      no    TYPE i VALUE 100,
      ni    TYPE i VALUE 1000.

DO no TIMES.
  GET RUN TIME FIELD DATA(t1).
  DO ni TIMES.
    DATA(res) = tan( 1 ).
  ENDDO.
  GET RUN TIME FIELD DATA(t2).
  GET RUN TIME FIELD DATA(t3).
  DO ni TIMES.
  ENDDO.
  GET RUN TIME FIELD DATA(t4).
  t0 = t0 + ( ( t2 - t1 ) - ( t4 - t3 ) ).
ENDDO.

DATA(tm) = CONV decfloat34( t0 / ni / no ).




Continue
Runtime Measurement of Database Reads