lr_start_transaction
Marks the beginning of a transaction.
int lr_start_transaction( char *transaction_name );
| Alphabetical Listing - C Language Utility Functions |
Arguments
| Name | Comments |
|---|---|
| transaction_name | The name of the transaction. |
The lr_start_transaction function marks the beginning of a transaction. To indicate a transaction to be analyzed, use the lr_start_transaction and lr_end_transaction functions. These functions are inserted immediately before and after the transaction.
Transactions can be nested, but each lr_start_transaction statement must be associated with an lr_end_transaction statement or it will be interpreted as an illegal command.
Note: For information on allowed characters and maximum length for transaction names, see Transaction guidelines in the Virtual User Generator Help Center.
Return Values
This function returns 0 if it succeeds. It returns -1 if the transaction name is illegal.
Parameterization
Parameterization is not applicable to this function.
Example
In the following example, lr_start_transaction starts a transaction whose purpose is to measure the time it takes to perform a deposit to a bank server. Once the server API call is completed and returns a value to the status variable, the transaction is complete.
/* Notify that a transaction is starting */
lr_start_transaction("deposit");/* Server API call */
status = bank_deposit(50);
/* End transaction with operation result - pass or fail */
if (status == 0)
lr_end_transaction("deposit", LR_PASS);
else
lr_end_transaction("deposit", LR_FAIL);

