LR脚本信息函数-lr_start_timer和lr_end_timer
Posted lvchengda
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LR脚本信息函数-lr_start_timer和lr_end_timer相关的知识,希望对你有一定的参考价值。
为了计算时间更加精确,可以用这个函数去掉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的主要内容,如果未能解决你的问题,请参考以下文章