Measure backend render time (#5043)

This measures the time it takes in the backend to prepare the HTML page. Result is shown when hovering over abapGit logo in the page footer.

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Marc Bernard 2021-10-19 00:38:56 -04:00 committed by GitHub
parent d54940075b
commit e85e2f51d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,8 @@ CLASS zcl_abapgit_gui_page DEFINITION PUBLIC ABSTRACT
zcx_abapgit_exception .
PRIVATE SECTION.
TYPES: ty_time TYPE p LENGTH 10 DECIMALS 2.
DATA mo_settings TYPE REF TO zcl_abapgit_settings .
DATA mx_error TYPE REF TO zcx_abapgit_exception .
DATA mo_exception_viewer TYPE REF TO zcl_abapgit_exception_viewer .
@ -53,6 +55,8 @@ CLASS zcl_abapgit_gui_page DEFINITION PUBLIC ABSTRACT
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS footer
IMPORTING
!iv_time TYPE ty_time
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS render_link_hints
@ -108,7 +112,8 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
ri_html->add( '<td class="center">' ).
ri_html->add( '<div class="logo">' ).
ri_html->add( ri_html->icon( 'git-alt' ) ).
ri_html->add( ri_html->icon( 'abapgit' ) ).
ri_html->add( ri_html->icon( iv_name = 'abapgit'
iv_hint = |{ iv_time } sec| ) ).
ri_html->add( '</div>' ).
ri_html->add( |<div class="version">{ zif_abapgit_version=>c_abap_version }</div>| ).
ri_html->add( '</td>' ).
@ -313,10 +318,16 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
METHOD zif_abapgit_gui_renderable~render.
DATA: li_script TYPE REF TO zif_abapgit_html.
DATA:
li_script TYPE REF TO zif_abapgit_html,
lv_start TYPE i,
lv_end TYPE i,
lv_total TYPE ty_time.
gui_services( )->register_event_handler( me ).
GET RUN TIME FIELD lv_start.
" Real page
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
@ -335,7 +346,10 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
ii_html = ri_html
iv_part_category = c_html_parts-hidden_forms ).
ri_html->add( footer( ) ).
GET RUN TIME FIELD lv_end.
lv_total = ( lv_end - lv_start ) / 1000 / 1000.
ri_html->add( footer( lv_total ) ).
li_script = scripts( ).