Share this page

# lr_get_transaction_duration

Returns the duration of a transaction.

    Double lr.get_transaction_duration( String transaction )

Transaction Functions | Java Syntax

## Arguments

Name | Comments
--- | ---
transaction | A string indicating the name of a transaction.

The lr_get_transaction_duration function returns the duration in seconds of the specified transaction to this point. You use this function to determine the total transaction time before the transaction has ended. lr_get_transaction_duration returns values greater than zero only for open transactions.

This function returns the duration including Wasted Time. Therefore, the value may be slightly greater than the duration reported for the function when closed with lr_end_transaction.

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

## Return Values

If this function succeeds, it returns the transaction duration 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 this example lr.get_transaction_duration checks the duration of part of a transaction, and sends it to the Output window.

Copy code

    double trans_time;
    int status;
    lr.start_transaction ("Flight");
    web.url("home;sz=234x60;tile=1;ord=977672495775323400",
        "URL=http://ad.doubleclick.net/...ord=977672495775323400", new String[] {
        "Mode=URL",
         web.LAST});

        // Get transaction time to this point
    trans_time=lr.get_transaction_duration("Flight");
    status = web.submit_data("flight",
            "Action=http://www.Web-tours.com/cgi-bin/tours?ITN_RESPONSE+", new String[] {
            "Method=POST",
            "TargetFrame=",
            web.LAST}, new String[] {
            "MY DATA",
            //...
            web.LAST});
     // End transaction with operation result - pass or fail /
    if (status == 0)
         lr.end_transaction("Flight", lr.PASS);
    else
         lr.end_transaction("Flight", lr.FAIL);

    if (trans_time > 0)
         lr.output_message("The duration up to the submit is" + trans_time + "seconds.");
    else
         lr.output_message("The duration cannot be determined.");

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: