SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Balance the different services between the app. servers



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sun Nov 25, 2007 1:01 pm    Post subject: Balance the different services between the app. servers Reply with quote

Balance the different services between the app. servers: CPU time per workprocess type and application server

Code:
REPORT ZPROCTIM.
*
*  This program sums the CPU time by workprocess type, and by
*  application server, consumed by the workprocesses.
*  It is useful, to help to balance the different
*  services between the servers.
*
INCLUDE .
DATA: DEST(8), TAIL(5), HEAD(5).
DATA: SAPS TYPE I, SALL TYPE I, T1 TYPE I, T2 TYPE I, T3 TYPE I,
T4 TYPE I, T5 TYPE I, T6 TYPE I.
DATA: WITH_CPU TYPE X VALUE 10.
DATA: SRVNAME LIKE SPFID-APSERVER.
DATA: BEGIN OF SRV_TBL OCCURS 100.
        INCLUDE STRUCTURE MSXXLIST.
DATA  END OF SRV_TBL.
DATA: BEGIN OF WPLIST OCCURS 30.
        INCLUDE STRUCTURE WPINFOS.
DATA: END OF WPLIST.
DATA: BEGIN OF LOC_WPLIST OCCURS 30.
        INCLUDE STRUCTURE WPINFO.
DATA: END OF LOC_WPLIST.
DATA: BEGIN OF WPINFO OCCURS 30.
        INCLUDE STRUCTURE WPINFO.
DATA: END OF WPINFO.
DATA: BEGIN OF PFNORM OCCURS 30.
        INCLUDE STRUCTURE PFNORM.
DATA: END OF PFNORM.
DATA: BEGIN OF RES OCCURS 10,
      HOST(8), TYPE(3), TIME TYPE I,
END OF RES.
DATA: BEGIN OF RES2 OCCURS 10,
      TYPE(3), HOST(8), TIME TYPE I,
END OF RES2.

CALL FUNCTION 'TH_SERVER_LIST' DESTINATION '????'
     TABLES
          LIST = SRV_TBL.
REFRESH WPLIST.
LOOP AT SRV_TBL.
  SRVNAME = SRV_TBL-NAME.
  REFRESH LOC_WPLIST.
  WITH_CPU = 1.
  CALL FUNCTION 'TH_WPINFO' DESTINATION '????'
       EXPORTING
            SRVNAME = SRVNAME
       TABLES
            WPLIST  = LOC_WPLIST
       EXCEPTIONS
            OTHERS  = 1.
  IF SY-SUBRC = 0.
    LOOP AT LOC_WPLIST.
      MOVE-CORRESPONDING LOC_WPLIST TO WPLIST.
      WPLIST-APSERVER = SRVNAME.
      APPEND WPLIST.
    ENDLOOP.
  ENDIF.
ENDLOOP.
LOOP AT WPLIST.
  DEST = WPLIST-APSERVER.

  CALL FUNCTION 'TH_WP_DETAIL_INFO' DESTINATION DEST
      EXPORTING
            WP = WPLIST-WP_NO
            WITH_CPU = WITH_CPU
       IMPORTING
            WPINFO = WPINFO
            PFNORM = PFNORM.
  RES-HOST = DEST. RES-TYPE = WPLIST-WP_TYP.
  SPLIT WPINFO-WP_CPU AT ':' INTO HEAD TAIL.
  RES-TIME = 60 * HEAD + TAIL.
  COLLECT RES.
ENDLOOP.
LOOP AT RES.
  AT NEW HOST.
    WRITE:  '         ' COLOR 2 NO-GAP,
            RES-HOST COLOR 2 NO-GAP,
            '    ' COLOR 2 NO-GAP.
  ENDAT.
ENDLOOP.
WRITE:  '       ' COLOR 2 NO-GAP,
        SYM_CUMULATED AS SYMBOL COLOR 2 NO-GAP,
        'appserv' COLOR 2 NO-GAP,
        '           ' COLOR 2 NO-GAP,
        SYM_CUMULATED AS SYMBOL COLOR 2 NO-GAP,
        'all     ' COLOR 2 NO-GAP.

LOOP AT RES.
  RES2-HOST = RES-HOST. RES2-TYPE = RES-TYPE. RES2-TIME = RES-TIME.
  APPEND RES2.
ENDLOOP.

SORT RES2 BY TYPE.
*reak-point.
LOOP AT RES2.
  AT NEW TYPE.
    WRITE: / RES2-TYPE COLOR 2.
  ENDAT.
  CASE RES2-HOST.
    WHEN '????'.
      WRITE 6 RES2-TIME.
      SALL = SALL + RES2-TIME.
      T3 = T3 + RES2-TIME.
    WHEN '????'.
      WRITE 26 RES2-TIME.
      SALL = SALL + RES2-TIME.
      SAPS = SAPS + RES2-TIME.
      T4 = T4 + RES2-TIME.
    WHEN '????'.
      WRITE 48 RES2-TIME.
      SALL = SALL + RES2-TIME.
      SAPS = SAPS + RES2-TIME.
      T5 = T5 + RES2-TIME.
    WHEN '????'.
      WRITE 69 RES2-TIME.
      SALL = SALL + RES2-TIME.
      SAPS = SAPS + RES2-TIME.
      T6 = T6 + RES2-TIME.
  ENDCASE.
  AT END OF TYPE.
    WRITE: 89 SAPS, 109 SALL.
    T1 = T1 + SALL. T2 = T2 + SAPS.
    SAPS = 0. SALL = 0.
  ENDAT.
ENDLOOP.
WRITE: / SYM_CUMULATED AS SYMBOL COLOR 2.
WRITE: 6 T3, 26 T4, 48 T5, 69 T6, 89 T2, 109 T1.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.