Advertisement
Aleq-movilizer

MEL Profiling

Mar 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 2.23 KB | None | 0 0
  1. METHOD profiling.
  2.  
  3.   DATA:
  4.         lr_mel TYPE REF TO /movi/ms_st_mel_expression.
  5.  
  6.   APPEND INITIAL LINE TO ct_mel_expression REFERENCE INTO lr_mel.
  7.   lr_mel->expression_type = /movi/dsd_if_const=>mel_type-on_sync.
  8.   CONCATENATE zotcm_if_const=>melfunc_profile_init ' = function:profile_init()' _n
  9.               '{' _n
  10.                   zotcm_if_array=>profilepoints ' = null;' _n
  11.               '};' _n
  12.          INTO lr_mel->expression RESPECTING BLANKS.
  13.  
  14.   APPEND INITIAL LINE TO ct_mel_expression REFERENCE INTO lr_mel.
  15.   lr_mel->expression_type = /movi/dsd_if_const=>mel_type-on_sync.
  16.   CONCATENATE zotcm_if_const=>melfunc_profile ' = function:profile(desc)' _n
  17.               '{' _n
  18.                   zotcm_if_array=>profilepoints '[systemTime()] = desc;' _n
  19.               '};' _n
  20.          INTO lr_mel->expression RESPECTING BLANKS.
  21.  
  22.   APPEND INITIAL LINE TO ct_mel_expression REFERENCE INTO lr_mel.
  23.   lr_mel->expression_type = /movi/dsd_if_const=>mel_type-on_sync.
  24.   CONCATENATE zotcm_if_const=>melfunc_profile_dump ' = function:profile_dump()' _n
  25.               '{' _n
  26.                   'try' _n
  27.                   '{' _n
  28.                       'conn = connect("file://%SDCARD%/Movilizer/profile.txt", "file");' _n
  29.                       'if (isConnectionOpen(conn))' _n
  30.                       '{' _n
  31.                           'prev = null;' _n
  32.                           'forasc (timeStamp: ' zotcm_if_array=>profilepoints ')' _n
  33.                           '{' _n
  34.                               'if (isDefined(prev))' _n
  35.                               '{' _n
  36.                                   'writeTextLine(conn, concat(" (", numberFormat("*0", timeStamp - prev), " ms)"));' _n
  37.                               '}' _n
  38.                               'writeText(conn, concat("* ", ' zotcm_if_array=>profilepoints '[timeStamp]));' _n
  39.                               'prev = timeStamp;' _n
  40.                           '}' _n
  41.                           'close(conn);' _n
  42.                       '}' _n
  43.                   '}' _n
  44.                   'catch(e) { }' _n
  45.                   'finally { if (isConnectionOpen(conn)) { try { close(conn); } catch(e) { } } }' _n
  46.               '};' _n
  47.          INTO lr_mel->expression RESPECTING BLANKS.
  48.  
  49. ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement