System Class for Runtime Measurements
The static methods CREATE_HR_TIMER and CREATE_LR_TIMER of the class CL_ABAP_RUNTIME
can be used to create objects for runtime measurements. The objects contain a method GET_RUNTIME that
performs a runtime measurement in the same way as the statement
GET RUN TIME.
An object created using CREATE_HR_TIMER performs a measurement with high precision, and an object created using CREATE_LR_TIMER performs a measurement with a lower level of measurement precision.
In contrast to the statement
GET RUN TIME, these objects can be used to perform different measurements with different levels of precision and parallel measurements for each
As the execution of the method GET_RUNTIME is approximately two microseconds slower than the execution
of the statement
GET RUN TIME, in some circumstances this method may not be suitable for the measurement of very short periods of time.
Runtime measurement with an object.
DATA(timer) = cl_abap_runtime=>create_hr_timer( ). DATA(t1) = timer->get_runtime( ). WAIT UP TO 1 SECONDS. DATA(t2) = timer->get_runtime( ). cl_demo_output=>display( t2 - t1 ).