标题: 关于waste time的疑问 [打印本页] 作者: 青miao 时间: 2012-12-12 13:46 标题: 关于waste time的疑问 最近一直在看云层老师的书,看到下面一段代码
Action()
{
int i;
int baseIter=100;
int wasteTime;
char dude[1000];
merc_timer_handle_t timer;
lr_start_transaction("Demo");
for(i=0;i<=baseIter*1000;i++){
sprintf(dude,"This is the way we waste time in a script=%d",i);
}
wasteTime=lr_end_timer(timer);
lr_wasted_time(wasteTime*100);
lr_end_transaction("Demo",LR_AUTO);
return 0;
}
-----------《性能测试进阶指南LR11》P206-207
大神,用你的办法改了我这边还是不行啊。能再给看看嘛,谢谢
Action.c (9): operands of = have illegal types `pointer to void' and `int'
代码
Action()
{
int i;
int baseIter=100;
double wasteTime;
char dude[1000];
merc_timer_handle_t timer;
lr_start_transaction("Demo");
timer=lr_start_time();
for(i=0;i<=baseIter*1000;i++){
sprintf(dude,"This is the way we waste time in a script=%d",i);
}
wasteTime=lr_end_timer(timer);
lr_wasted_time(wasteTime*100);
lr_end_transaction("Demo",LR_AUTO);
return 0;
}作者: 青miao 时间: 2012-12-14 10:18
快要沉了~~大神作者: coolluo 时间: 2012-12-14 17:11
Action()
{
int i;
int baseIter=100;
int wasteTime;
char dude[1000];
merc_timer_handle_t timer;
lr_start_transaction("Demo");
timer=lr_start_timer();
for(i=0;i<=baseIter*10;i++){
sprintf(dude,"This is the way we waste time in a script=%d",i);
}
wasteTime=lr_end_timer(timer);
lr_wasted_time(wasteTime*10);
lr_end_transaction("Demo",LR_AUTO);
return 0;
}
我的代码是这样的,可以看到waste time 的时间作者: 青miao 时间: 2012-12-17 10:10 回复 7#coolluo