Performance Center Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

saving duration as a parameter in a vugen script

SOLVED
Go to Solution
Advisor

saving duration as a parameter in a vugen script

Hi All,

I want to save the duration of a transaction as a parameter (time which takes to script runs and completes) and according to this parameter I want to define if transaction fails. for example if it takes more than 5 seconds for transaction to be completed I want it  to finish with lr_end_transaction ("transaction_name", lr_fail)

is there a way to do this?

thanks

5 REPLIES
Valued Contributor

Re: saving duration as a parameter in a vugen script

you could do this.

 

 

   double wasteTime, actualElapsedTime;
    merc_timer_handle_t MasterT;

 

lr_start_transaction("myTransaction1");
// Examine the total elapsed time of the action
    MasterT = lr_start_timer();

.....

..... your w_s_d or any other code

 

actualElapsedTime = lr_end_timer(MasterT);

 

if (actualElapsedTime>=something)

          lr_end_transaction("myTransaction1",LR_PASS);

else

 

          lr_end_transaction("myTransaction1",LR_FAIL);

 

 

Pavankumar
Advisor

Re: saving duration as a parameter in a vugen script

Hi PavanKumar,

 

thanks for reply,

I added the codes to the script but it did not work.

in this script I want to ping an IP and if I can not ping it I want the script fails.

the script is below. although I can not ping the IP is sasys transaction pass.

 

Action()
{
    double wasteTime, actualElapsedTime;

  
merc_timer_handle_t MasterT2; 

 

    lr_start_transaction("Ping_Tempo");
    MasterT2 = lr_start_timer();
 
    system("ping X.X.X.X");
    if (actualElapsedTime<=5)

          lr_end_transaction("Ping_Tempo",LR_PASS);

else

 

          lr_end_transaction("Ping_Tempo",LR_FAIL);


    return 0;

Valued Contributor

Re: saving duration as a parameter in a vugen script

your code wont work because you have not ended the timer. lr_end_timer.

Pavankumar
Advisor

Re: saving duration as a parameter in a vugen script

Thanks very much it worked :)

Highlighted
Valued Contributor

Re: saving duration as a parameter in a vugen script

cool. can you mark my answer as solved?

Pavankumar