Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6883aeb3
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6883aeb3
编写于
6月 30, 2022
作者:
P
plum-lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: add test case
上级
10dcf571
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
15 deletion
+18
-15
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+18
-15
未找到文件。
tests/test/c/tmqSim.c
浏览文件 @
6883aeb3
...
...
@@ -633,8 +633,9 @@ void loop_consume(SThreadInfo* pInfo) {
}
}
uint64_t
lastPrintTime
=
taosGetTimestampMs
();
uint64_t
startTs
=
taosGetTimestampMs
();
int64_t
lastTotalMsgs
=
0
;
uint64_t
lastPrintTime
=
taosGetTimestampMs
();
uint64_t
startTs
=
taosGetTimestampMs
();
int32_t
consumeDelay
=
g_stConfInfo
.
consumeDelay
==
-
1
?
-
1
:
(
g_stConfInfo
.
consumeDelay
*
1000
);
while
(
running
)
{
...
...
@@ -647,20 +648,22 @@ void loop_consume(SThreadInfo* pInfo) {
taos_free_result
(
tmqMsg
);
totalMsgs
++
;
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
10
*
1000
)
{
taosFprintfFile
(
g_fp
,
"consumer id %d has currently poll total msgs: %"
PRId64
"
\n
"
,
pInfo
->
consumerId
,
totalMsgs
);
lastPrintTime
=
currentPrintTime
;
}
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
10
*
1000
)
{
taosFprintfFile
(
g_fp
,
"consumer id %d has currently poll total msgs: %"
PRId64
", period rate: %.3f msgs/second
\n
"
,
pInfo
->
consumerId
,
totalMsgs
,
(
totalMsgs
-
lastTotalMsgs
)
*
1000
.
0
/
(
currentPrintTime
-
lastPrintTime
));
lastPrintTime
=
currentPrintTime
;
lastTotalMsgs
=
totalMsgs
;
}
if
(
0
==
once_flag
)
{
once_flag
=
1
;
notifyMainScript
(
pInfo
,
NOTIFY_CMD_START_CONSUM
);
}
if
(
totalRows
>=
pInfo
->
expectMsgCnt
)
{
if
(
(
totalRows
>=
pInfo
->
expectMsgCnt
)
||
(
totalMsgs
>=
pInfo
->
expectMsgCnt
)
)
{
char
tmpString
[
128
];
taosFprintfFile
(
g_fp
,
"%s over than expect rows, so break consume
\n
"
,
getCurrentTimeString
(
tmpString
));
break
;
...
...
@@ -671,7 +674,7 @@ void loop_consume(SThreadInfo* pInfo) {
break
;
}
}
if
(
0
==
running
)
{
taosFprintfFile
(
g_fp
,
"receive stop signal and not continue consume
\n
"
);
}
...
...
@@ -881,11 +884,11 @@ int main(int32_t argc, char* argv[]) {
int64_t
t
=
end
-
start
;
if
(
0
==
t
)
t
=
1
;
double
tInMs
=
(
double
)
t
/
1000000
.
0
;
taosFprintfFile
(
g_fp
,
"Spent %.4f seconds to poll msgs: %"
PRIu64
" with %d thread(s), throughput: %.2
f msgs/second
\n\n
"
,
tInMs
,
totalMsgs
,
g_stConfInfo
.
numOfThread
,
(
double
)(
totalMsgs
/
tInMs
));
"Spent %.3f seconds to poll msgs: %"
PRIu64
" with %d thread(s), throughput: %.3
f msgs/second
\n\n
"
,
tInMs
,
totalMsgs
,
g_stConfInfo
.
numOfThread
,
(
double
)(
totalMsgs
/
tInMs
));
taosFprintfFile
(
g_fp
,
"==== close tmqlog ====
\n
"
);
taosCloseFile
(
&
g_fp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录