lr.getTransactionDuration
Returns the duration of a transaction.
Example: Transactions | Transaction Functions |
Syntax
lr.getTransactionDuration( transaction );
Arguments
Argument | Comments |
---|---|
transaction | The name of the transaction. |
The lr.getTransactionDuration 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.getTransactionDuration 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.endTransaction.
To determine other transaction statistics, such as think time and wasted time, use the Transaction Functions.
Return Values
On success, returns the transaction duration in seconds. On failure, returns a negative number. If the transaction already ended or if data is not available for the specified transaction, returns 0.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
function Action(){ var transTime; var status; lr.startTransaction("Flight"); web.url( { name : 'kalimanjaro', url : 'http://kalimanjaro/', targetFrame : '', resource : 0, recContentType : 'text/html', referer : '', snapshot : 't1.inf', mode : 'HTML' } ); // Get transaction time to this point transTime=lr.getTransactionDuration("Flight"); status = web.url( { name : 'kalimanjaro', url : 'http://kalimanjaro/', targetFrame : '', resource : 0, recContentType : 'text/html', referer : '', snapshot : 't1.inf', mode : 'HTML' } ); /* End transaction with operation result */ if (status == 0) lr.endTransaction("Flight",lr.PASS); else lr.endTransaction("Flight",lr.FAIL); if (transTime) lr.outputMessage("The duration up to the submit is "+transTime+" seconds"); else lr.outputMessage("The duration cannot be determined."); return 0; }