码迷,mamicode.com
首页 > 其他好文 > 详细

LR脚本信息函数-lr_start_timer和lr_end_timer

时间:2020-04-03 11:50:06      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:Plan   net   ima   let   plane   source   down   from   查点   

为了计算时间更加精确,可以用这个函数去掉LR自身的检查点所浪费的时间。如text check and image time

Action()
{
 double time_elapsed, duration, waste;
 merc_timer_handle_t timer;
 int m,n;
  lr_start_transaction("test");

 timer=lr_start_timer();
//   不想记录到transaction时间的操作

 for (m=1;m<50000;m++)
 lr_output_message ("%d",m);
 time_elapsed = lr_end_timer(timer);
 waste = time_elapsed * 1000;
 lr_wasted_time(waste);
 lr_end_transaction("test", LR_AUTO);
 return 0;
}
Action()
{
double time_elapsed;
merc_timer_handle_t timer;

web_url("487989.html",
   "URL=http://www.cnblogs.com/tester2test/archive/2006/08/28/487989.html",
   "Resource=0",
   "RecContentType=text/html",
   "Referer=",
   "Snapshot=t2.inf",
   "Mode=HTML",
   LAST);

lr_start_transaction("download");

timer = lr_start_timer();

Download("http://files.cnblogs.com/tester2test/xncssj.pdf",

"http://www.cnblogs.com/tester2test/archive/2006/08/28/487989.html", "c:\\test.pdf", "wb");

time_elapsed = lr_end_timer(timer);

lr_wasted_time(time_elapsed * 1000);

lr_end_transaction("download", LR_AUTO);

return 0;
}
double time_elapsed, duration, waste;

merc_timer_handle_t timer;

        lr_start_transaction("sampleTrans");

        web_url("index.htm",

               "URL=http://localhost/index.htm",

               "TargetFrame=",

               "Resource=0",

               "RecContentType=text/html",

               "Referer=",

               "Snapshot=t1.inf",

               "Mode=HTML",

               LAST);

        timer = lr_start_timer();

/* Do some checks the duration of which

is not to be included in the transaction. */

        web_image_check("ImgCheck1",

               "src=index_files/image002.jpg",

               LAST);

        web_image_check("ImgCheck2",

               "src=index_files/planets.gif",

               LAST);

// How long did the tests take in seconds.

        time_elapsed = lr_end_timer(timer);

// Convert to millisecond.s

        waste = time_elapsed * 1000;

/* Remove the time the checks took from

        the transaction. */

        lr_wasted_time(waste);

         lr_end_transaction("sampleTrans", LR_AUTO);

 

LR脚本信息函数-lr_start_timer和lr_end_timer

标签:Plan   net   ima   let   plane   source   down   from   查点   

原文地址:https://www.cnblogs.com/lvchengda/p/12625417.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!