Posted: Sun Nov 25, 2007 2:20 am Post subject: How to get performance data from the STAT file
How to get performance data from the STAT file: user rank list by db. activity
Code:
REPORT ZUPDSTAT LINE-SIZE 164.
************************************************************************
* This is an example of how to dig out some interesting performance
* and statistical data from the STAT file.
* The program creates a rank list of users based upon their database
* update and read activity. The results are the accumulated database
* time and row number per user for the different categories:
* insert/delete/modify and sequential/direct read. The results can be
* sorted by any of these categories.
* There are a lot more interesting data in the STAT file that can
* be used to write similar programs.
************************************************************************
DATA: STATISTIC_VERSION_USED LIKE SAPWLPSTRC-VERSION.
DATA: SORT_FIELD(20).
* General input parameters: from/to, client, STAT file path
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T7.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) F1.
SELECTION-SCREEN POSITION 40.
PARAMETERS: FDAT LIKE SY-DATUM,
FTIM LIKE SY-UZEIT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) F2.
SELECTION-SCREEN POSITION 40.
PARAMETERS: TDAT LIKE SY-DATUM,
TTIM LIKE SY-UZEIT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) F4.
SELECTION-SCREEN POSITION 40.
PARAMETERS: CLI LIKE SY-MANDT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(35) F3.
SELECTION-SCREEN POSITION 40.
PARAMETERS: FILE(128) LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
* Sort order input
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE T5.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) F5.
SELECTION-SCREEN POSITION 40.
PARAMETERS: ASC RADIOBUTTON GROUP ORD,
DESC RADIOBUTTON GROUP ORD.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
* Sort criteria input
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE T6.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) T1.
SELECTION-SCREEN POSITION 62.
PARAMETERS: A1 RADIOBUTTON GROUP SORT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(55) T2.
SELECTION-SCREEN POSITION 62.
PARAMETERS: A2 RADIOBUTTON GROUP SORT.
PARAMETERS: A3 RADIOBUTTON GROUP SORT.
SELECTION-SCREEN POSITION 67.
PARAMETERS: A4 RADIOBUTTON GROUP SORT.
PARAMETERS: A5 RADIOBUTTON GROUP SORT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(55) T3.
SELECTION-SCREEN POSITION 62.
PARAMETERS: A6 RADIOBUTTON GROUP SORT.
PARAMETERS: A7 RADIOBUTTON GROUP SORT.
SELECTION-SCREEN POSITION 67.
PARAMETERS: A8 RADIOBUTTON GROUP SORT.
PARAMETERS: A9 RADIOBUTTON GROUP SORT.
SELECTION-SCREEN POSITION 72.
PARAMETERS: AA RADIOBUTTON GROUP SORT.
PARAMETERS: AB RADIOBUTTON GROUP SORT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(50) T4.
SELECTION-SCREEN POSITION 62.
PARAMETERS: AC RADIOBUTTON GROUP SORT.
PARAMETERS: AD RADIOBUTTON GROUP SORT.
SELECTION-SCREEN POSITION 67.
PARAMETERS: AE RADIOBUTTON GROUP SORT.
PARAMETERS: AF RADIOBUTTON GROUP SORT.
SELECTION-SCREEN POSITION 72.
PARAMETERS: AG RADIOBUTTON GROUP SORT.
PARAMETERS: AH RADIOBUTTON GROUP SORT.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B3.
*Internal tables
DATA: BEGIN OF V1_NORMAL_RECORDS OCCURS 100.
INCLUDE STRUCTURE SAPWLSTATR.
DATA: END OF V1_NORMAL_RECORDS.
DATA: BEGIN OF V2_NORMAL_RECORDS OCCURS 100.
INCLUDE STRUCTURE SAPWLPFNRM.
DATA: END OF V2_NORMAL_RECORDS.
DATA: BEGIN OF SUM OCCURS 100,
ACCOUNT(12),
READSEQREC TYPE I,
READSEQTI TYPE I,
READDIRREC TYPE I,
READDIRTI TYPE I,
UPDREC TYPE I,
UPDTI TYPE I,
DELREC TYPE I,
DELTI TYPE I,
INSREC TYPE I,
INSTI TYPE I,
SUM_RD_ROW TYPE I,
SUM_RD_TIM TYPE I,
SUM_MOD_ROW TYPE I,
SUM_MOD_TIM TYPE I,
SUM_ALL_ROW TYPE I,
SUM_ALL_TIM TYPE I,
END OF SUM.
*Initialize the selection screen
INITIALIZATION.
T1 = 'User Name'.
T2 = 'READ: Sequential(row/time) Direct(row/time)'.
T3 = 'Update(row/time) Delete(row/time) Insert(row/time)'.
T4 = 'SUM: Read(row/time) Modify(row/time) All(row/time)'.
T5 = 'Sort'.
T6 = 'By'.
T7 = 'Period, Client and STAT file'.
F1 = 'From: (date/time)'.
F2 = 'To: (date/time)'.
F3 = 'STAT file path(only for old stat)'.
F4 = 'Client'.
F5 = 'Ascending/Descending'.
* Write a page header
TOP-OF-PAGE.
WRITE: / 'User' COLOR 2,
14(15) 'Sequential read' COLOR 2,
30(15) 'Direct read' COLOR 2,
46(15) 'Update' COLOR 2,
62(15) 'Delete' COLOR 2,
78(15) 'Insert' COLOR 2,
94(15) 'Sum Read' COLOR 5,
110(15) 'Sum Modify' COLOR 5,
126(15) 'Sum All' COLOR 6.
WRITE: / 'name' COLOR 2,
14(6) 'rows' COLOR 2,
21(8) 'time(ms)' COLOR 2,
30(6) 'rows' COLOR 2,
37(8) 'time(ms)' COLOR 2,
46(6) 'rows' COLOR 2,
53(8) 'time(ms)' COLOR 2,
62(6) 'rows' COLOR 2,
69(8) 'time(ms)' COLOR 2,
78(6) 'rows' COLOR 2,
85(8) 'time(ms)' COLOR 2,
94(6) 'rows' COLOR 5,
101(8) 'time(ms)' COLOR 5,
110(6) 'rows' COLOR 5,
117(8) 'time(ms)' COLOR 5,
126(6) 'rows' COLOR 6,
133(8) 'time(ms)' COLOR 6.
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.