Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Execution duration

Former Member
0 Likes
912

I'd like to display the execution duration of some abap statement in abap program ...

Look like this...

program started at .......

program ended at ....

But it is for performance issue thus MUST BE VERY PRECISE!

Use of sy-uzeit only if no better solution!

Thanks for the reply

8 REPLIES 8
Read only

Former Member
0 Likes
886

I feel that is the Best solution...

regards

vijay

Read only

Former Member
0 Likes
886

Hi

Have you tried to check the std tools to show the performace (trx SE30)?

Max

Read only

Former Member
0 Likes
886

yes sy-uzeit is the best one which can alos minimize ur code

Read only

0 Likes
886

GET RUN TIME FIELD

Basic form 5

GET RUN TIME FIELD f.

Effect

Relative runtime in microseconds. The first call sets (initializes) the field f to zero. For each subsequent call, f contains the runtime in microseconds since the first call. The field f should be of type I.

The ABAP statements that lie between two calls of the GET RUN TIME statement are known as the runtime. The time from the first to the second call is known as the measurement interval.

Notes

Use SET RUN TIME CLOCK RESOLUTION to specify the precision with which the time is to be measured, before you call GET RUN TIME FIELD for the first time. The default setting is high precision.

Example

Measuring Runtime for the MOVE Statement

DATA: T1 TYPE I,

T2 TYPE I,

TMIN TYPE I.

DATA: F1(4000), F2 LIKE F1.

TMIN = 1000000.

DO 10 TIMES.

GET RUN TIME FIELD T1.

MOVE F1 TO F2.

GET RUN TIME FIELD T2.

T2 = T2 - T1.

IF T2 < TMIN.

TMIN = T2.

ENDIF.

ENDDO.

WRITE: 'MOVE of 4000 byte:', TMIN, 'microseconds'.

Note

SAP recommends that you measure the runtime several times and take the minimum result.

Related

To perform runtime measurements of complex processes, use Runtime analysis (Transaction SE30).

Related

SET RUN TIME CLOCK RESOLUTION

Additional help

Measuring Runtimes of Program Segments

Read only

0 Likes
886

did you choose to use GET RUN TIME FIELD statement?

Read only

manuel_bassani
Contributor
0 Likes
886

Hi Stephan,

try to use:


data: f(8) type p.
get time stamp field f.

f now contains current datum+time

Instead you can use:


DATA: T1   TYPE I, 
      T2   TYPE I, 
      TMIN TYPE I. 

DATA: F1(4000), F2 LIKE F1. 

TMIN = 1000000. 
DO 10 TIMES. 
  GET RUN TIME FIELD T1. 
    MOVE F1 TO F2. 
  GET RUN TIME FIELD T2. 
  T2 = T2 - T1. 
  IF T2 < TMIN. 
    TMIN = T2. 
  ENDIF. 
ENDDO. 
WRITE: 'MOVE of 4000 byte:', TMIN, 'microseconds'. 

This uses milliseconds.

Remember to reward points for useful answers and close post if your problem is solved.

Regards, Manuel

Read only

Former Member
0 Likes
886

Hi,

Try the FM's available in the Function Group SMON.

Hope it helps...

Lokesh

Pls. reward appropriate points

Read only

Former Member
0 Likes
886

Hi,

Try the FM's available in the Function Group SMON.

Especially the FM GET_CPU_ALL

Hope it helps...

Lokesh

Pls. reward appropriate points