ABAPGET_RUN_TIME - GET RUN TIME
General Material Data rdisp/max_wprun_time - Maximum work process run timeThis documentation is copyright by SAP AG.
GET RUN TIME
Syntax
GET RUN TIME FIELD rtime.
Effect
When GET RUN TIME is first executed after theinternalsession is created, variable rtime is set to 0. Upon each subsequent execution in the sameinternal session, the program runtime (in seconds) that has elapsed since the first execution is assigned to variable rtime. The return value of the statement is of data type i.
Notes
- To measure the runtime of program sections, a GET RUN TIME statement can be executed before and after the required section and the difference of the results can then be created. The delimited sequence of statements is called ameasuring section, and the length of time to execute it is called themeasuring interval.
- Using the statement SETRUN TIME CLOCK RESOLUTION, the measuring precision can be defined before the first execution of GET RUN TIME, which is used to determine the runtime.
- The maximum resolution of the command GET RUN TIME is a microsecond. Shorter measuring intervals cannot be determined reliably.
- The valuerange of the return value of the statement must be adhered to. You should not create measuring sectionsthat are too large (no larger than 1,000 s), nor should you create measuring sections through access to external data or screen calls, and so on.
- The class CL_ABAP_RUNTIME provides methods forgenerating objects whose method GET_RUNTIME can be used to carry out several runtime measurements with different resolutions in an internal session (see alsoClass for Runtime Measurements).
- The runtime of the program sections can also be determined using the runtime analysis tool.
Example
Determining the calculation time for calculating the tangent of 1. Since the runtime of the statementis less than a microsecond, the runtime of several executions in an inner loop is measured. The executiontime for the loop itself is also measured in order to deduct it as an offset. These measurements areexecuted several times in an outer loop and the mean value is created using division by n0. The runtime of an individual statement is determined by dividing by ni.
DATA: t0 TYPE i,
t1 TYPE i,
t2 TYPE i,
t3 TYPE i,
t4 TYPE i,
tm TYPE f,
no TYPE i VALUE 100,
ni TYPE i VALUE 1000,
res TYPE f.
DO no TIMES.
GET RUN TIME FIELD t1.
DO ni TIMES.
res = TAN( 1 ).
ENDDO.
GET RUN TIME FIELD t2.
GET RUN TIME FIELD t3.
DO ni TIMES.
ENDDO.
GET RUN TIME FIELD t4.
t0 = t0 + ( ( t2 - t1 ) - ( t4 - t3 ) ).
ENDDO.
tm = t0 / ni / no.
rdisp/max_wprun_time - Maximum work process run time rdisp/max_wprun_time - Maximum work process run time
This documentation is copyright by SAP AG.
Length: 4530 Date: 20120522 Time: 063806 triton ( 197 ms )






