Friday, January 6, 2012

How To Show Response Times in LoadRunner Vugen with Logging Disabled

Occasionally you want to see transaction response times in Loadrunner Vugen when logging is disabled, perhaps because log output is too verbose to easily see response times.  In that case, one convenient technique is to output response times using the lr_get_transaction_duration() function:

Script Example
Action()
{
  char *transactionName = "test_transaction";
  lr_start_transaction(transactionName);
  SimulateTransactionLogic();
  lr_output_message("ResponseTime,%f", lr_get_transaction_duration(transactionName));
  lr_end_transaction(transactionName, LR_AUTO);
}

SimulateTransactionLogic()
{
  lr_think_time(0.1);
}


Console Output With Logging Disabled
Action.c(9): ResponseTime,0.103419
Vuser Terminated.


Console Output With Logging Enabled
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(5): Notify: Transaction "test_transaction" started.
Action.c(17): lr_think_time: 0.10 seconds.
Action.c(9): ResponseTime,0.106920
Action.c(10): Notify: Transaction "test_transaction" ended with "Pass" status (Duration: 0.1083 Think Time: 0.1005).
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

No comments:

Post a Comment