Example: lr_end_timer

In the following segment, lr_start_timer and lr_end_timer calculate the time spent on the call to web_reg_save_param. This is then subtracted from the time spent on transaction "Web-tours" with lr_wasted_time.

double time_elapsed;
merc_timer_handle_t timer;
lr_start_transaction ("Web-tours");
    LAST );
timer = lr_start_timer();
web_reg_save_param("WCSParam_Diff1", "LB=http://", "RB=/", "Ord=17", "Search=body", LAST );

/* result is in seconds */
time_elapsed = lr_end_timer(timer);
lr_output_message("Duration of web_reg_save_param = %lf", time_elapsed);

/* Subtract time spent on call web_reg_save_param from all open transactions. 
Wasted time is measured in milliseconds */ 
lr_wasted_time(1000 * time_elapsed);