作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想使用“merc_timer_handle_t”
来记录loadrunner中的时间,但是当我创建场景时,LR给出错误消息:“第15行靠近“MasterT”的语法错误”
.
我想知道如何使用“merc_timer_handle_t”
,这是我的脚本
#define _EOF '#'
#include "lrs.h"
#include "web_api.h"
Action ()
{
char *recvbuf;
int recvlen=0;
int rc;
double trans_time;
int i, baseIter = 1000;
char dude[1000];
double wasteTime, actualElapsedTime;
merc_timer_handle_t MasterT, timer;
int n = 100;
rc = lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=192.168.1.130:10001", LrsLastArg);
if (rc = 0 )
{
lr_end_transaction("Conn_socket", LR_PASS);
return 0;
}
else
{
}
//Start transaction
lr_start_transaction("Conn_socket");
// Examine the total elapsed time of the action
MasterT = lr_start_timer();
// Create some elapsed time for the transaction
for (i=0; i< 100; ++i)
sprintf(dude,
"This is the way we create elapsed time artificially = %d", i);
// Create some wasted time and record it with timer
timer = lr_start_timer();
for (i=0; i< 100; ++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("Conn_socket"),
lr_get_transaction_wasted_time("Conn_socket"));
/* 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("Conn_socket"),
lr_get_transaction_wasted_time("Conn_socket"));
lr_output_message("Think time = %lf",lr_get_transaction_think_time("Conn_socket"));
lrs_send("socket0","buf0", LrsLastArg);
lrs_receive ("socket0","buf1",LrsLastArg);
lrs_get_last_received_buffer ("socket0",&recvbuf,&recvlen);
lrs_send("socket0", "buf2", LrsLastArg);
lrs_receive("socket0", "buf3", LrsLastArg);
lrs_send("socket0", "buf4", LrsLastArg);
lrs_receive("socket0", "buf5", LrsLastArg);
lrs_send("socket0", "buf6", LrsLastArg);
lrs_receive("socket0", "buf7", LrsLastArg);
lrs_send("socket0", "buf8", LrsLastArg);
lrs_receive("socket0", "buf9", LrsLastArg);
lr_end_transaction("Conn_socket",LR_AUTO);
actualElapsedTime = lr_end_timer(MasterT);
lr_output_message("Total Elapsed time for Action = %lf", actualElapsedTime);
lrs_close_socket("socket0");
return 0;
}
最佳答案
lr_set_transaction(
"foo"
lr_get_transaction_duration("blahwoof")
-lr_get_transaction_wasted_time("blahwoof")
-lr_get_transaction_think_time("blahoof"),
lr_get_transaction_status("blahwoof")
;
或者,运行测试后,只需对 [Event_Meter] 表运行查询,并连接到 [Event_Map] 表以获取事务名称。事件计量表中跟踪每个记录事件的浪费时间和思考时间
关于c - LR Merc_timer_handle_t,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21621393/
我想使用“merc_timer_handle_t”来记录loadrunner中的时间,但是当我创建场景时,LR给出错误消息:“第15行靠近“MasterT”的语法错误” . 我想知道如何使用“merc
我是一名优秀的程序员,十分优秀!