Example: lr_start_transaction

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);