Oracle Enterprise Manager Oracle Trace User's Guide | ![]() Library |
![]() Product |
![]() Contents |
![]() Index |
This chapter describes the Oracle Trace routines. These routines allow you to record events that occur during execution of your application. Table 8-1 lists the routines described in this chapter.
The description of each routine has the following parts:
Be sure to read the introductory material to this chapter. It contains important information about data structures, datatypes, and parameters specific to the Oracle Trace routines.
Calling Oracle Trace Routines
This section provides information about data structures, datatypes, and parameter-passing conventions for Oracle Trace routines. Datatypes
The datatypes used in the Oracle Trace routines are defined in the epc.h file. This file is operating-system specific. The types defined, such as sb2 and ub4, can take different C types on different systems. Data Structures
Oracle Trace uses two types of data structures: event collection flags arrays and user-defined buffers. Event Collection Flags Array
The event collection flags array is a list of up to 256 integer values. Oracle Trace designates events for collection by setting bits in the event collection flags array. User-Defined Buffer
The user-defined buffer is a data structure that contains the data for product-specific items. The event_rec parameter in the Oracle Trace event routines specifies the address of the user-defined buffer. A product uses the user-defined buffer to pass product-specific items to Oracle Trace.
For any optional parameter without a value, you must specify 0 (if the parameter is passed by value) or a null value (if the parameter is passed by reference). This is true for all optional parameters in all Oracle Trace routines.
The vendor ID number is the same as the network ID section of the vendor's internet address. The section of a vendor's internet address that is considered to be the network ID depends upon whether the internet address is an event set A, B, or C address.
A sample event set A address is 16.31.128.90. For event set A addresses the network ID is the first section of the address, in this case 16. Therefore, the vendor ID is 16.
A sample event set B internet address is 128.3.0.5. For event set B addresses, the network ID is made up of the first two sections, in this case 128.3. Therefore, the vendor ID is 1283.
As another example, Oracle Corporation uses event set C internet addresses. A sample event set C internet address is 192.216.243.3. For event set C addresses the network ID is made up of the first three sections of the address, in this case 192.216.243. Therefore, Oracle Corporation's vendor ID is 192216243.
Vendors who do not have an internet address can obtain one by contacting the Network Information Center (NIC) located at SRI International. Addresses are available even to vendors who do not plan to join the internet.
See the UNIX System Administration Handbook, Prentice Hall, Englewood Cliffs, N.J., 1989 for details on obtaining an internet address.
Vendors can assign numbers of their own choosing to their products. The only restriction is that the number be unique among the vendor's own products.
sb4 api_version;
sb4 vendor;
sb4 product;
text *version
text *registration_id;
ub4 cf_item_number;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
version
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
registration_id
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
cf_item_number
Ties the registration ID string to the value of a cross-product item at the time of the call. This allows cross-product item values to be directly related to string values. Description
The epc_add_reg_id routine adds a registration ID for a product. A product can call this routine as often as necessary, depending upon the number of registration identifiers it wishes to associate with an application process. Return Values
sb4 api_version;
sb4 vendor;
sb4 product;
text *version
text *collection_name;
text *writable_eventflags;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
version
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
collection_name
Points to the path and filename of the collection definition file, minus any suffix. It must be the same collection_name as specified in the call to the epc_collect routine. writable_eventflags
The address of event flags that should be modified when this collection is canceled. This allows the user to have multiple copies of event flags per product, per process, and to pass in the exact event flags they wish to have modified in the call to the epc_cancel routine. This address of this parameter should be the same for the epc_event, epc_start_event, and epc_end_event routines. Description
The epc_cancel routine cancels a collection for the specified collection filename. Any data remaining in the cache at that time is written to the .dat file. The .dat file and the .cdf file are then closed and values for the event flags parameter that were set in the epc_init routine are restored to their previous settings. Return Values
epc_s_colnotfound
|
Collection not found.
|
epc_s_datafilereq
|
Datafile required.
|
epc_s_initreq
|
epc_init call required.
|
epc_s_noheap
|
Not enough heap space.
|
epc_s_success
|
The call was successful.
|
sb4 api_version;
sb4 item_num;
sb4 item_val;
sb4 context;
sb4 **item_adr;
Parameter
|
Datatype
|
Access
|
Passed by...
|
status
|
sb4
|
write
|
not applicable
|
api_version
|
sb4
|
read
|
value
|
item_num
|
sb4
|
read
|
value
|
item_val
|
sb4
|
read
|
value
|
context
|
sb4
|
read
|
value
|
item_adr
|
sb4
|
modify
|
reference
|
item_num
The cross-product item number whose value is to be set to the value indicated by the item_val parameter. item_val
The numeric value (in decimal) used to set the cross-product item number, indicated by the item_num parameter. context
An integer value that corresponds to the context parameter returned from the call to the epc_context routine. item_adr
Contains a pointer to the location of the corresponding cross-product item. The location will be user-mode accessible memory, created by Oracle Trace at the time of the epc_init routine. Thus, the location is accessible during the entire image execution, avoiding any potential access violations. The product can subsequently assign a value to the item without having to call the epc_cf_value routine, thereby avoiding call overhead. Description
The epc_cf_value routine sets the value of a cross-product item. It optionally returns the address of the cross-product item in the item_adr parameter, so that it can be assigned later (more efficiently) by the product. Return Values
sb4 api_version;
sb4 vendor;
sb4 product;
text *version
sb4 *overriding_eventflags;
text *collection_name;
text *fdf_name;
sb4 *writable_eventflags;
ub4 col_max_size;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
version
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
overriding_eventflags
A way to override the event flags in the product definition file (.fdf) for the collection. A product can use this parameter as a shortcut to specify sub-event sets of events from a single .fdf file. For example, every time a product called the epc_collect routine, it could provide only the ALL .fdf file, which contains all possible events for that product. Then, using the overriding_eventflags parameter, individual events from the ALL event set could be set for collection. collection_name
Points to the file specification for the collection definition file, minus any suffix. The suffix is appended by Oracle Trace when it uses this filename to create both the collection definition file (.cdf) and the data file (.dat). The .cdf file contains information about the collection, such as image and process names, product registration records, and a full path specification and name for the .fdf file. The .dat file contains the collected event data. fdf_name
The product definition file that determines the events and their associated items that are logged for each event. writable_eventflags
The address of event flags that should be modified when this collection is canceled. This allows the user to have multiple copies of event flags per product, per process, and to pass in the exact event flags to be modified in the call to the epc_cancel routine. For most applications, only one set of event flags is needed. It should be allocated using the epc_init routine. col_max_size
The maximum size in bytes of the .dat file. Once the .dat file reaches this maximum, the collection is canceled. Description
The epc_collect routine starts a collection for the specified product and version. It does this by creating .cdf and .dat files using the name passed in the collection_name parameter.
sb4 api_version;
*sb4 context;
Parameter
|
Datatype
|
Access
|
Passed by...
|
status
|
sb4
|
write
|
not applicable
|
api_version
|
sb4
|
read
|
value
|
context
|
sb4
|
read/write
|
reference
|
context
A value used to set context for a new or existing thread. Description
The epc_context routine sets the context for a new thread or an existing thread so that resource utilization and cross-product items can be collected on a per-thread basis in multi-threaded products. This routine is called by a product when a context switch is used to create or re-enter a thread context. Return Values
sb4 api_version;
sb4 context;
Parameter
|
Datatype
|
Access
|
Passed by...
|
status
|
sb4
|
write
|
not applicable
|
api_version
|
sb4
|
read
|
value
|
context
|
sb4
|
read
|
value
|
context
An integer value that corresponds to the context parameter returned from the call to the epc_context routine. Description
The epc_delete_context routine deletes all context required for Oracle Trace to collect resource utilization and/or cross-product items for a particular context variable. Return Values
sb4 api_version;
sb4 vendor;
sb4 product;
sb4 event_id;
sb4 handle;
sb4 context
text *event_rec;
sb4 event_rec_size;
sb4 option;
sb4 *cf_items;
sb4 *eventflags;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
event_id
The event identifier (numeric) for the event. It ranges in value from 1 to 256. handle
An address value that identifies the duration event. It must be identical to the one passed on the epc_start_event routine. context
The context parameter passed to the epc_start_event routine. Events cannot start on one thread and end on another. This parameter is optional. event_rec
The address of a record buffer containing the product-specific item values for an event. event_rec_size
The length in bytes of the contents of the event_rec parameter. option
This parameter is not supported for Oracle Trace release 1.3. Pass a 0. cf_items
The address of a cross-product items array that replaces the default cross-product items array. Normally, if the product definition states that a cross-product item is to be logged for a certain event, the value for that cross-product item is obtained from the internal Oracle Trace cross-product items array. This default method requires no product intervention and is well-suited to applications that do not have multiple threads of execution. eventflags
The address of an event flags array that replaces any event flags specified in the call to the epc_init routine. This parameter is for use only by applications that use epc_collect and epc_cancel to control collections from within the application. Description
The epc_end_event routine enables a given product to post the end of a duration event. Return Values
sb4 api_version;
sb4 vendor;
sb4 product;
sb4 event_id;
sb4 context
text *event_rec;
sb4 event_rec_size;
sb4 option;
sb4 *cf_items;
sb4 *eventflags;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
event_id
The event identifier (numeric) for the event. An event_id can range in value from 1 to 256. context
The context parameter passed to the epc_context routine. event_rec
The address of a record buffer containing the product-specific item values for an event. event_rec_size
The length in bytes of the contents of the event_rec parameter. option
This parameter is not supported for Oracle Trace release 1.3. Pass a 0. cf_items
The address of a cross-product items array that replaces the default cross-product items array. Normally, if the product definition states that a cross-product item is to be logged for a certain event, the value for that cross-product item is obtained from the internal Oracle Trace cross-product items array. This default method requires no product intervention and is well-suited to applications that do not have multiple threads of execution. eventflags
The address of an event flags array that replaces any event flags specified in the call to the epc_init routine. Description
The epc_event routine enables a given product to post the occurrence of a point event. Return Values
sb4 api_version;
Parameter
|
Datatype
|
Access
|
Passed by...
|
status
|
sb4
|
write
|
not applicable
|
api_version
|
sb4
|
read
|
value
|
Description
The epc_flush routine flushes the record cache of collections for which the process is currently collecting data, or collections to which the process has previously been bound. If the record cache for a particular collection is empty, a counter is incremented for that collection. If the counter reaches 20, the collection is canceled for the process and all associated collection files are closed. Therefore, caution should be used when making calls to the epc_flush routine. Return Values
sb4 api_version;
sb4 cf_items[];
sb4 context;
sb4 **item_adr;
Parameter
|
Datatype
|
Access
|
Passed by...
|
status
|
sb4
|
write
|
not applicable
|
api_version
|
sb4
|
read
|
value
|
cf_items
|
sb4 array
|
modify
|
reference
|
context
|
sb4
|
read
|
value
|
item_adr
|
sb4
|
modify
|
reference
|
cf_items
The address of a list of integers used to return cross-product item values. The number of elements in this list, currently 14, is indicated by the constant EPC_C_NUM_CROSS_FAC_ITEMS. The list of cross-product items values is returned from the call to epc_get_cf_items by the client portion of the product. context
An integer value that corresponds to the context parameter returned from the call to the epc_context routine. Oracle Trace returns the cross-product items related to this context variable. item_adr
A pointer to the location of the start address for the 14-element cross-product array. The location will be application-accessible memory created by Oracle Trace during image activation. The location is accessible during the entire image execution, avoiding any potential access violations. By using array offsets, the product can subsequently assign values to items without having to call the epc_cf_value routine (thereby avoiding call overhead). Description
The epc_get_cf_items routine returns all values for the cross-product items for this process or thread of execution if a context-variable parameter is specified. Return Values
sb4 api_version;
sb4 vendor;
sb4 product;
text *version
text *registration_id;
sb4 *predefined_eventflags;
sb4 **returned_eventflags;
sb4 max_event;
sb4 eventflag_option;
ub4 offset;
sb4 shmem_id;
text *filename;
void(*callback_routine)( );
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
version
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
registration_id
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
predefined_eventflags
Use this parameter if you wish to control collections solely by use of the epc_collect and epc_cancel routines. If you use this parameter, the process cannot participate in collections started by the Oracle Trace Manager. The product calling the epc_init routine allocates an integer array (size of max_event parameter plus 1) and then passes the array address to Oracle Trace. returned_eventflags
Use this parameter if you wish to control collections using the Oracle Trace Manager. The product calling the epc_init routine passes an address to which the read-only address can be written. max_event
The largest event number defined in the product. eventflag_option
Where and how event flag arrays are stored. The event flag options are as follows:
As collections become active, Oracle Trace notifies the product process of the returned_eventflags for that specific collection. Because of the communication involved and the asynchronous nature by which you can schedule data collection, the values of the returned_eventflags can change asynchronously.
Predefined_eventflags are set and cleared through calls to the epc_collect and epc_cancel routines.
sb4 api_version;
sb4 vendor;
sb4 product;
text *version
text *registration_id;
ub4 cf_item_number;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
version
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
registration_id
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
cf_item_number
Ties the registration ID string to the value of a cross-product item at the time of the call. This allows cross-product item values to be directly related to string values. Description
The epc_remove_reg_id routine removes a registration ID for a product. A product can call this routine as often as necessary, depending upon the number of registration identifiers it wishes to disassociate from a process. Return Values
sb4 api_version;
sb4 cf_items[];
sb4 context;
Parameter
|
Datatype
|
Access
|
Passed by...
|
status
|
sb4
|
write
|
not applicable
|
api_version
|
sb4
|
read
|
value
|
cf_items
|
sb4 array
|
modify
|
reference
|
context
|
sb4
|
read
|
value
|
cf_items
The address of a list of integers used to return cross-product item values. The number of elements in this list, currently 14, is indicated by the constant EPC_C_NUM_CROSS_FAC_ITEMS. The list of cross-product items values is returned from the call to epc_get_cf_items by the client portion of the product. context
An integer value that corresponds to the context parameter returned from the call to the epc_context routine. Description
The epc_set_cf_items routine sets all values for the cross-product items for this process or thread of execution if a context-variable parameter is specified. Return Values
sb4 api_version;
sb4 vendor;
sb4 product;
sb4 event_id;
sb4 *handle;
sb4 context
text *event_rec;
sb4 event_rec_size;
sb4 option;
sb4 *cf_items;
sb4 *eventflags;
vendor
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
product
For a description of this parameter, refer to Parameter Descriptions on page 8-6.
event_id
The event identifier (numeric) for the event. The event_id can range in value from 1 to 256. handle
The address of an integer to return a process unique event handle for a particular event instance. The handle is passed in the corresponding call to the epc_end_event routine for the event. context
The context parameter passed to the epc_end_event routine. Events cannot start on one thread and end on another. event_rec
The address of a record buffer containing the product-specific item values for an event. event_rec_size
The length in bytes of the contents of the event_rec parameter. option
This parameter is not supported in Oracle Trace release 1.3. Pass a 0. cf_items
The address of a cross-product items array that replaces the default cross-product items array. Normally, if the product definition states that a cross-product item is to be logged for a certain event, the value for that cross-product item is obtained from the internal Oracle Trace cross-product items array. This default method requires no product intervention and is well-suited to applications that do not have multiple threads of execution. eventflags
The address of an event flags array that replaces any event flags specified in the call to the epc_init routine. This parameter is for use only by applications that use epc_collect and epc_cancel to control collections from within the application. Description
The epc_start_event routine enables a given product to post the start of a duration event. Return Values
![]() ![]() Prev Next |
![]() Copyright © 1996 Oracle Corporation. All Rights Reserved. |
![]() Library |
![]() Product |
![]() Contents |
![]() Index |