Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Tips and Tricks arrow General arrow Get run time in ABAP
Get run time in ABAP PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Wednesday, 30 May 2007
This example shows you how to get the runtime between statements in your ABAP code.

REPORT demo_special_tech_get_runtime .

DATA t TYPE i.

GET RUN TIME FIELD t.
WRITE: / 'Runtime', t.

DO 10 TIMES.
  GET RUN TIME FIELD t.
  WRITE: / 'Runtime', t.
ENDDO.

SKIP.
ULINE.


DATA: t1 TYPE i,
      t2 TYPE i,
      t3  TYPE p DECIMALS 2,
      n  TYPE i VALUE 1000.

t = 0.
DO n TIMES.
  GET RUN TIME FIELD t1.

*****************************
* Code to be tested         *
*****************************

  GET RUN TIME FIELD t2.
  t2 = t2 - t1.
  t3 = t3 + t2 / n.
ENDDO.

WRITE: / 'Mean Runtime: ', t3, 'microseconds'.


Database runtime

REPORT demo_special_tech_get_runt_db.

DATA: t1 TYPE i,
      t2 TYPE i,
      t  TYPE p DECIMALS 2.

PARAMETERS n TYPE i DEFAULT 10.

DATA: toff  TYPE p DECIMALS 2,
      tsel1 TYPE p DECIMALS 2,
      tsel2 TYPE p DECIMALS 2.

TABLES sbook.

t = 0.
DO n TIMES.
  GET RUN TIME FIELD t1.

* Offset

  GET RUN TIME FIELD t2.
  t2 = t2 - t1.
  t = t + t2 / n.
ENDDO.
toff = t.
WRITE: / 'Mean Offset Runtime     :', toff, 'microseconds'. "#EC NOTEXT

SKIP.
t = 0.
DO n TIMES.
  GET RUN TIME FIELD t1.

  SELECT * FROM sbook.
  ENDSELECT.

  GET RUN TIME FIELD t2.
  t2 = t2 - t1.
  t = t + t2 / n.
ENDDO.
tsel1 = t - toff.
WRITE: / 'Mean Runtime SELECT *   :',  "#EC NOTEXT
         tsel1, 'microseconds'.        "#EC NOTEXT

SKIP.
t = 0.
DO n TIMES.
  GET RUN TIME FIELD t1.

  SELECT carrid connid FROM sbook
                       INTO (sbook-carrid, sbook-connid).

  ENDSELECT.

  GET RUN TIME FIELD t2.
  t2 = t2 - t1.
  t = t + t2 / n.
ENDDO.
tsel2 = t - toff.
WRITE: / 'Mean Runtime SELECT List:',  "#EC NOTEXT
          tsel2, 'microseconds'.       "#EC NOTEXT


Related Items:

Last Updated ( Wednesday, 30 May 2007 )
 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 334
Sample Code: 166
Total Contributions: 553

Member Activity
Members: 6303 since 2/1/2007!
New: 4 since yesterday!
Visitors: 1160530

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor