Share this page

# lr.get_transaction_duration

Returns the duration of a transaction.

## C#

    double lr.get_transaction_duration( string transaction );

## VB.NET

    Function lr.get_transaction_duration( ByVal transaction As String ) as Double

Alphabetical Listing

## Arguments

Name | Comments
--- | ---
transaction | The name of an open transaction.

The lr.get_transaction_duration function returns the duration in seconds of the specified open transaction to this point.

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

The transaction duration in seconds. If the transaction already ended or if data is not available for the specified transaction, the function returns 0. On function failure, returns a negative number.

## Parameterization

Standard parameterization is not available for this function.

## Example

The following example retrieves the duration of the Setup and Login transactions and sends them to the output

    double duration=lr.get_transaction_duration("Setup");lr.output_message("Duration of the Setup transaction is "+duration+" seconds."); duration=lr.get_transaction_duration("Login");lr.output_message("Duration of the login is "+duration+" seconds."); lr.think_time(3);

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