Trace Comparison

Embed Size (px)

Citation preview

*&---------------------------------------------------------------------**& Report ZTEST_VARUN_COMPARE_ST12_TRACE*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------** Problem: Compare Runtimes of Two SE30-Traces** Version: 3.50 Last Update: 2007.08.13* (Copy from GFP)** Recent changes:* Length of Exec-field, Layout of Overview, Aggregation**** Short Description of Check for Nonlinearity Coding:* ----------------------------------------------------* + Trace your program 2-times with different amount of data.* Always do a test run before you do the tracing* + View hit list in SE30* + Switch off filters* + For internal tables add lines to layout* + Order by net times descending* + Save hit list as local file ( .txt to your PC)** Start this program:* -------------------* + Type in the path of the 2 local files or select them* from selection screen** Step: 'Overview'* + Overview : Any contribution larger 10%* + Event-Profile: Where is the time spent?* + Compare : How many percent can not be compared?* + Nonlinearity : Is there anything nonlinear?** Step: 'N_LINEAR'* Requires input of LIN_FACT, which is the factor* between the 2 amounts of data.* Classification only nonlinear contributions are shown* Lines with Net1 < 1000 are neglected* Check column 'Nonlinear', for example 'Net 2 - Exec 2' means* the nonlinearity is caused by the calling program!** Step: 'D_CHECK'* All what is easily neglected** Step: 'A_RATIO' and 'A_DIFF'* All with ratios or differences**----------------------------------------------------------------------*REPORT ztest_varun_compare_st12_trace LINE-SIZE 300 .TYPE-POOLS: slis.* reuse types:TYPES:* longer than rlgrap-filename with test !! typ_path(140) TYPE c, typ_numb TYPE p DECIMALS 0, typ_int TYPE i, typ_cline(300) TYPE c.* type definitions ------------------------------------------------* raw tracefileTYPES: BEGIN OF st_file, cline TYPE typ_cline, END OF st_file, tab_file TYPE st_file OCCURS 0.* overheads for conversionTYPES: BEGIN OF st_offsets, no(2) TYPE n, " number (external) no_new(2) TYPE n, " number (internal) fieldname(10) TYPE c, " fieldname text(40) TYPE c, " text offset TYPE i, " offset length TYPE i, " length END OF st_offsets, tab_offsets TYPE st_offsets OCCURS 0.* offsets and length structureTYPES: BEGIN OF st_off_len, call TYPE i, exec TYPE i, net TYPE i, gross TYPE i, caller TYPE i, line TYPE i, call2 TYPE i, called TYPE i, END OF st_off_len.* converted trace as itabTYPES: BEGIN OF st_trace, code(2) TYPE c, " maintype(10) TYPE c, " functionality type subtype(20) TYPE c, " id TYPE c, subid TYPE c, call(150) TYPE c, " Function caller(32) TYPE c, " calling function line(12) TYPE n, execs TYPE p DECIMALS 0, " no of execuions gross TYPE p DECIMALS 0, " gross time net TYPE p DECIMALS 0, " net time netdexec TYPE p DECIMALS 0, mult TYPE i, END OF st_trace, tab_trace TYPE st_trace OCCURS 0.* pr_g type p decimals 1, " precentage gross time* pr_n type p decimals 1, " percentage net time* syst(4) type c, " system* db(20) type c, " db* compare result of 2 tracesTYPES: BEGIN OF st_both, maintype(10) TYPE c, " functionality type subtype(20) TYPE c, id TYPE c, subid TYPE c, call(150) TYPE c, " Function call2(150) TYPE c, caller(32) TYPE c, " calling function line(12) TYPE n, code(2) TYPE c, " compare success scale(1) TYPE c, text(30) TYPE c, mult2 TYPE i, mult1 TYPE i, gross2d1 TYPE p DECIMALS 1, gross2m1 TYPE p DECIMALS 0, grosss TYPE c, gross2 TYPE p DECIMALS 0, gross1 TYPE p DECIMALS 0, net2d1 TYPE p DECIMALS 1, net2m1 TYPE p DECIMALS 0, nets TYPE c, net2 TYPE p DECIMALS 0, net1 TYPE p DECIMALS 0, execs2d1 TYPE p DECIMALS 1, execs2m1 TYPE p DECIMALS 0, execss TYPE c, execs1 TYPE p DECIMALS 0, execs2 TYPE p DECIMALS 0, netdexec2 TYPE p DECIMALS 0, netdexec1 TYPE p DECIMALS 0,END OF st_both,tab_both TYPE st_both OCCURS 0.* trace header infoTYPES: BEGIN OF st_header,* locfile like rlgrap-filename, path LIKE rlgrap-filename, filename LIKE rlgrap-filename, aggregate(4) TYPE c, language(2) TYPE c, line TYPE c, events TYPE c, itabs TYPE c, sum_all TYPE p DECIMALS 0, count_all TYPE i, run_gross TYPE p DECIMALS 0, max_gross TYPE p DECIMALS 0, max_gross_type(20) TYPE c, run_net TYPE p DECIMALS 0, sum_load TYPE p DECIMALS 0, count_load TYPE i, sum_xyz TYPE p DECIMALS 0, count_xyz TYPE i, sum_class TYPE p DECIMALS 0, count_class TYPE i, count_noit_agg TYPE i, count_itab_agg TYPE i, sum_both TYPE p DECIMALS 0, count_both TYPE i, sum_one TYPE p DECIMALS 0, count_one TYPE i, END OF st_header.* trace basic infoTYPES: BEGIN OF st_over, text1(30) TYPE c, sum1 TYPE p DECIMALS 0, count1 TYPE i, text2(30) TYPE c, sum2 TYPE p DECIMALS 0, count2 TYPE i, text3(30) TYPE c, sum3 TYPE p DECIMALS 0, count3 TYPE i, text4(30) TYPE c, sum4 TYPE p DECIMALS 0, count4 TYPE i, text5(30) TYPE c, sum5 TYPE p DECIMALS 0, count5 TYPE i, text6(30) TYPE c, sum6 TYPE p DECIMALS 0, count6 TYPE i, text7(30) TYPE c, sum7 TYPE p DECIMALS 0, count7 TYPE i, text8(30) TYPE c, sum8 TYPE p DECIMALS 0, count8 TYPE i, text9(30) TYPE c, sum9 TYPE p DECIMALS 0, count9 TYPE i, text10(30) TYPE c, sum10 TYPE p DECIMALS 0, count10 TYPE i, text11(30) TYPE c, sum11 TYPE p DECIMALS 0, count11 TYPE i, END OF st_over, tab_over TYPE st_over OCCURS 0.* trace info textsTYPES: BEGIN OF st_texts, text(90) TYPE c, END OF st_texts, tab_texts TYPE st_texts OCCURS 0.* anoonymoous names:TYPES: BEGIN OF st_names, actual(150) TYPE c, numbered(11) TYPE c, END OF st_names, tab_names TYPE st_names OCCURS 0.* ALVTYPES: BEGIN OF st_textalv, key_0(2) TYPE n, key_1(2) TYPE n, key_2(2) TYPE n, key_3(2) TYPE n, key_4(2) TYPE n.INCLUDE TYPE slis_fieldcat_alv.TYPES END OF st_textalv.TYPES: tab_textalv TYPE st_textalv OCCURS 0.TYPES: BEGIN OF st_alv, icon(46) TYPE c.INCLUDE TYPE st_both.TYPES END OF st_alv.TYPES: tab_alv_both TYPE st_alv OCCURS 0.* trace countTYPES: BEGIN OF st_count, code(2) TYPE c, " compare success maintyp(10) TYPE c, " functionality type subtype(20) TYPE c, call(150) TYPE c, " Function call2(150) TYPE c, caller(32) TYPE c, " calling function call2m1 TYPE i, count1m2 TYPE i, count2 TYPE i, count1 TYPE i, END OF st_count, tab_count TYPE st_count OCCURS 0.* exceptions structureTYPES: BEGIN OF st_except, maintype(30) TYPE c, subtype(30) TYPE c, name1(100) TYPE c, name2(100) TYPE c, END OF st_except, tab_except TYPE st_except OCCURS 0.TYPES: BEGIN OF st_itab, call TYPE st_trace-call, exist TYPE i, END OF st_itab, tab_itab TYPE st_itab OCCURS 0.*----------------------------------------------------------------------------DATA:* Tables x_textalv TYPE tab_textalv, file_tab1 TYPE tab_file, file_tab2 TYPE tab_file, file_tab3 TYPE tab_file, trace1 TYPE tab_trace, trace2 TYPE tab_trace, in_both TYPE tab_both, itab1 TYPE tab_trace, itab2 TYPE tab_trace, out1 TYPE tab_trace, out2 TYPE tab_trace, out12 TYPE tab_both, out_trace TYPE tab_both, head_texts TYPE tab_texts, event_texts TYPE tab_texts, agg_texts TYPE tab_texts, compare_texts TYPE tab_texts, scale_texts TYPE tab_texts, extra_texts TYPE tab_texts, alv_both TYPE tab_alv_both, gt_outtab TYPE tab_alv_both, gt_names_call TYPE HASHED TABLE OF st_names WITH UNIQUE KEY actual, gt_names_prog TYPE HASHED TABLE OF st_names WITH UNIQUE KEY actual,* Structures off1 TYPE st_off_len, len1 TYPE st_off_len, off2 TYPE st_off_len, len2 TYPE st_off_len, header1 TYPE st_header, header2 TYPE st_header, pre_over_1 TYPE st_over, pre_over_2 TYPE st_over, scale1 TYPE st_over, scale2 TYPE st_over, extra1 TYPE st_over, extra2 TYPE st_over,* Global Variables: gv_locfile1 LIKE rlgrap-filename, gv_locfile2 LIKE rlgrap-filename, gv_alv TYPE c, gv_funct(9) TYPE c, gv_layout(9) TYPE c, gv_factor TYPE i, gv_n2 TYPE i, gv_n1 TYPE i, gv_limit TYPE i, gv_line TYPE c, gv_compare_full TYPE c, gv_mult_1 TYPE c, gv_mult_2 TYPE c, gv_overflow(1) TYPE c, gv_check TYPE c, gv_check_alv TYPE c, gv_check_itab TYPE c, gv_itab TYPE c VALUE '1',* gv_int_max type i value '2147483647', gv_int_max TYPE typ_numb VALUE '1000000000000', gv_n_execs TYPE i VALUE '1', gv_n_times TYPE i VALUE '1', gv_error TYPE c, gv_time_exec TYPE c, gv_anonym TYPE c, gv_numb_call(7) TYPE n, gv_numb_prog(7) TYPE n, gv_text_extra0(125) TYPE c, gv_text_extra1(125) TYPE c, gv_text_extra2(125) TYPE c, gv_text_extra3(125) TYPE c, gv_text_extra4(125) TYPE c, gv_def_path TYPE typ_path, except_f TYPE typ_path, ilen TYPE i, cline TYPE typ_cline. "Hilfsvariable fuer read dataset* OVERVIEW radiobutton group A,* N_LINEAR radiobutton group A,* D_CHECK radiobutton group A,* U_COMP radiobutton group A,* A_RATIO radiobutton group A,* A_DIFF radiobutton group A,*-----------------------------------------------------------------------PARAMETERS: hitlist1 TYPE typ_path , hitlist2 TYPE typ_path , n1(5) TYPE n , n2(5) TYPE n , a_ratio RADIOBUTTON GROUP a, a_diff RADIOBUTTON GROUP a, overview RADIOBUTTON GROUP a, u_comp RADIOBUTTON GROUP a, limit TYPE i DEFAULT'1000', full_agg AS CHECKBOX, time_ex AS CHECKBOX, anonym AS CHECKBOX.*GET PARAMETER id 'M_HIT1' field Hitlist1.*GET PARAMETER id 'M_HIT2' field Hitlist2.*GET PARAMETER id 'M_N1' field N1.*GET PARAMETER id 'M_N2' field N2.*-----------------------------------------------------------------------START-OF-SELECTION.* search Hitlist1 for ' '.* if sy-subrc eq 0.* ilen = sy-fdpos.* else.* ilen = '140'.* endif.* if ( ilen > '128' ).** write: / ' Length of Hitlist1 more than 128 characters'.* else.* gv_locfile1 = Hitlist1.* endif.** search Hitlist2 for ' '.* if sy-subrc eq 0.* ilen = sy-fdpos.* else.* ilen = '140'.* endif.* if ( ilen > '128' ).** write: / ' Length of Hitlist2 more than 128 characters'.* else.* gv_locfile2 = Hitlist2.* endif. gv_locfile1 = hitlist1. gv_locfile2 = hitlist2.* Linearity factor: gv_n2 = n2. gv_n1 = n1. gv_factor = gv_n2 / gv_n1. IF ( gv_layout EQ 'NONLINEAR' ). IF ( gv_factor = '0' ). gv_error = 'X'. WRITE: / 'Factor is missing, please insert'. SKIP. ENDIF. ENDIF.* Functions and Layouts: IF NOT ( overview IS INITIAL ). CLEAR gv_alv.* elseif not ( N_LINEAR is initial ).* gv_alv = 'X'.* gv_funct = 'NONLINEAR'.* gv_layout = 'RATIO'.* gv_ratio = 'X'.* elseif not ( D_CHECK is initial ).* gv_alv = 'X'.* gv_funct = 'CHECK'.* gv_layout = 'RATIO'.* gv_ratio = 'X'.* gv_rest = '1'. ELSEIF NOT ( u_comp IS INITIAL ). gv_alv = 'X'. gv_funct = 'UNCOMP'. gv_layout = 'UNCOMP'.* gv_rest = '2'. ELSEIF NOT ( a_ratio IS INITIAL ). gv_alv = 'X'. gv_funct = 'RATIO'. gv_layout = 'RATIO'.* gv_ratio = 'X'. ELSEIF NOT ( a_diff IS INITIAL ). gv_alv = 'X'. gv_funct = 'DIFF'. gv_layout = 'DIFF'.* clear gv_ratio. ENDIF. gv_limit = limit. IF NOT ( full_agg IS INITIAL ). gv_compare_full = 'X'. ENDIF. IF NOT ( time_ex IS INITIAL ). gv_time_exec = 'X'. ENDIF. IF NOT ( anonym IS INITIAL ). gv_anonym = 'X'. ENDIF.END-OF-SELECTION.*-----------------------------------------------------------------------* Init: read file 1 and convert*----------------------------------------------------------------------- PERFORM check_filenames USING '1' CHANGING gv_locfile1 header1-path header1-filename. PERFORM check_filenames USING '2' CHANGING gv_locfile2 header2-path header2-filename. PERFORM read_local_file TABLES file_tab1 USING gv_locfile1 'trace 1'. IF ( gv_locfile1 EQ gv_locfile2 ). gv_alv = 'X'. gv_funct = 'ONE'. gv_layout = 'ONE'. file_tab2[] = file_tab1[]. ELSE. PERFORM read_local_file TABLES file_tab2 USING gv_locfile2 'trace 2'. ENDIF.*----------------------------------------------------------------------- IF ( gv_error = 'X' ). EXIT. ENDIF.* header1-locfile = gv_locfile1.* header2-locfile = gv_locfile2.*-----------------------------------------------------------------------* Convert: Get layout and Convert*----------------------------------------------------------------------- PERFORM get_file_layout TABLES file_tab1 CHANGING len1 off1. PERFORM get_file_layout TABLES file_tab2 CHANGING len2 off2. PERFORM convert_file_loop TABLES file_tab1 trace1 itab1 head_texts event_texts USING len1 off1 pre_over_1 header1 'T1'. PERFORM convert_file_loop TABLES file_tab2 trace2 itab2 head_texts event_texts USING len2 off2 pre_over_2 header2 'T2'.* possible errorhandling: IF NOT ( gv_check IS INITIAL ). FORMAT INTENSIFIED ON. FORMAT COLOR OFF. WRITE: / 'Trace 1 is empty (', gv_locfile1,')'. WRITE: / 'Trace 2 is empty (', gv_locfile2,')'. FORMAT RESET. EXIT. ENDIF.*----------------------------------------------------------------------- IF ( gv_error = 'X' ). EXIT. ENDIF.*-----------------------------------------------------------------------* handling of the trace, compare etc.* internal tables separately*---------------------------------------------------------------------- PERFORM compare_events TABLES trace1 trace2 itab1 itab2 in_both USING header1 header2. PERFORM filter_traces TABLES in_both trace1 trace2 out_trace scale_texts USING header2 scale2 scale1. PERFORM extrapolate TABLES extra_texts USING scale2 extra2 extra1.*----------------------------------------------------------------------- IF ( gv_error = 'X' ). EXIT. ENDIF.*----------------------------------------------------------------------* Output*----------------------------------------------------------------------- IF ( gv_alv IS INITIAL ). PERFORM write_output TABLES scale_texts extra_texts USING header2 header1 pre_over_1 pre_over_2 scale1 scale2 extra1 extra2. ELSE. PERFORM fill_alv_text. PERFORM write_details_alv TABLES out_trace. ENDIF. hitlist1 = gv_locfile1. hitlist2 = gv_locfile2.************************************************************************************************************************************************* Block A: Uploadhandling**************************************************************************&---------------------------------------------------------------------**& Form CHECK_FILENAMES*&---------------------------------------------------------------------*FORM check_filenames USING no TYPE c CHANGING p_locfile TYPE rlgrap-filename lv_path TYPE rlgrap-filename lv_filename TYPE rlgrap-filename. DATA: def_path TYPE rlgrap-filename, x_locfile TYPE rlgrap-filename, chkfile TYPE string, l_exist TYPE c, text TYPE string, flag TYPE c, le TYPE i, file(300) TYPE c, path(300) TYPE c, p_filter TYPE string, l_rc TYPE i, l_up TYPE i, l_file_tab TYPE filetable, l_file_wa LIKE LINE OF l_file_tab, l_file TYPE STANDARD TABLE OF string, l_user_action TYPE i, p_path TYPE string, p_title TYPE string VALUE'Search'.*-----------------------------------------------------------------------* p_locfile is not initial* try to get path path and/or p_file1 or p_file2* try to create locfile1 and locfile2*----------------------------------------------------------------------- IF NOT ( p_locfile IS INITIAL ).* split p_locfile into path and filename IF ( p_locfile CS '\' ). flag = 'X'. WHILE ( flag EQ 'X' ). file = p_locfile+le. IF ( file CS '\' ). le = le + sy-fdpos + 1. ELSE. CLEAR flag. ENDIF. ENDWHILE. IF ( le > 0 ). path = p_locfile(le). ENDIF. ENDIF.* check file if p_locfile is more than a path IF file IS NOT INITIAL. text = p_locfile.*-----add '.txt' to filename if necessary: IF ( text CA '.txt' ). chkfile = text. ELSE. CONCATENATE text '.txt' INTO chkfile. ENDIF.*-----check whether the file exists: l_exist = cl_gui_frontend_services=>file_exist( file = chkfile ). IF l_exist = 'X'. p_locfile = chkfile. ELSE. CLEAR p_locfile. ENDIF.*---p_locfile is only a path ELSE. CLEAR p_locfile. ENDIF. ENDIF.*-----------------------------------------------------------------------* no or insufficient inputs to path and/or file* get the file from selection*----------------------------------------------------------------------- IF ( p_locfile IS INITIAL ). l_up = 1. IF path IS NOT INITIAL. p_path = path. ELSE. IF def_path IS NOT INITIAL. p_path = def_path. ENDIF. ENDIF. p_filter = cl_gui_frontend_services=>filetype_text. WHILE ( l_rc < 1 OR l_rc > l_up ). REFRESH l_file_tab[]. CALL METHOD cl_gui_frontend_services=>file_open_dialog EXPORTING window_title = p_title* DEFAULT_EXTENSION =* DEFAULT_FILENAME = file_filter = p_filter initial_directory = p_path multiselection = 'X'* WITH_ENCODING = CHANGING file_table = l_file_tab rc = l_rc user_action = l_user_action* FILE_ENCODING =* EXCEPTIONS* FILE_OPEN_DIALOG_FAILED = 1* CNTL_ERROR = 2* ERROR_NO_GUI = 3* NOT_SUPPORTED_BY_GUI = 4* others = 5 . IF sy-subrc 0.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. IF l_user_action = cl_gui_frontend_services=>action_cancel. LEAVE PROGRAM. ENDIF. ENDWHILE. READ TABLE l_file_tab INTO l_file_wa INDEX 1. IF ( sy-subrc EQ 0 ). p_locfile = l_file_wa-filename.* split p_locfile into path and filename IF NOT ( p_locfile IS INITIAL ). IF ( p_locfile CS '\' ). flag = 'X'. WHILE ( flag EQ 'X' ). file = p_locfile+le. IF ( file CS '\' ). le = le + sy-fdpos + 1. ELSE. CLEAR flag. ENDIF. ENDWHILE. IF ( le > 0 ). def_path = p_locfile(le). ENDIF. ENDIF. ENDIF. ENDIF. ENDIF. lv_path = def_path. lv_filename = file.* if ( no eq '1' ).* SET PARAMETER id 'M_HIT1' field p_locfile.* elseif ( no eq '2' ).* SET PARAMETER id 'M_HIT2' field p_locfile.* endif.* search Hitlist1 for ' '.* if sy-subrc eq 0.* ilen = sy-fdpos.* else.* ilen = '140'.* endif.* if ( ilen > '128' ).* write: / ' Length of Hitlist1 more than 128 characters'.* else.* gv_locfile1 = Hitlist1.* endif.** search Hitlist2 for ' '.* if sy-subrc eq 0.* ilen = sy-fdpos.* else.* ilen = '140'.* endif.* if ( ilen > '128' ).* write: / ' Length of Hitlist2 more than 128 characters'.* else.* gv_locfile2 = Hitlist2* endif.ENDFORM. "CHECK_FILENAMES*&---------------------------------------------------------------------**& Form READ_LOCAL_FILE*&---------------------------------------------------------------------** Read datafile from local PC file:* NOTE the function allows quite a few types in the interface* BUT only ASC ... is programed !!!!** Wkey_1: spreadsheet format !!*----------------------------------------------------------------------*FORM read_local_file TABLES file_tab TYPE tab_file USING p_locfile TYPE rlgrap-filename c TYPE c. DATA: version(4) TYPE c VALUE '6.20'.*---------------------------------------------------------------* VERSION 4.6: IF ( version EQ '4.6' ).* call function 'WS_UPLOAD'* exporting** CODEPAGE = ' '* filename = p_locfile* filetype = 'ASC'** HEADLEN = ' '** LINE_EXIT = ' '** TRUNCLEN = ' '** USER_FORM = ' '** USER_PROG = ' '** DAT_D_FORMAT = ' '** IMPORTING** FILELENGTH =* tables* data_tab = file_tab** EXCEPTIONS** CONVERSION_ERROR = 1** FILE_OPEN_ERROR = 2** FILE_READ_ERROR = 3** INVALID_TYPE = 4** NO_BATCH = 5** UNKNOWN_ERROR = 6** INVALID_TABLE_WIDTH = 7** GUI_REFUSE_FILETRANSFER = 8** CUSTOMER_ERROR = 9** OTHERS = 10.*-----------------------------------------------------------------------* Version 6.20 ELSE. DATA: l_it_tab TYPE STANDARD TABLE OF string, filename TYPE string, transfer TYPE string, l_wa_stfile TYPE st_file. filename = p_locfile. CALL METHOD cl_gui_frontend_services=>gui_upload EXPORTING filename = filename filetype = 'ASC'* HAS_FIELD_SEPARATOR = SPACE* HEADER_LENGTH = 0* DAT_MODE = SPACE* CODEPAGE = SPACE* IGNORE_CERR = ABAP_TRUE* REPLACEMENT = '#'* READ_BY_LINE = 'X'* IMPORTING* FILELENGTH =* HEADER = CHANGING data_tab = l_it_tab EXCEPTIONS file_open_error = 1 file_read_error = 2 no_batch = 3 gui_refuse_filetransfer = 4 invalid_type = 5 no_authority = 6 unknown_error = 7 bad_data_format = 8 header_not_allowed = 9 separator_not_allowed = 10 header_too_long = 11 unknown_dp_error = 12 access_denied = 13 dp_out_of_memory = 14 disk_full = 15 dp_timeout = 16 not_supported_by_gui = 17 error_no_gui = 18 OTHERS = 19.* no error: IF sy-subrc EQ 0. LOOP AT l_it_tab INTO transfer. l_wa_stfile = transfer. APPEND l_wa_stfile TO file_tab. ENDLOOP. ENDIF. ENDIF.* simple error-handling------------------- IF sy-subrc NE 0. gv_error = 'X'. WRITE: / 'Error in method GUI-Upload of', c. WRITE: / 'Exception Number:', sy-subrc. SKIP. ENDIF.ENDFORM. "read_local_file************************************************************************* Block B: Convert into internal format**************************************************************************&---------------------------------------------------------------------**& Form GET_FILE_LAYOUT*&---------------------------------------------------------------------**&---------------------------------------------------------------------*FORM get_file_layout TABLES file TYPE tab_file CHANGING off TYPE st_off_len len TYPE st_off_len. DATA: pt_all_offsets TYPE tab_offsets, c_call(90) TYPE c, c_caller(32) TYPE c, c_execs(14) TYPE c, c_gross(14) TYPE c, c_net(14) TYPE c, c_line(14) TYPE c, nc_execs(9) TYPE c, nc_gross(14) TYPE c, nc_net(14) TYPE c, nc_line(12) TYPE c, numbers(35) TYPE c, p TYPE p DECIMALS 4, nc(6) TYPE n, wa_names TYPE st_names, count TYPE i, count2 TYPE i.* Test Convert:------------------------------------------------- LOOP AT file INTO cline.* IF1: all lines not starting with '|' are ignored IF ( cline(1) EQ '|' ).* IF2: Summation line, ignore IF ( cline(2) EQ '|*' ).* Line with notes, ignore ELSEIF ( cline(2) EQ '|&' ).* Header line, determine layout, aggregation and language ELSEIF ( cline+3(197) CS 'Net' ).* IF3: 20061130: some traces can have several headers - only the first one is used IF ( count = '0' ).************************************************************** search all offsets in cline with '|' and get names PERFORM get_all_columns TABLES pt_all_offsets USING cline.* identify names PERFORM identify_names TABLES pt_all_offsets.* identify names PERFORM get_all_offsets TABLES pt_all_offsets CHANGING off len.************************************************************* count = 1. ENDIF.** Test one more line -------------------------- ELSE. count2 = count2 + 1. IF ( count2 > 5 ). EXIT. ENDIF. CLEAR c_call. CLEAR c_caller. CLEAR c_execs. CLEAR c_gross. CLEAR c_net. MOVE cline+off-call(len-call) TO c_call. MOVE cline+off-caller(len-caller) TO c_caller. MOVE cline+off-exec(len-exec) TO c_execs. MOVE cline+off-gross(len-gross) TO c_gross. MOVE cline+off-net(len-net) TO c_net.* Line is optional: c_line = '0'. IF ( len-line NE '0' ). MOVE cline+off-line(len-line) TO c_line. ENDIF.* replace and condense the fields containing number: REPLACE ALL OCCURRENCES OF '.' IN c_execs WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_net WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_gross WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_line WITH ''. REPLACE ALL OCCURRENCES OF ',' IN c_execs WITH ''. REPLACE ALL OCCURRENCES OF ',' IN c_net WITH ''. REPLACE ALL OCCURRENCES OF ',' IN c_gross WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_line WITH ''. CONDENSE c_execs NO-GAPS. CONDENSE c_gross NO-GAPS. CONDENSE c_net NO-GAPS. CONDENSE c_line NO-GAPS. CONCATENATE c_execs c_gross c_net c_line INTO numbers.* tests: IF ( numbers CO ' 0123456789.,' ). ELSE. gv_error = 'X'. WRITE: / 'Only numbers allowed'. SKIP. ENDIF.* 20061130 -some new traces set executions of 'Runtimes analysis' IF ( c_call(7) EQ 'Runtime' AND c_execs = '0' ). c_execs = '1'. ENDIF. ENDIF. ENDIF. ENDLOOP.ENDFORM. "PROCESS_OFFSETS*&---------------------------------------------------------------------**& Form 12111_GET_ALL_COLUMNS*&---------------------------------------------------------------------** Gets all offsets and text in header line*----------------------------------------------------------------------*FORM get_all_columns TABLES pt_all_offsets TYPE tab_offsets USING cline TYPE c. DATA:* text(100) TYPE C,* int TYPE i,* off TYPE i, wa TYPE st_offsets, offset TYPE i, length TYPE i, count TYPE i, cobj TYPE typ_cline, c1 TYPE typ_cline.* determine offset offset = 1. count = 1.* search for the first offsets: DO 30 TIMES.* offset = offset. IF ( offset GE '400' ). EXIT. ENDIF. cobj = cline+offset. SEARCH cobj FOR '|'. IF sy-subrc EQ 0. length = sy-fdpos. IF ( length GT '0' ). c1 = cline+offset(length). CONDENSE c1. CLEAR wa. wa-no = count. wa-text = c1. wa-offset = offset. wa-length = length. APPEND wa TO pt_all_offsets. offset = offset + length + 1. count = count + 1. ENDIF. ENDIF. ENDDO.ENDFORM. "1211_GET_ALL_COLUMNS*&---------------------------------------------------------------------**& Form 1211_IDENTIFY_NAMES*&---------------------------------------------------------------------** Typ A NOT=Not aggregated:* 8 Tabs/Offsets and 7 lengths of arbitrary size** 1. N * Anz. = No.* 2. N * Brutto = Gross* 3. N * Netto = Net* 4. C * Aufruf = Call* 5. C = In program* 6. C * Typ = Type* 7. C AnzFiltergruppe = Display filter group*** Typ B FULL= fully aggreagtate:* 11 Tabs/Offsets and 10 Lengths of arbitrary size** 1. C * Aufruf = Call* 2. N * Anz. = No.* 3. N * Brutto = Gross* 4. =* 5. N * Netto = Net* 6. N Brut.% = Gross(%)* 7. N Net.% = Net(%)* 8. C * Programmname = Program Name* 9. C * Typ = Type* 10. C AnzFiltergruppe = Display filter group*----------------------------------------------------------------------*FORM identify_names TABLES pt_all_offsets TYPE tab_offsets. DATA: prod TYPE f, wa TYPE st_offsets, c1 TYPE typ_cline. LOOP AT pt_all_offsets INTO wa. c1 = wa-text.* no used columns get 99 and 'xx'----------------------------* 99: % IF ( c1 CS '%'* 99: = OR c1 CS '='* 99: TYPE: Typ - Type. OR c1 CS 'Typ' OR c1 CS 'Type'* 99 FILTER OR c1 CS 'AnzFilter' OR c1 CS 'No. Filter' OR c1 CS 'Display Filter'* 99 I and Subid OR c1 = 'I' OR c1 = 'S' ). wa-fieldname = 'xx'. wa-no_new = '99'. ELSE.* Mandatory and optional fields-------------------------------* PROG: IF ( c1 CS 'Prog' ).* 5 PROG: Rufendes - Calling - In Prog IF ( c1 CS 'Rufendes' OR c1 CS 'Calling' OR c1 CS 'In Prog' OR c1 CS 'Programmname' OR c1 CS 'Program Name' ). wa-fieldname = 'Caller'. wa-no_new = '5'.* 9 CALLLED: geruf - Called ELSEIF ( c1 CS 'Geruf' OR c1 CS 'Source' OR c1 CS 'Called' OR c1 EQ 'Program' ). wa-fieldname = 'Called'. wa-no_new = '9'. ENDIF.* 1 CALL - Aufruf ELSEIF ( c1 CS 'Aufruf' OR c1 CS 'Call' OR c1 CS 'Statement' OR c1 CS 'Hierarchy' ). IF ( c1 CS '(cont.)' ). wa-fieldname = 'CALL_2'. wa-no_new = '11'. ELSE. wa-fieldname = 'CALL'. wa-no_new = '1'. ENDIF.* 2 EXEC: Anz - No - Number ELSEIF ( c1 CS 'Anz' OR c1 CS 'No' OR c1 CS 'Number' OR c1 CS 'Hits' ). wa-fieldname = 'Exec'. wa-no_new = '2'.* 3 GROSS: Brutto - Gross ELSEIF ( c1 CS 'Netto' OR c1 CS 'Net' ). wa-fieldname = 'Net'. wa-no_new = '3'.* 4 GROSS: Brutto - Gross ELSEIF ( c1 CS 'Brutto' OR c1 CS 'Gross' ). wa-fieldname = 'Gross'. wa-no_new = '4'.* 6 LINE: Zeile - Line ELSEIF ( c1 CS 'Zeile' OR c1 CS 'Line' OR c1 CS 'ContOff' ). wa-fieldname = 'Line'. wa-no_new = '6'.*---------------------------------------------------------* no original ELSEIF ( c1(3) CS 'Bug' ). wa-fieldname = 'Bug'. wa-no_new = '20'. ENDIF. ENDIF. MODIFY pt_all_offsets FROM wa. ENDLOOP.* mandatory offsets: SORT pt_all_offsets BY no_new. LOOP AT pt_all_offsets INTO wa. IF ( wa-fieldname IS INITIAL ). BREAK-POINT. ENDIF. ENDLOOP.ENDFORM. "1211_IDENTIFY_NAMES*&---------------------------------------------------------------------**& Form GET_ALL_OFFSETS*&---------------------------------------------------------------------*** 1. CALL: Aufruf, Call* 2. EXEC: Anz., No.* 3. NET Netto, Net** 4. GROSS Brutto, Gross* 5. CALLER Programmname, Programm, In program* 6. LINE* 7. CALL2 for ST12 longer Name**&---------------------------------------------------------------------*FORM get_all_offsets TABLES pt_all_offsets TYPE tab_offsets CHANGING off TYPE st_off_len len TYPE st_off_len. DATA: wa TYPE st_offsets. LOOP AT pt_all_offsets INTO wa. IF ( wa-no_new EQ '01' ). off-call = wa-offset. len-call = wa-length. ELSEIF ( wa-no_new EQ '02' ). off-exec = wa-offset. len-exec = wa-length. ELSEIF ( wa-no_new EQ '03' ). off-net = wa-offset. len-net = wa-length. ELSEIF ( wa-no_new EQ '04' ). off-gross = wa-offset. len-gross = wa-length. ELSEIF ( wa-no_new EQ '05' ). off-caller = wa-offset. len-caller = wa-length. ELSEIF ( wa-no_new EQ '06' ). off-line = wa-offset. len-line = wa-length. ELSEIF ( wa-no_new EQ '07' ). off-call2 = wa-offset. len-call2 = wa-length. ELSEIF ( wa-no_new EQ '09' ). off-called = wa-offset. len-called = wa-length. ENDIF. ENDLOOP.ENDFORM. "GET_ALL_OFFSETS*&---------------------------------------------------------------------**& Form DETERMINE_LANGUAGE_AGGREGATION*&---------------------------------------------------------------------*FORM determine_language_aggregation USING cline TYPE c CHANGING aggregate TYPE c language TYPE c. DATA: no_language TYPE i.* determine aggregate and language: IF ( cline CS 'Anz' OR cline CS 'Aufruf' OR cline CS 'Brutto' ). language = 'DE'. no_language = 1. ENDIF. IF ( cline CS 'No' OR cline CS 'Call' OR cline CS 'Gross' ). language = 'EN'. no_language = no_language + 1. ENDIF. IF ( no_language = '1' ).* everything o.k. ELSEIF ( no_language = '0' ). gv_error = 'X'. WRITE: / 'E201: Language can not be determined'. SKIP. ELSEIF ( no_language = '2' ). gv_error = 'X'. WRITE: / 'E201: Language can not be determined'. SKIP. ENDIF.* aggregation type IF ( cline CS '=' ). aggregate = 'NONE'. ELSE. aggregate = 'FULL'. ENDIF.ENDFORM. "DETERMINE_LANGUAGE_AGGREGATION*&---------------------------------------------------------------------**& Form CONVERT_FILE_LOOP*&---------------------------------------------------------------------** Convert file to internal table* Release dependent file*----------------------------------------------------------------------*FORM convert_file_loop TABLES file TYPE tab_file trace TYPE tab_trace trace_x TYPE tab_trace head_texts TYPE tab_texts event_texts TYPE tab_texts USING len TYPE st_off_len off TYPE st_off_len over TYPE st_over header TYPE st_header code TYPE c. DO 10 TIMES. CLEAR gv_overflow. PERFORM convert_file TABLES file trace trace_x head_texts event_texts USING len off over header code. IF ( gv_overflow = 'X' ). ELSE. EXIT. ENDIF. ENDDO.ENDFORM. " CONVERT_FILE_LOOP*&---------------------------------------------------------------------**& Form CONVERT_FILE*&---------------------------------------------------------------------** Convert file to internal table* Release dependent file*----------------------------------------------------------------------*FORM convert_file TABLES file TYPE tab_file trace TYPE tab_trace trace_x TYPE tab_trace head_texts TYPE tab_texts event_texts TYPE tab_texts USING off TYPE st_off_len len TYPE st_off_len event TYPE st_over header TYPE st_header code TYPE c. DATA:* event classes type_a(2) TYPE c VALUE 'A', type_b(2) TYPE c VALUE 'B', type_c(2) TYPE c VALUE 'C', type_d(2) TYPE c VALUE 'D', type_e(2) TYPE c VALUE 'E', type_x(2) TYPE c VALUE 'X', type_z1(2) TYPE c VALUE 'Z1', type_z2(2) TYPE c VALUE 'Z2', type_z3(2) TYPE c VALUE 'Z3', text_abap(25) TYPE c VALUE 'A Modul Int ', text_rfc(25) TYPE c VALUE 'B Modul Ext ', text_itab(25) TYPE c VALUE 'C Interal Tables ', text_buf(25) TYPE c VALUE 'D Data Access Internal', text_db(25) TYPE c VALUE 'E Data Access External ', text_x(25) TYPE c VALUE 'X Others ', text_z(12) TYPE c VALUE 'Z Special', abap_trace TYPE tab_trace, rfc_trace TYPE tab_trace, itab_trace TYPE tab_trace, buf_trace TYPE tab_trace, db_trace TYPE tab_trace, x_trace TYPE tab_trace, x_trace_x TYPE tab_trace, z_trace TYPE tab_trace, xyz_trace TYPE tab_trace, sum_abap TYPE p DECIMALS 0, sum_rfc TYPE p DECIMALS 0, sum_it TYPE p DECIMALS 0, sum_buf TYPE p DECIMALS 0, sum_db TYPE p DECIMALS 0, sum_x TYPE p DECIMALS 0, sum_z TYPE p DECIMALS 0, count_abap TYPE i, count_rfc TYPE i, count_it TYPE i, count_buf TYPE i, count_db TYPE i, count_x TYPE i, count_z TYPE i, sum_load TYPE p DECIMALS 0, sum_xyz TYPE p DECIMALS 0, sum_all TYPE p DECIMALS 0, sum_class TYPE p DECIMALS 0, count_runtime TYPE i, count_load TYPE i, count_xyz TYPE i, count_all TYPE i, count_class TYPE i, no_rows TYPE i, gross_runtime TYPE p DECIMALS 0, gross_max TYPE p DECIMALS 0, max_gross_type LIKE trace-subtype, net_runtime TYPE p DECIMALS 0,* Itab numbers p TYPE p DECIMALS 4, offset TYPE i, nc(6) TYPE n, c_call(90) TYPE c, c_caller(32) TYPE c, c_called(32) TYPE c,* x_syst(4) type c, c_execs(14) TYPE c, c_gross(14) TYPE c, c_net(14) TYPE c, c_id TYPE c, c_subid TYPE c, c_line(14) TYPE c, nc_execs(9) TYPE c, nc_gross(14) TYPE c, nc_net(14) TYPE c, nc_line(12) TYPE c, numbers(35) TYPE c, wa_names TYPE st_names, count TYPE i.*----------------------------------------------------------------------- DESCRIBE TABLE file LINES no_rows. no_rows = no_rows - 4.* Convert:--------------------------------------------------- CLEAR count. LOOP AT file INTO cline.* only lines with '|' IF ( cline(1) EQ '|' ).* No Summation line, ignore IF ( cline(2) EQ '|*' ).* Line with notes, ignore ELSEIF ( cline(2) EQ '|&' ).* Header line, determine layout, aggregation and language ELSEIF ( cline CS 'Net' ).* process if aggregation type is known:-------------------- ELSE. CLEAR c_call. CLEAR c_caller. CLEAR c_execs. CLEAR c_gross. CLEAR c_net. MOVE cline+off-call(len-call) TO c_call. MOVE cline+off-caller(len-caller) TO c_caller. IF ( off-called 0 AND len-called 0 ). MOVE cline+off-called(len-called) TO c_called. ELSE. c_called = ''. ENDIF. MOVE cline+off-exec(len-exec) TO c_execs. MOVE cline+off-gross(len-gross) TO c_gross. MOVE cline+off-net(len-net) TO c_net.* Line is optional IF ( len-line NE '0' ). MOVE cline+off-line(len-line) TO c_line. ELSE. c_line = '0'. ENDIF.** ID and SUBID optional* if ( len_id ne '0' and len_subid ne '0' ).* move cline+off_id(len_id) to c_id.* move cline+off_subid(len_subid) to c_subid.* endif.* replace and condense the fields containing number: REPLACE ALL OCCURRENCES OF '.' IN c_execs WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_net WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_gross WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_line WITH ''. REPLACE ALL OCCURRENCES OF ',' IN c_execs WITH ''. REPLACE ALL OCCURRENCES OF ',' IN c_net WITH ''. REPLACE ALL OCCURRENCES OF ',' IN c_gross WITH ''. REPLACE ALL OCCURRENCES OF '.' IN c_line WITH ''. CONDENSE c_execs NO-GAPS. CONDENSE c_gross NO-GAPS. CONDENSE c_net NO-GAPS. CONDENSE c_line NO-GAPS. CONCATENATE c_execs c_gross c_net c_line INTO numbers.* tests: IF ( numbers CO ' 0123456789.,' ). ELSE. gv_error = 'X'. WRITE: / 'Only numbers allowed'. SKIP. ENDIF.* 20061130 -some new traces set executions of 'Runtimes analysis'* - corrected IF ( c_call(7) EQ 'Runtime' AND c_execs = '0' ). c_execs = '1'. ENDIF.* if ( c_execs = '0' ).* gv_error = 'X'.* write: / 'Number of executions zero should not appear'.* skip.* endif.*--------------------------------------------------------------* Conversion and check for overflow CLEAR trace. trace-code = code. trace-call = c_call. trace-caller = c_caller. IF ( c_caller IS INITIAL ). trace-caller = c_called. ENDIF. trace-id = c_id. trace-subid = c_subid. trace-line = c_line.* values nc_execs = c_execs. nc_execs = nc_execs / gv_n_execs. IF ( nc_execs < gv_int_max ). trace-execs = nc_execs. ELSE. gv_n_execs = gv_n_execs * 10. gv_overflow = 'X'. ENDIF. nc_gross = c_gross. nc_gross = c_gross / gv_n_times. nc_net = c_net. nc_net = nc_net / gv_n_times. IF ( nc_gross < gv_int_max AND nc_net < gv_int_max ). trace-gross = nc_gross. trace-net = nc_net. ELSE. gv_n_times = gv_n_times * 10. gv_overflow = 'X'. ENDIF. p = trace-net / trace-execs. trace-netdexec = p.* Overflow: IF ( gv_overflow = 'X' ). gv_error = 'X'. WRITE: / 'E111: Overflow'. SKIP. ENDIF.*-----------------------------------------------------------------------* types and subtypes:------------------------------------------------- sum_all = sum_all + trace-net. count_all = count_all + 1.*----------------------------------------------------------------------* Start of classification:* Type A: Modularisation** functions---------------------------: IF ( trace-call(10) EQ 'Call Func.' ). trace-subtype = 'Call Function'. trace-call = trace-call+11. trace-maintype = type_a. ELSEIF ( trace-call(8) EQ 'Function' ). trace-subtype = 'Call Function'. trace-call = trace-call+9. trace-maintype = type_a.* forms----------------------------------------------: ELSEIF ( trace-call(7) EQ 'Perform' OR trace-call(7) EQ 'PERFORM' ). IF ( trace-call+8(3) EQ 'Ext' OR trace-call+8(3) EQ 'EXT' ). trace-subtype = 'Ext. Perform'. trace-call = trace-call+13. ELSE. trace-subtype = 'Perform'. trace-call = trace-call+8. ENDIF. trace-maintype = type_a.* methods-------------------------------------------: ELSEIF ( trace-call(7) EQ 'Call M.' ). trace-subtype = 'Call Method'. trace-call = trace-call+8. trace-maintype = type_a. ELSEIF ( trace-call(11) EQ 'Call method' ). trace-subtype = 'Call Method'. trace-call = trace-call+12. trace-maintype = type_a.*----------------------------------------------------------------------* B: remote function calls ELSEIF ( trace-call(12) EQ 'Wait for RFC' ). trace-subtype = 'Wait for RFC'. trace-call = trace-call+13. trace-maintype = type_b. ELSEIF ( trace-call(3) EQ 'Rfc' OR trace-call(3) EQ 'RFC' ). trace-subtype = 'RFC:'. trace-call = trace-call+4. trace-maintype = type_b.*----------------------------------------------------------------------* C: Internal tables: ELSEIF ( trace-call(6) EQ 'Append' ). trace-subtype = 'Append'. trace-maintype = type_c.* nc = trace-call+10.* trace-call = nc. trace-call = trace-call+7. ELSEIF ( trace-call(7) EQ 'Collect' ). trace-subtype = 'Collect'. trace-maintype = type_c.* nc = trace-call+11.* trace-call = nc. trace-call = trace-call+8. ELSEIF ( trace-call(6) EQ 'Modify' ). trace-subtype = 'Modify'. trace-maintype = type_c.* nc = trace-call+10.* trace-call = nc. trace-call = trace-call+7. ELSEIF ( trace-call(7) EQ 'Loop at' ). trace-subtype = 'Loop at'. trace-maintype = type_c.* nc = trace-call+11.* trace-call = nc. trace-call = trace-call+8. ELSEIF ( trace-call(4) EQ 'Sort' ). trace-subtype = 'Sort'. trace-maintype = type_c.* nc = trace-call+8.* trace-call = nc. trace-call = trace-call+5.** Very similar events can appear on buffered tables** Read Table, Delete, Insert ELSEIF ( trace-call(10) EQ 'Read Table' ). trace-subtype = 'Read Table'. trace-maintype = type_c.* nc = trace-call+14.* trace-call = nc. trace-call = trace-call+11. ELSEIF ( trace-call(6) EQ 'Delete' ). trace-subtype = 'Delete'. trace-maintype = type_c.* nc = trace-call+10.* trace-call = nc. trace-call = trace-call+7. ELSEIF ( trace-call(6) EQ 'Insert' ). trace-subtype = 'Insert'. trace-maintype = type_c.* nc = trace-call+10.* trace-call = nc. trace-call = trace-call+7.*----------------------------------------------------------------------* D: Buffer ELSEIF ( trace-call(10) EQ 'DB-Buffer:' OR trace-call(10) EQ 'DB Buffer:' ). trace-maintype = type_d. IF ( trace-call+11(5) EQ 'Close' ). trace-subtype = 'DB-Buffer: Close'. trace-call = trace-call+17. ELSEIF ( trace-call+11(4) EQ 'Open' ). trace-subtype = 'DB-Buffer: Open'. trace-call = trace-call+16. ELSEIF ( trace-call+11(5) EQ 'Fetch' ). trace-subtype = 'DB-Buffer: Fetch'. trace-call = trace-call+17. ELSEIF ( trace-call+11(3) EQ 'Get' ). trace-subtype = 'DB-Buffer: Get'. trace-call = trace-call+15. ELSEIF ( trace-call+11(4) EQ 'Load' ). trace-subtype = 'DB-Buffer: Load'. trace-call = trace-call+16. ELSEIF ( trace-call+11(6) EQ 'Modify' ). trace-subtype = 'DB-Buffer: Modify'. trace-call = trace-call+18. ELSE. trace-maintype = type_z3. ENDIF.* Data Buffer: ELSEIF ( trace-call(23) EQ 'Import FROM DATA BUFFER' OR trace-call(23) EQ 'Import From Data Buffer' ). trace-subtype = 'Import from Data buffer'. trace-call = trace-call+24. trace-maintype = type_d. ELSEIF ( trace-call(21) EQ 'Export TO DATA BUFFER' OR trace-call(21) EQ 'Export To Data Buffer' ). trace-subtype = 'Export to Data buffer'. trace-call = trace-call+22. trace-maintype = type_d.* Memory ELSEIF ( trace-call(16) EQ 'Export to Memory' OR trace-call(16) EQ 'Export To Memory' ). trace-subtype = 'Export to Memory'. trace-call = trace-call+17. trace-maintype = type_d. ELSEIF ( trace-call(18) EQ 'Import from Memory' OR trace-call(18) EQ 'Import From Memory' ). trace-subtype = 'Import from Memory'. trace-call = trace-call+19. trace-maintype = type_d. ELSEIF ( trace-call(23) EQ 'Export to Shared Buffer' OR trace-call(23) EQ 'Export To Shared Buffer' ). trace-subtype = 'Export to Shared Buffer'. trace-call = trace-call+24. trace-maintype = type_d. ELSEIF ( trace-call(25) EQ 'Import from Shared Buffer' OR trace-call(25) EQ 'Import From Shared Buffer' ). trace-subtype = 'Import from Shared Buffer'. trace-call = trace-call+26. trace-maintype = type_d. ELSEIF ( trace-call(23) EQ 'Export to Shared Memory' OR trace-call(23) EQ 'Export To Shared Memory' ). trace-subtype = 'Export to Shared Memory'. trace-call = trace-call+24. trace-maintype = type_d. ELSEIF ( trace-call(25) EQ 'Import from Shared Memory' OR trace-call(25) EQ 'Import From Shared Memory' ). trace-subtype = 'Import from Shared Memory'. trace-call = trace-call+26. trace-maintype = type_d. ELSEIF ( trace-call(21) EQ 'Export internal table'). trace-subtype = 'Export to internal table'. trace-call = trace-call+24. trace-maintype = type_d. ELSEIF ( trace-call(24) EQ 'Export To Internal Table'). trace-subtype = 'Export to internal table'. trace-call = trace-call+26. trace-maintype = type_d. ELSEIF ( trace-call(21) EQ 'Import internal table'). trace-subtype = 'Import internal table'. trace-call = trace-call+22. trace-maintype = type_d. ELSEIF ( trace-call(26) EQ 'Import From Internal Table'). trace-subtype = 'Import from internal table'. trace-call = trace-call+27. trace-maintype = type_d.* DBMS Part of the DB Statement! ELSEIF ( trace-call(11) EQ 'Open Cursor' ). trace-subtype = 'Open Cursor'. trace-call = trace-call+12. trace-maintype = type_d. ELSEIF ( trace-call(12) EQ 'Close Cursor' ). trace-subtype = 'DB: Close Cursor'. trace-call = trace-call+13. trace-maintype = type_d. ELSEIF ( trace-call(5) EQ 'Fetch' ). trace-subtype = 'DB: Fetch'. trace-call = trace-call+6. trace-maintype = type_d.*-----------------------------------------------------------------------* E: Database operations external:* DB Op. ELSEIF ( trace-call(6) EQ 'DB-Op.' OR trace-call(3) EQ 'DB:' ). trace-maintype = type_e. IF ( trace-call(17) EQ 'DB-Op. OpenCursor' ). trace-subtype = 'DB: Open Cursor'. trace-call = trace-call+18. ELSEIF ( trace-call(18) EQ 'DB-Op. CloseCursor' ). trace-subtype = 'DB: Close Cursor'. trace-call = trace-call+19. ELSEIF ( trace-call(18) EQ 'DB-Op. FetchCursor' ). trace-subtype = 'DB: Fetch Cursor'. trace-call = trace-call+19. ELSEIF ( trace-call(17) EQ 'DB-Op. ExecStatic' ). trace-subtype = 'DB: Exec Static'. trace-call = trace-call+18. ELSEIF ( trace-call(11) EQ 'DB-Op. Exec' ). trace-subtype = 'DB: Exec'. trace-call = trace-call+12. ELSEIF ( trace-call(8) EQ 'DB: Exec' ). trace-subtype = 'DB: Exec'. trace-call = trace-call+9. ELSEIF ( trace-call(12) EQ 'DB-Op. Fetch' ). trace-subtype = 'DB: Fetch'. trace-call = trace-call+13. ELSEIF ( trace-call(12) EQ 'DB-Op. Close' ). trace-subtype = 'DB: Close'. trace-call = trace-call+13. ELSEIF ( trace-call(9) EQ 'DB: Fetch' ). trace-subtype = 'DB: Fetch'. trace-call = trace-call+10. ELSEIF ( trace-call(11) EQ 'DB-Op. Open' ). trace-subtype = 'DB: Open Cursor'. trace-call = trace-call+12. ELSEIF ( trace-call(8) EQ 'DB: Open' ). trace-subtype = 'DB: Open Cursor'. trace-call = trace-call+9. ELSEIF ( trace-call(15) EQ 'DB-Op. PrepStmt' ). trace-subtype = 'DB: Prep Stmt.'. trace-call = trace-call+16. ELSEIF ( trace-call(11) EQ 'DB-Op. Prep' ). trace-subtype = 'DB: Prepare'. trace-call = trace-call+12. ELSEIF ( trace-call(11) EQ 'DB: Prepare' ). trace-subtype = 'DB: Prepare'. trace-call = trace-call+12.* unrecognized ELSE. trace-maintype = type_z3. ENDIF.*------ ELSEIF ( trace-call(13) EQ 'Select Single' ). trace-subtype = 'Select Single'. trace-call = trace-call+14. trace-maintype = type_e.* Special in ST12: SELECT ELSEIF ( trace-call(6) EQ 'Select' ). trace-subtype = 'Select'. trace-call = trace-call+7. trace-maintype = type_e. ELSEIF ( trace-call(15) EQ 'Select Count(*)' ). trace-subtype = 'Select Count(*)'. trace-call = trace-call+16. trace-maintype = type_e. ELSEIF ( trace-call(11) EQ 'Commit Work' ). trace-subtype = 'Commit Work'. trace-call = trace-call+12. trace-maintype = type_e. ELSEIF ( trace-call(13) EQ 'NatSQL Commit' ). trace-subtype = 'NatSQL Commit'. trace-call = trace-call+14. trace-maintype = type_e. ELSEIF ( trace-call(19) EQ 'NatSQL SelectSingle' ). trace-subtype = 'NatSQL Sel Single'. trace-call = trace-call+20. trace-maintype = type_e. ELSEIF ( trace-call(24) EQ 'NatSQL Execute Procedure' ). trace-subtype = 'NatSQL Exec Procedure'. trace-call = trace-call+25. trace-maintype = type_e.* Native SQL ELSEIF ( trace-call(11) EQ 'Native SQL:' ). trace-maintype = type_e. IF ( trace-call+12(16) EQ 'Execute Procedure' ). trace-subtype = 'Native SQL: Exec Procedure'. trace-call = trace-call+30. ELSEIF ( trace-call+12(14) EQ 'Set Connection' ). trace-subtype = 'Native SQL: Set Connection'. trace-call = trace-call+28. ELSEIF ( trace-call+12(12) EQ 'SelectSingle' ). trace-subtype = 'Native SQL: Select Single'. trace-call = trace-call+26. ELSEIF ( trace-call+12(6) EQ 'Conect' ). trace-subtype = 'Native SQL: Connect'. trace-call = trace-call+19. ELSEIF ( trace-call+12(6) EQ 'Commit' ). trace-subtype = 'Native SQL: Commit'. trace-call = trace-call+19. ENDIF. ELSEIF ( trace-call(6) EQ 'Update' ). trace-subtype = 'Update'. trace-call = trace-call+7. trace-maintype = type_e. ELSEIF ( trace-call(6) EQ 'Insert' ). trace-subtype = 'Insert'. trace-call = trace-call+7. trace-maintype = type_e. ELSEIF ( trace-call(12) EQ 'Array Insert' ). trace-subtype = 'Array Insert'. trace-call = trace-call+13. trace-maintype = type_e. ELSEIF ( trace-call(12) EQ 'Array Update' ). trace-subtype = 'Array Update'. trace-call = trace-call+13. trace-maintype = type_e. ELSEIF ( trace-call(12) EQ 'Array Delete' ). trace-subtype = 'Array Delete'. trace-call = trace-call+13. trace-maintype = type_e. ELSEIF ( trace-call(12) EQ 'Array Modify' ). trace-subtype = 'Array Modify'. trace-call = trace-call+13. trace-maintype = type_e. ELSEIF ( trace-call(6) EQ 'Delete' ). trace-subtype = 'Delete'. trace-call = trace-call+7. trace-maintype = type_e.* Nametab, Textpool, Export, Import ELSEIF ( trace-call(20) EQ 'Import from Database' OR trace-call(20) EQ 'Import From Database' ). trace-subtype = 'Import from Database'. trace-call = trace-call+21. trace-maintype = type_e. ELSEIF ( trace-call(18) EQ 'Export to Database' OR trace-call(18) EQ 'Export To Database' ). trace-subtype = 'Export to Database'. trace-call = trace-call+18. trace-maintype = type_e. ELSEIF ( trace-call(14) EQ 'Import Nametab' ). trace-subtype = 'Import Namtab'. trace-call = trace-call+15. trace-maintype = type_e. ELSEIF ( trace-call(14) EQ 'Export Nametab' ). trace-subtype = 'Export FROM DB'. trace-call = trace-call+15. trace-maintype = type_e. ELSEIF ( trace-call(13) EQ 'Read Textpool' ). trace-subtype = 'Read Textpool'. trace-call = trace-call+14. trace-maintype = type_e. ELSEIF ( trace-call(11) EQ 'Read Report' ). trace-subtype = 'Read Report'. trace-call = trace-call+12. trace-maintype = type_e.*-----------------------------------------------------------------------* X: System:* elseif ( x_syst(4) eq 'Syst' or x_syst(4) eq 'Sys.' ). ELSEIF ( trace-call(11) EQ 'Storage Get'). trace-subtype = 'Storage Get'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'Storage Free'). trace-subtype = 'Storage Free'. trace-call = trace-call+13. trace-maintype = type_x. ELSEIF ( trace-call(16) EQ 'Pgm-Globals Init'). trace-subtype = 'Pgm-Globals Init'. trace-call = trace-call+17. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'PXA-Search'). trace-subtype = 'PXA-Search'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(19) EQ 'Export, Import, ...'). trace-subtype = 'Export, Import, ...'. trace-call = trace-call+20. trace-maintype = type_x.* Dynpro Screen ..... ELSEIF ( trace-call(10) EQ 'DCI Dynpro' ). trace-subtype = 'DCI Dynpro'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'DCI Screen' ). trace-subtype = 'DCI Screen'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'DCO Dynpro' ). trace-subtype = 'DCO Dynpro'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'DCO Screen' ). trace-subtype = 'DCO Screen'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'EOD Dynpro' ). trace-subtype = 'EOD Dynpro'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'EOD Screen' ). trace-subtype = 'EOD Screen'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'PAI Dynpro' ). trace-subtype = 'PAI Dynpro'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'PAI screen' ). trace-subtype = 'PAI Screen'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'PBO Dynpro' ). trace-subtype = 'PBO Dynpro'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'PBO screen' ). trace-subtype = 'PBO Screen'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'Dynpro Entry'). trace-subtype = 'Dynpro Entry'. trace-call = trace-call+13. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'Set Screen' OR trace-call(10) EQ 'Set screen' ). trace-subtype = 'Set Screen'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(11) EQ 'Call screen' ). trace-subtype = 'Call Screen'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'Screen entry' ). trace-subtype = 'Screen Entry'. trace-call = trace-call+13. trace-maintype = type_x.* Message .... ELSEIF ( trace-call(15) EQ 'Diag Message In' ). trace-subtype = 'Diag Message In'. trace-call = trace-call+16. trace-maintype = type_x. ELSEIF ( trace-call(16) EQ 'Diag Message Out' ). trace-subtype = 'Diag Message Out'. trace-call = trace-call+17. trace-maintype = type_x. ELSEIF ( trace-call(7) EQ 'Message' ). trace-subtype = 'Message'. trace-call = trace-call+8. trace-maintype = type_x. ELSEIF ( trace-call(23) EQ 'Dyn. Assign Dyn. Assign' ). trace-subtype = 'Dyn. Assign'. trace-call = trace-call+24. trace-maintype = type_x. ELSEIF ( trace-call(11) EQ 'Dyn. Assign' ). trace-subtype = 'Dyn. Assign'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'ASSIGN (dyn)' ). trace-subtype = 'Dyn. Assign'. trace-call = trace-call+13. trace-maintype = type_x. ELSEIF ( trace-call(16) EQ 'Call Transaction' OR trace-call(16) EQ 'Call transaction' ). trace-subtype = 'Call Transaction'. trace-call = trace-call+17. trace-maintype = type_x. ELSEIF ( trace-call(13) EQ 'Submit report' OR trace-call(13) EQ 'Submit Report' ). trace-subtype = 'Submit Report'. trace-call = trace-call+14. trace-maintype = type_x. ELSEIF ( trace-call(6) EQ 'Demand' ). trace-subtype = 'Demand'. trace-call = trace-call+7. trace-maintype = type_x. ELSEIF ( trace-call(15) EQ 'Generate Report' OR trace-call(15) EQ 'Generate report' ). trace-subtype = 'Generate Report'. trace-call = trace-call+16. trace-maintype = type_x. ELSEIF ( trace-call(8) EQ 'Raise E.' ). trace-subtype = 'Raise Event'. trace-call = trace-call+9. trace-maintype = type_x. ELSEIF ( trace-call(11) EQ 'Raise event' ). trace-subtype = 'Raise Event'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'Event Module' OR trace-call(12) EQ 'Event module' ). trace-subtype = 'Event Module'. trace-call = trace-call+13. trace-maintype = type_x. ELSEIF ( trace-call(7) EQ 'Program' ). trace-subtype = 'Program'. trace-call = trace-call+8. trace-maintype = type_x. ELSEIF ( trace-call(6) EQ 'Supply' ). trace-subtype = 'Supply'. trace-call = trace-call+7. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'Set Titlebar' ). trace-subtype = 'Event'. trace-call = trace-call+13. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'Set locale' ). trace-subtype = 'Event'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(13) EQ 'Set PF-Status' ). trace-subtype = 'Set PF-Status'. trace-call = trace-call+14. trace-maintype = type_x. ELSEIF ( trace-call(16) EQ 'Syn-Check for IT' OR trace-call(16) EQ 'Syn-check for IT'). trace-subtype = 'Syn-Check forf IT'. nc = trace-call+17. trace-call = nc. trace-maintype = type_x. ELSEIF ( trace-call(11) EQ 'Module(PAI)' ). trace-subtype = 'Module PAI'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'Module PAI' ). trace-subtype = 'Module PAI'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(11) EQ 'Module(PBO)' ). trace-subtype = 'Module PBO'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(10) EQ 'Module PBO' ). trace-subtype = 'Module PBO'. trace-call = trace-call+11. trace-maintype = type_x. ELSEIF ( trace-call(4) EQ 'Call' OR trace-call(4) EQ 'CALL' ). trace-subtype = 'Call'. trace-call = trace-call+5. trace-maintype = type_x. ELSEIF ( trace-call(5) EQ 'Event' ). trace-subtype = 'Event'. trace-call = trace-call+6. trace-maintype = type_x. ELSEIF ( trace-call(12) EQ 'System Event' ). trace-subtype = 'System Event'. trace-call = trace-call+12. trace-maintype = type_x. ELSEIF ( trace-call(11) EQ 'ENHANCEMENT' ). trace-subtype = 'Enhancement'. trace-call = trace-call+12. trace-maintype = type_x.*-----------------------------------------------------------------------* type Z: Runtime, Load, not classified* Runtimes analysis: ELSEIF ( trace-call(16) EQ 'Runtime analysis' OR trace-call(16) EQ 'Runtime Analysis'). trace-subtype = 'Runtime Analysis'. trace-call = trace-call+17. trace-maintype = type_z1.* Load: ELSEIF ( trace-call(11) EQ 'Load Dynpro' ). trace-subtype = 'Load Dynpro'. trace-call = trace-call+12. trace-maintype = type_z2. ELSEIF ( trace-call(15) EQ 'Generate Dynpro' ). trace-subtype = 'Generate Dynpro'. trace-call = trace-call+16. trace-maintype = type_z2. ELSEIF ( trace-call(11) EQ 'Load Report' OR trace-call(11) EQ 'Load report' ). trace-subtype = 'Load Report'. trace-call = trace-call+12. trace-maintype = type_z2. ELSEIF ( trace-call(11) EQ 'Load screen' ). trace-subtype = 'Load Screen'. trace-call = trace-call+12. trace-maintype = type_z2. ELSEIF ( trace-call(16) EQ 'Load CUA Objects'). trace-subtype = 'Load CUA Objects'. trace-call = trace-call+17. trace-maintype = type_z2. ELSEIF ( trace-call(19) EQ 'Impl. generation of' OR trace-call(19) EQ 'Impl. Generation of' ). trace-subtype = 'Impl. Generation'. trace-call = trace-call+20. trace-maintype = type_z2.* no classified ELSE. trace-maintype = type_z3. ENDIF. ENDIF.*-------------------------end of classification---------------------------------------------* Postprocess Methods-------------------------------------------: IF ( trace-subtype = 'Call Method' ).* newer version: IF ( trace-call CS '{' ). c_call = trace-call. REPLACE ALL OCCURRENCES OF '{' IN c_call WITH ''. REPLACE ALL OCCURRENCES OF '}' IN c_call WITH ''. SEARCH c_call FOR 'CL'. IF sy-subrc EQ 0. offset = sy-fdpos. c_call = c_call+offset. ENDIF. trace-call = c_call. ELSEIF ( trace-call CS '-' IN c_call WITH '-'. REPLACE ALL OCCURRENCES OF '}' IN c_call WITH ''. trace-call = c_call. ENDIF. ENDIF.* calls must be changed, but only for non-itabs IF ( gv_anonym EQ 'X' ). IF ( trace-maintype NE type_c ). READ TABLE gt_names_call INTO wa_names WITH TABLE KEY actual = trace-call. IF ( sy-subrc NE '0' ). gv_numb_call = gv_numb_call + 1. CONCATENATE 'NAME' gv_numb_call INTO wa_names-numbered. wa_names-actual = trace-call. INSERT wa_names INTO TABLE gt_names_call.* with key actual = wa_names-actual. ENDIF. trace-call = wa_names-numbered. ENDIF.* programs READ TABLE gt_names_prog INTO wa_names WITH TABLE KEY actual = trace-caller. IF ( sy-subrc NE '0' ). gv_numb_prog = gv_numb_prog + 1. CONCATENATE 'PROG' gv_numb_prog INTO wa_names-numbered. wa_names-actual = trace-caller. INSERT wa_names INTO TABLE gt_names_prog.* with key actual = wa_names-actual. ENDIF. trace-caller = wa_names-numbered. ENDIF.*------------------------------------------------------------------------------------------- IF ( trace-maintype EQ type_a ). trace-maintype = 'A Mod. Int'. APPEND trace TO abap_trace. sum_abap = sum_abap + trace-net. count_abap = count_abap + 1. ELSEIF ( trace-maintype EQ type_b ). trace-maintype = 'B Mod. Ext'. sum_rfc = sum_rfc + trace-net. count_rfc = count_rfc + 1. APPEND trace TO rfc_trace. ELSEIF ( trace-maintype EQ type_c ). IF ( header-line EQ 'X' ). trace-call = 'IT'. ENDIF. trace-maintype = 'C ITabs'. APPEND trace TO itab_trace. sum_it = sum_it + trace-net. count_it = count_it + 1. ELSEIF ( trace-maintype EQ type_d ). trace-maintype = 'D Data Int'. sum_buf = sum_buf + trace-net. count_buf = count_buf + 1. APPEND trace TO buf_trace. ELSEIF ( trace-maintype EQ type_e ). trace-maintype = 'E Data Ext'. sum_db = sum_db + trace-net. count_db = count_db + 1. APPEND trace TO db_trace. ELSEIF ( trace-maintype EQ type_x ). trace-maintype = 'X Others '. sum_x = sum_x + trace-net. count_x = count_x + 1. IF ( trace-subtype = 'Export to Memory' OR trace-subtype = 'Import from Memory' ). APPEND trace TO x_trace_x. ELSE. APPEND trace TO x_trace. ENDIF. ELSEIF ( trace-maintype EQ type_z1 ). trace-maintype = 'Z Special '. APPEND trace TO z_trace. gross_runtime = trace-gross. net_runtime = trace-net. count_runtime = count_runtime + 1. ELSEIF ( trace-maintype EQ type_z2 ). trace-maintype = 'Z Special '. sum_load = sum_load + trace-net. count_load = count_load + 1. APPEND trace TO z_trace. ELSEIF ( trace-maintype EQ type_z3 ). trace-maintype = 'Z Special '. trace-subtype = 'XYZ'. APPEND trace TO z_trace. sum_xyz = sum_xyz + trace-net. count_xyz = count_xyz + 1. ENDIF. ENDIF.* max gross time for call ne 'Runtime Analysis' IF ( trace-gross > gross_max AND trace-subtype NE 'Runtime Analysis' ). gross_max = trace-gross. max_gross_type = trace-subtype. ENDIF. CLEAR trace. ENDLOOP.* possiblity to separate different trace types, but no used------------- APPEND LINES OF abap_trace TO trace[]. APPEND LINES OF rfc_trace TO trace[].* itab see below APPEND LINES OF buf_trace TO trace[]. APPEND LINES OF db_trace TO trace[]. APPEND LINES OF x_trace TO trace[]. APPEND LINES OF z_trace TO trace[].* itab entries are always handled separately APPEND LINES OF itab_trace TO trace_x[]. APPEND LINES OF x_trace_x TO trace_x[].* Sums: -------------------------------------------------------------* Test: sum_z = net_runtime + sum_load + sum_xyz. count_z = count_runtime + count_load + count_xyz. sum_class = sum_abap + sum_rfc + sum_it + sum_buf + sum_db + sum_x + sum_z. count_class = count_abap + count_rfc + count_it + count_buf + count_db + count_x + count_z. IF ( sum_class NE sum_all OR count_class NE count_all ). WRITE: / 'Bug in Conversion'. BREAK-POINT. ENDIF. header-itabs = 'N'. IF ( sum_it > '0' ). header-itabs = 'Y'. ENDIF. header-line = 'N'. IF ( len-line NE '0' ). header-line = 'Y'. ENDIF.* header-events = 'N'.* if ( len_id ne '0' and len_subid ne '0' ).* header-events = 'Y'.* endif. header-sum_all = sum_all. header-count_class = count_all. header-sum_xyz = sum_xyz. header-run_gross = gross_runtime - sum_all. header-max_gross = gross_max - sum_all. header-max_gross_type = max_gross_type. header-run_net = net_runtime. header-sum_load = sum_load. header-sum_xyz = sum_xyz. header-count_load = count_load. header-count_xyz = count_xyz.* Check on header:----------------------------------- p = sum_load / sum_class * 100. IF ( p GT 5 ). head_texts-text = ' Loads > 5%, it might be better to repeat measurement'. APPEND head_texts. ENDIF. p = header-run_gross / sum_class * 100. IF ( p GT 5 ). head_texts-text = ' Deviation of Gross Time > 5%, please repeat'. APPEND head_texts. ENDIF.* Event Overview:------------------------------------* sum1 = 'ABAP1 = Functions'.* sum2 = 'ABAP2 = Forms '.* sum3 = 'ABAP4 = Methods '.* sum4 = 'ABAP5 = Internal Tables'.* sum5 = 'DB = Database Op. '.* sum6 = 'SYS = System '.* sum7 = 'RFC = Remote Func. Calls'.* sum8 = 'XYZ = '* sum9 = all net times !!* sum10 = all sums.* sum11 = gross time of Runtime Analysis CLEAR event. event-text1 = text_abap. event-sum1 = sum_abap. event-count1 = count_abap. event-text2 = text_rfc. event-sum2 = sum_rfc. event-count2 = count_rfc. event-text3 = text_itab. event-sum3 = sum_it. event-count3 = count_it. event-text4 = text_buf. event-sum4 = sum_buf. event-count4 = count_buf. event-text5 = text_db. event-sum5 = sum_db. event-count5 = count_db. event-text6 = text_x. event-sum6 = sum_x. event-count6 = count_x. event-text7 = text_z. event-sum7 = sum_z. event-count7 = count_z. event-text8 = ''. event-sum8 = 0. event-count8 = 0. event-text9 = ''. event-sum9 = 0. event-count9 = 0. event-text10 = 'SUM = Total'. event-sum10 = sum_class. event-count10 = count_class.* Checks on Events:---------------------------- p = sum_rfc / sum_class * 100. IF ( p GT 10 ). event_texts-text = ' RFC Contributions > 10%, please check RFCs'. APPEND event_texts. ENDIF. p = sum_buf / sum_class * 100. IF ( p GT 5 ). event_texts-text = ' Internal Access Contributions > 5%, please check!'. APPEND event_texts. ENDIF. p = sum_db / sum_class * 100. IF ( p GT 30 ). event_texts-text = ' DB Contributions > 30%, please check ST05!'. APPEND event_texts. ENDIF. p = sum_x / sum_class * 100. IF ( p GT 5 ). event_texts-text = ' Other Contributions > 5%, please check!'. APPEND event_texts. ENDIF. p = sum_z / sum_class * 100. IF ( p GT 5 ). event_texts-text = ' Special Contributions > 5%, please check!'. APPEND event_texts. ENDIF.ENDFORM. "CONVERT_FILE************************************************************************* Block C: Compare Traces**************************************************************************&---------------------------------------------------------------------**& Form Compare_events** Tries to identify itab pairs*----------------------------------------------------------------------*FORM compare_events TABLES trace1 TYPE tab_trace trace2 TYPE tab_trace itab1 TYPE tab_trace itab2 TYPE tab_trace in_both TYPE tab_both USING header1 TYPE st_header header2 TYPE st_header. IF ( header1-line EQ 'Y' AND header2-line EQ 'Y' ). gv_line = 'X'. ELSE. CLEAR gv_line. ENDIF.*----------------------------------------------* without line numbers IF ( gv_line NE 'X' OR gv_compare_full EQ 'X' ). PERFORM compare_full TABLES trace1 trace2 in_both USING header1 header2 'NO' 'C0'.* perform compare_all* tables itab1 itab2 in_both* using header1 header2 'ITAB' 'I0'.*----------------------------------------------------* including line numbers ELSE. PERFORM compare_line TABLES trace1 trace2 in_both USING header1 header2 'NO' 'CL'. PERFORM compare_line TABLES itab1 itab2 in_both USING header1 header2 'ITAB' 'IL'. ENDIF. APPEND LINES OF itab1 TO trace1. APPEND LINES OF itab2 TO trace2.ENDFORM. "COMPARE_EVENTS*&---------------------------------------------------------------------** Form compare_line* Compares with calling position*----------------------------------------------------------------------*FORM compare_line TABLES trace1 TYPE tab_trace trace2 TYPE tab_trace in_both TYPE tab_both USING header1 TYPE st_header header2 TYPE st_header type TYPE c comp TYPE c. DATA: new_trace1 TYPE HASHED TABLE OF st_trace WITH UNIQUE KEY maintype subtype caller line call WITH HEADER LINE, new_trace2 TYPE HASHED TABLE OF st_trace WITH UNIQUE KEY maintype subtype caller line call WITH HEADER LINE, wa1 TYPE st_trace, wa2 TYPE st_trace, tabix1 LIKE sy-tabix, tabix2 LIKE sy-tabix, fdummy1 TYPE f, fdummy TYPE f, nc(4) TYPE n, name(9) TYPE c, execs TYPE i, x1 TYPE i, x2 TYPE i, y1 TYPE i, y2 TYPE i, sum1_all TYPE typ_numb, sum1_both TYPE typ_numb, sum1_one TYPE typ_numb, sum2_all TYPE typ_numb, sum2_both TYPE typ_numb, sum2_one TYPE typ_numb, count1_prio TYPE i, count1_post TYPE i, count1_both TYPE i, count1_one TYPE i, count2_prio TYPE i, count2_post TYPE i, count2_both TYPE i, count2_one TYPE i.* Preparation:-------------------------------------------* Collect of duplicates is necessary!! LOOP AT trace1 INTO wa1. count1_prio = count1_prio + 1. READ TABLE new_trace1 INTO new_trace1 WITH TABLE KEY maintype = wa1-maintype subtype = wa1-subtype caller = wa1-caller line = wa1-line call = wa1-call. IF ( sy-subrc EQ 0 ). new_trace1-net = new_trace1-net + wa1-net. new_trace1-execs = new_trace1-execs + wa1-execs. new_trace1-gross = new_trace1-gross + wa1-gross. new_trace1-mult = new_trace1-mult + 1. MODIFY TABLE new_trace1 FROM new_trace1. ELSE. new_trace1 = wa1. new_trace1-mult = 1. INSERT new_trace1 INTO TABLE new_trace1. count1_post = count1_post + 1. ENDIF. ENDLOOP. LOOP AT trace2 INTO wa2. count2_prio = count2_prio + 1. READ TABLE new_trace2 INTO new_trace2 WITH TABLE KEY maintype = wa2-maintype subtype = wa2-subtype caller = wa2-caller line = wa2-line call = wa2-call. IF ( sy-subrc EQ 0 ). new_trace2-net = new_trace2-net + wa2-net. new_trace2-execs = new_trace2-execs + wa2-execs. new_trace2-gross = new_trace2-gross + wa2-gross. new_trace2-mult = new_trace2-mult + 1. MODIFY TABLE new_trace2 FROM new_trace2. ELSE. new_trace2 = wa2. new_trace2-mult = 1. INSERT new_trace2 INTO TABLE new_trace2. count2_post = count2_post + 1. ENDIF. ENDLOOP. IF ( 1 = 1 ). CLEAR: x1,y1. LOOP AT trace1 INTO wa1. x1 = x1 + wa1-net. ENDLOOP. LOOP AT new_trace1 INTO new_trace1. y1 = y1 + new_trace1-net. ENDLOOP. CLEAR: x2, y2. LOOP AT trace2 INTO wa2. x2 = x2 + wa2-net. ENDLOOP. LOOP AT new_trace2 INTO new_trace2. y2 = y2 + new_trace2-net. ENDLOOP. IF NOT ( x1 = y1 AND x2 = y2 ). BREAK-POINT. ENDIF. ENDIF. REFRESH trace1[]. REFRESH trace2[].* Compare: ---------------------------------------------* sort new_trace1 by maintype subtype caller line.* sort new_trace2 by maintype subtype caller line. LOOP AT new_trace1 INTO wa1. tabix1 = sy-tabix. sum1_all = sum1_all + wa1-net.* binary search read,* no hashed, because there is later a delete with index READ TABLE new_trace2 INTO wa2 WITH TABLE KEY maintype = wa1-maintype subtype = wa1-subtype caller = wa1-caller line = wa1-line call = wa1-call.* Identical Call in both traces found IF sy-subrc EQ 0. tabix2 = sy-tabix. DELETE TABLE new_trace2 WITH TABLE KEY maintype = wa1-maintype subtype = wa1-subtype caller = wa1-caller line = wa1-line call = wa1-call.* write in table in both sum1_both = sum1_both + wa1-net. count1_both = count1_both + 1. sum2_both = sum2_both + wa2-net. count2_both = count2_both + 1.* write in table in both* maintype, subtype, ..., caller, line, id, subid MOVE-CORRESPONDING wa1 TO in_both. in_both-code = comp. in_both-mult2 = wa2-mult. in_both-mult1 = wa1-mult.* net time in_both-net1 = wa1-net. in_both-net2 = wa2-net. IF ( wa1-net GT '0' ). fdummy1 = wa2-net / wa1-net. in_both-net2d1 = fdummy1. ELSE. in_both-net2d1 = 0. ENDIF. IF ( wa2-net > wa1-net ). in_both-nets = '+'. in_both-net2m1 = wa2-net - wa1-net. ELSEIF ( wa2-net < wa1-net ). in_both-nets = '-'. in_both-net2m1 = wa1-net - wa2-net. ELSE. in_both-nets = ''. in_both-net2m1 = wa2-net - wa1-net. ENDIF.* executions in_both-execs1 = wa1-execs. in_both-execs2 = wa2-execs. IF ( wa1-execs GT '0' ). fdummy = wa2-execs / wa1-execs. in_both-execs2d1 = fdummy. ELSE. in_both-execs2d1 = 0. ENDIF. IF ( wa2-execs > wa1-execs ). in_both-execss = '+'. in_both-execs2m1 = wa2-execs - wa1-execs. ELSEIF ( wa2-execs < wa1-execs ). in_both-execss = '-'. in_both-execs2m1 = wa1-execs - wa2-execs. ELSE. in_both-execss = ''. in_both-execs2m1 = wa2-execs - wa1-execs. ENDIF.* gross time in_both-gross1 = wa1-gross. in_both-gross2 = wa2-gross. IF ( wa1-gross GT '0' ). fdummy = wa2-gross / wa1-gross. in_both-gross2d1 = fdummy. ELSE. in_both-gross2d1 = 0. ENDIF. IF ( wa2-gross > wa1-gross ). in_both-grosss = '+'. in_both-gross2m1 = wa2-gross - wa1-gross. ELSEIF ( wa2-gross < wa1-gross ). in_both-grosss = '-'. in_both-gross2m1 = wa1-gross - wa2-gross. ELSE. in_both-grosss = ''. in_both-gross2m1 = wa2-gross - wa1-gross. ENDIF. in_both-netdexec1 = wa1-netdexec. in_both-netdexec2 = wa2-netdexec.* append to in_both and delete from new_trace2 APPEND in_both.* no entry in col_trace2 ELSE. sum1_one = sum1_one + wa1-net. count1_one = count1_one + 1. APPEND wa1 TO trace1. ENDIF. ENDLOOP.* the left-over in col_trace2 was never read------------------ LOOP AT new_trace2 INTO wa2. sum2_one = sum2_one + wa2-net. count2_one = count2_one + 1. APPEND wa2 TO trace2. ENDLOOP.* for output: IF ( type EQ 'ITAB' ). header1-count_itab_agg = count1_post - count1_prio. header2-count_itab_agg = count2_post - count2_prio. ELSE. header1-count_noit_agg = count1_post - count1_prio. header2-count_noit_agg = count2_post - count2_prio. ENDIF. header1-sum_both = header1-sum_both + sum1_both. header1-count_both = header1-count_both + count1_both. header1-sum_one = header1-sum_one + sum1_one. header1-count_one = header1-count_one + count1_one. header