Basically, the code uses the sys.v_$timer table to get hundredth's of seconds. It does this before and after critical sections of code (see the list below for what you can time). It also inserts these values into a database table. You can then run queries against this table to see how long things are taking to execute (something you just can't get from the svXXXX.log file). Very useful for performance tuning. Now you can see what takes a long time and what doesn't.
You enable tracing in the svXXXX.app file by setting some values in the [DBAUTH] section. For example:
[DBAUTH] .... timingsTable = ows2.timings timingsModules = allWould enable tracing into the ows2.timings table for ALL modules. timingsModules may either contain the word 'all' to capture all statistics or it may contain a space-separated list consisting of certain keywords. All keywords are defined in a list below, the following table explains the above variables.
| Variable | Mandatory | Meaning |
|---|---|---|
| timingsTable | NO | Our web agent has the ability to collect detailed timing stats down to the hundreds of a second for all web operations. These stats go into a table named 'timings' and owned by someone. The definition of the timings table is in owarepl.sql found in the owarepl/sql subdirectory. If you install this table and want timings, you will set the timingsTable variable equal to the owner.tablename. For example, my timings table is owned by ows2 and is called timings. |
| timingsModules | NO | This allows you to filter the level
at which you want to collect timings. If you set this to all, all timings
will be collected. You may also set a specific set of timings to capture.
For example, if you
timingsModules = TOTAL EXEC-BLOCKYou will collect stats for the TOTAL execution time (from the time the user connects until they get the whole page) and the time spent executing just the PL/SQL code for the web agent. The difference between these two times is the overhead my code and the web imposed. Some of the things that take time are parsing the cgi-environment, loading large files that are uploaded, describing invalid procedures, and so on. A complete list of modules is in the example directory in the svdbauth.app file. Their meanings are listed below this table. |
The following is a list of values that may be used with "timingsModules =" to get timing statistics:
If the variable timingsTable is set but timingsModules is not, then the routine get_hsecs() will perform a select on the sys.v_$timer table every time it is called. This overhead is minimal.
If the variable timingsTable is set and the timingModules is set to either all or some list of values, then an insert into the timings table will take place for the specified modules. If you leave the timings table un-indexed (recommended), the overhead is not significant.
Again, by commenting out or removing the timingsTable variable in the [DBAUTH] section, you will remove all tracing overhead.
create table timings
( sessionid number default userenv('sessionid'),
url varchar2(80),
msg varchar2(20),
start_hsecs number,
stop_hsecs number,
time_stamp date default sysdate,
userid varchar2(50),
remote_addr varchar2(30),
http_user_agent varchar2(80)
)
/
grant all on timings to public
/
Where
| Column | Meaning |
|---|---|
| Sessionid | The sessionid for the connected session. This, coupled with start_hsecs, consistute a 'primary key' for this table. If you select * from timings where sessionid = 55, you will get all relevant records for a given session |
| URL | The url that was submitted to the cartridge. |
| Msg | The section of code the timing is for. For example, this will have values 'TOTAL', 'EXEC-BLOCK' and so on. |
| Start_Hsecs | |
| Stop_Hsecs | You will take stop_hsecs-start_hsecs to get elapsed times |
| Time_Stamp | SYSDATE of when the timing finished. NOTE: Timestamp will vary within a given sessionid if the request > 1 second to process |
| Userid | Who is logged in. If using database authentication, this will be the name of the person logged in. If not using database authentication, this will be the DCD usename |
| Remote_Addr | IP address of client |
| Http_User_Agent | Browser being used by client |