REPORT ZHGUPALL NO STANDARD PAGE HEADING. ************************************************************************ * This is a test program to measure - how much faster a program can * process it's job if all the other workprocesses are halted. * The program identifies the dialog and batch workprocesses that are * running other abaps and sends them a UNIX 24 (halt) signal. * When it has finished the job, it releases the other workprocesses * by sending them a signal 26. This method can be hazardous too. * One such situation can be a deadlock, when the program requires a * resource, that is locked by an abap that has been paused. ************************************************************************ PARAMETERS: SELFISH. TABLES: TRDIR. DATA: T1 TYPE I, T2 TYPE I, STRING(20) VALUE 'load', LOCK(30) VALUE 'kill -24', ULOCK(30) VALUE 'kill -26', OPCODE TYPE X VALUE 2. DATA: BEGIN OF LIST OCCURS 10. INCLUDE STRUCTURE MSXXLIST. DATA: END OF LIST. DATA: BEGIN OF WPLIST OCCURS 10. INCLUDE STRUCTURE WPINFO. DATA: END OF WPLIST. DATA: BEGIN OF TABL OCCURS 0, LINE(200), END OF TABL. DATA: BEGIN OF ITAB OCCURS 500, LINE(72), END OF ITAB. * * Get the list of dialog workprocesses CALL FUNCTION 'TH_SERVER_LIST' TABLES LIST = LIST. READ TABLE LIST WITH KEY HOST = SY-HOST. CALL FUNCTION 'TH_WPINFO' EXPORTING SRVNAME = LIST-NAME TABLES WPLIST = WPLIST. * * Lock all the DIA and BTC but mine IF SELFISH = 'Y'. LOOP AT WPLIST. IF WPLIST-WP_TYP = 'DIA' OR WPLIST-WP_TYP = 'BTC'. IF WPLIST-WP_BNAME <> SY-UNAME. LOCK+11(8) = WPLIST-WP_PID. WRITE: / LOCK. CALL 'SYSTEM' ID 'COMMAND' FIELD LOCK ID 'TAB' FIELD TABL-*SYS*. ENDIF. ENDIF. ENDLOOP. ENDIF. SKIP. * * Measure runtime GET RUN TIME FIELD T1. * * This is my processing section VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV SELECT * FROM TRDIR WHERE NAME LIKE 'I%'. READ REPORT TRDIR-NAME INTO ITAB. LOOP AT ITAB. IF ITAB-LINE CS STRING. WRITE: / TRDIR-NAME. EXIT. ENDIF. ENDLOOP. ENDSELECT. * End of processing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ************************************************************************ * * Measure runtime GET RUN TIME FIELD T2. T2 = T2 - T1. SKIP. WRITE: 'runtime:', T2. SKIP. * * Unock the other guys IF SELFISH = 'Y'. LOOP AT WPLIST. IF WPLIST-WP_TYP = 'DIA' OR WPLIST-WP_TYP = 'BTC'. IF WPLIST-WP_BNAME <> SY-UNAME. ULOCK+11(8) = WPLIST-WP_PID. WRITE: / ULOCK. CALL 'SYSTEM' ID 'COMMAND' FIELD ULOCK ID 'TAB' FIELD TABL-*SYS*. ENDIF. ENDIF. ENDLOOP. ENDIF.