-
Notifications
You must be signed in to change notification settings - Fork 189
Improved performance and stability of access to internal framework tables #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
9c19355
78f3790
af5ae33
2185cec
f6e8271
d609b36
646b0b8
a8d4ac7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,32 +16,41 @@ create or replace package body ut_coverage_helper is | |
| limitations under the License. | ||
| */ | ||
|
|
||
| g_coverage_id integer; | ||
| g_develop_mode boolean; | ||
| g_coverage_id integer; | ||
| g_develop_mode boolean := false; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about making it not null? |
||
| g_is_started boolean := false; | ||
|
|
||
| function is_develop_mode return boolean is | ||
| function is_develop_mode return boolean is | ||
| begin | ||
| return g_develop_mode; | ||
| end; | ||
|
|
||
| function is_started return boolean is | ||
| begin | ||
| return g_is_started; | ||
| end; | ||
|
|
||
| procedure coverage_start_internal(a_run_comment varchar2) is | ||
| begin | ||
| dbms_profiler.start_profiler(run_comment => a_run_comment, run_number => g_coverage_id); | ||
| g_is_started := true; | ||
| coverage_pause(); | ||
| end; | ||
|
|
||
| procedure coverage_start(a_run_comment varchar2) is | ||
| begin | ||
| if g_develop_mode is null then | ||
| if not g_is_started then | ||
| g_develop_mode := false; | ||
| coverage_start_internal(a_run_comment); | ||
| end if; | ||
| end; | ||
|
|
||
| procedure coverage_start_develop is | ||
| begin | ||
| g_develop_mode := true; | ||
| coverage_start_internal('utPLSQL Code coverage run in development MODE '||ut_utils.to_string(systimestamp)); | ||
| if not g_is_started then | ||
| g_develop_mode := true; | ||
| coverage_start_internal('utPLSQL Code coverage run in development MODE '||ut_utils.to_string(systimestamp)); | ||
| end if; | ||
| end; | ||
|
|
||
| procedure coverage_pause is | ||
|
|
@@ -59,17 +68,18 @@ create or replace package body ut_coverage_helper is | |
| end; | ||
|
|
||
| procedure coverage_stop is | ||
| l_return_code binary_integer; | ||
| begin | ||
| if not g_develop_mode then | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it correct to check for develop here? We are stoping coverage regardless of the mode, aren't we?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, not really. We will be able to remove the develop mode, once we move to testing ut3 with another ut3 installation. It needs to stay like this for now, otherwise we will not get a true picture of coverage for out own code. |
||
| l_return_code := dbms_profiler.stop_profiler(); | ||
| g_is_started := false; | ||
| dbms_profiler.stop_profiler(); | ||
| end if; | ||
| end; | ||
|
|
||
| procedure coverage_stop_develop is | ||
| l_return_code binary_integer; | ||
| begin | ||
| l_return_code := dbms_profiler.stop_profiler(); | ||
| g_develop_mode := false; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should call
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't, as described in previous comment. |
||
| g_is_started := false; | ||
| dbms_profiler.stop_profiler(); | ||
| end; | ||
|
|
||
| function get_raw_coverage_data(a_object_owner varchar2, a_object_name varchar2) return unit_line_calls is | ||
|
|
@@ -81,7 +91,13 @@ create or replace package body ut_coverage_helper is | |
| l_tmp_data coverage_rows; | ||
| l_results unit_line_calls; | ||
| begin | ||
| select d.line#, d.total_occur | ||
| select d.line#, | ||
| -- This transformation addresses two issues: | ||
| -- 1. dbms_profiler shows multiple unit_number for single code unit; | ||
| -- to address this, we take a sum od all units by name | ||
| -- 2. some lines show 0 total_occur while they were executed (time > 0) | ||
| -- in this case we show 1 to indicate that there was execution even if we don't know how many there were | ||
| case when sum(d.total_occur) = 0 and sum(d.total_time) > 0 then 1 else sum(d.total_occur) end total_occur | ||
| bulk collect into l_tmp_data | ||
| from plsql_profiler_units u | ||
| join plsql_profiler_data d | ||
|
|
@@ -91,7 +107,8 @@ create or replace package body ut_coverage_helper is | |
| and u.unit_owner = a_object_owner | ||
| and u.unit_name = a_object_name | ||
| --exclude specification | ||
| and u.unit_type not in ('PACKAGE SPEC', 'TYPE SPEC', 'ANONYMOUS BLOCK'); | ||
| and u.unit_type not in ('PACKAGE SPEC', 'TYPE SPEC', 'ANONYMOUS BLOCK') | ||
| group by d.line#; | ||
| for i in 1 .. l_tmp_data.count loop | ||
| l_results(l_tmp_data(i).line) := l_tmp_data(i).calls; | ||
| end loop; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we schec the state here and perform the same check in tha package itself.
Maybe we can remove the chack from here and leave it only in
ut_coverage_helper?