Share this page

# lr_get_trans_instance_wasted_time

Returns the wasted time of a transaction instance.

    double lr_get_trans_instance_wasted_time (long trans_handle);

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
trans_handle | A transaction handle.

The lr_get_trans_instance_wasted_time function returns the Wasted Time of the specified transaction until this point.

The difference between this function and lr.get_transaction_wasted_time is that with this function you specify a transaction instance by its handle. With lr_get_transaction_wasted_time, you specify an independent transaction by its name.

The trans_handle is the handle returned by the call to lr_start_transaction_instance that created the instance.

The lr_get_trans_instance_think_time function returns values greater than zero only for open transactions.

To determine other transaction statistics, such as think time and wasted time, use the appropriate Transaction Functions.

## Return Values

If this function succeeds, it returns the transaction wasted time in seconds. If it fails, it returns a negative number. If the transaction already ended or if data is not available for the specified transaction, it returns 0.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, the lr_get_trans_instance_wasted_time function gets the wasted time of a transaction, and sends it to the Output window.

Copy code

    #include "as_web.h"
    Action() {
        long parent_trans_handle;
        double trans_time;
        int rc;
        /* Start the main transaction instance.
            Passing 0 as the parent handle indicates that the
            transaction has no parent.
            The function return value is the handle used in other
            transaction instance functions.     */
        parent_trans_handle =  lr_start_transaction_instance("ParentTransaction",0);

        /*Perform the business process, represented here with a single web_url call. */
        web_url("web_url", "URL=http://www.ABC.com",LAST );
        rc = lr_get_trans_instance_status(parent_trans_handle);
        if (rc == LR_FAIL) {
         /* web_url has failed the transaction.
            No point in continuing, because
            future calls will probably also fail. */
         lr_end_transaction_instance(parent_trans_handle, LR_FAIL);
         return;
        }
        /* Get the transaction instance durations.
            Pass the instance handle.
            The duration in seconds is the return value. */
        //Total duration
        trans_time = lr_get_trans_instance_duration(parent_trans_handle);
        lr_output_message("Instance time is %lf seconds.", trans_time);
        //Think time
        trans_time = lr_get_trans_instance_think_time(parent_trans_handle);
        lr_output_message("Instance think time is %lf seconds.", trans_time);
        //Wasted time
        trans_time = lr_get_trans_instance_wasted_time (parent_trans_handle);
        lr_output_message("Instance waste time is %lf seconds.", trans_time);
        //End the transaction instance
        lr_end_transaction_instance(parent_trans_handle, LR_PASS);
        return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: