loadrunner时间损耗-analysis中忽略

请问怎么在Analysis中过滤掉思考时间?

在Analysis上放"help"下有个漏斗状的图标,鼠标放上去后显示“Apply filter on sunmmary page”,点击此按钮。在弹出框中拉到最下方,有一个选项:Think Time,在Values中有一个下拉选项“Include Think Time” ,去掉前面的勾选项即可。
事务响应时间包括:函数自身,思考时间,wasted time (执行关联,检查点等函数的时间),响应时间
 
 

 

WasteTime()

{

int i, baseIter = 1000;

char dude[1000];

double wasteTime, actualElapsedTime;

merc_timer_handle_t MasterT, timer;

// Examine the total elapsed time of the action

MasterT = lr_start_timer();

//Start transaction

lr_start_transaction("Demo");

// Create some elapsed time for the transaction

for (i=0; i< (10 * baseIter); ++i)

sprintf(dude,

"This is the way we create elapsed time artificially = %d", i);

 

// Add some think time

lr_think_time(0.5);

// Create some wasted time and record it with timer

timer = lr_start_timer();

for (i=0; i< (5 * baseIter); ++i)

sprintf(dude,

"This is the way we waste time in a script = %d", i);

wasteTime = lr_end_timer(timer);

lr_output_message("User created waste time = %lf", wasteTime);

lr_output_message("Before lr_waste_time: Duration = %lf - Waste = %lf",

lr_get_transaction_duration("Demo"),  

lr_get_transaction_wasted_time("Demo"));  ---->Duration = 0.609375 - Waste = 0.000000

/* Convert Timer in seconds to wasted time in milliseconds

and add to internally generated waste time */

wasteTime *= 1000;

lr_wasted_time(wasteTime);

lr_output_message("After lr_waste_time: Duration = %lf - Waste = %lf",

lr_get_transaction_duration("Demo"),

lr_get_transaction_wasted_time("Demo"));----> Duration = 0.625000 - Waste = 0.031000

lr_output_message("Think time = %lf",

lr_get_transaction_think_time("Demo"));

lr_end_transaction("Demo", LR_AUTO);

actualElapsedTime = lr_end_timer(MasterT);

lr_output_message("Total Elapsed time for Action = %lf",

actualElapsedTime);

return 0;

}

Vuser Output log file

Note there is no difference between the transaction duration before and after the call to lr_waste_time

WasteTime.c(28): User created waste time = 0.031250

WasteTime.c(32): Before lr_waste_time: Duration = 0.609375 - Waste = 0.000000

WasteTime.c(40): After lr_waste_time: Duration = 0.625000 - Waste = 0.031000

WasteTime.c(44): Think time = 0.500000

WasteTime.c(47): Notify: Transaction Demo ended with Pass status (Duration: 0.6406 Think Time: 0.5000 Wasted Time: 0.0310).

WasteTime.c(50): Total Elapsed time for Action = 0.640625

 

 

 

 

 


lr_start_timer(单位是s)、lr_end_timer(单位是s)、lr_wasted_time(这个函数的形参中wasted time的单位是毫秒,所以通过timer计的时间需要乘上1000
lr_get_transaction_wasted_time:函数用于返回指定事物当前的损耗时间(wasted time)。
lr_get_transaction_duration:返回事件执行到此处所用的时间
 
 使用lr_get_transaction_wansted_time 函数必须注意:
一它只能对当前运行状态的事物才能返回大于等于0的结果,否则返回小于0的结果。
二是他使用之前应调用lr_wansted_time 函数移除过损耗时间 wasted time,否则lr_get_transaction_wansted_time将返回0。

 

 

 

posted @ 2015-08-01 10:47  heygirl  阅读(390)  评论(0编辑  收藏  举报