Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f6e972e9
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
f6e972e9
编写于
9月 29, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test:update the ut.
上级
193e5ed3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
52 addition
and
17 deletion
+52
-17
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+52
-17
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
f6e972e9
...
...
@@ -102,17 +102,6 @@ void queryCallback(void* param, void* res, int32_t code) {
taos_fetch_raw_block_a
(
res
,
fetchCallback
,
param
);
}
void
queryCallback1
(
void
*
param
,
void
*
res
,
int32_t
code
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
printf
(
"failed to execute, reason:%s
\n
"
,
taos_errstr
(
res
));
}
taos_free_result
(
res
);
printf
(
"exec query:
\n
"
);
taos_query_a
(
param
,
"select * from tm1"
,
queryCallback
,
param
);
}
void
createNewTable
(
TAOS
*
pConn
,
int32_t
index
)
{
char
str
[
1024
]
=
{
0
};
sprintf
(
str
,
"create table tu%d using st2 tags(%d)"
,
index
,
index
);
...
...
@@ -141,10 +130,49 @@ void createNewTable(TAOS* pConn, int32_t index) {
taos_free_result
(
p
);
}
}
void
*
queryThread
(
void
*
arg
)
{
TAOS
*
pConn
=
taos_connect
(
"192.168.0.209"
,
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
pConn
==
NULL
)
{
printf
(
"failed to connect to db, reason:%s"
,
taos_errstr
(
pConn
));
return
NULL
;
}
int64_t
el
=
0
;
for
(
int32_t
i
=
0
;
i
<
5000000
;
++
i
)
{
int64_t
st
=
taosGetTimestampUs
();
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"SELECT _wstart as ts,max(usage_user) FROM benchmarkcpu.host_49 WHERE ts >= 1451618560000 AND ts < 1451622160000 INTERVAL(1m) ;"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
else
{
printResult
(
pRes
);
}
taos_free_result
(
pRes
);
el
+=
(
taosGetTimestampUs
()
-
st
);
if
(
i
%
1000
==
0
&&
i
!=
0
)
{
printf
(
"total:%d, avg time:%.2fms
\n
"
,
i
,
el
/
(
double
)(
i
*
1000
));
}
}
taos_close
(
pConn
);
return
NULL
;
}
static
int32_t
numOfThreads
=
1
;
}
// namespace
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
if
(
argc
>
1
)
{
numOfThreads
=
atoi
(
argv
[
1
]);
}
numOfThreads
=
TMAX
(
numOfThreads
,
1
);
printf
(
"the runing threads is:%d"
,
numOfThreads
);
return
RUN_ALL_TESTS
();
}
...
...
@@ -664,7 +692,6 @@ TEST(testCase, insert_test) {
taos_free_result(pRes);
taos_close(pConn);
}
#endif
TEST(testCase, projection_query_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
...
...
@@ -698,15 +725,13 @@ TEST(testCase, projection_query_tables) {
}
taos_free_result(pRes);
for
(
int32_t
i
=
0
;
i
<
5000
;
++
i
)
{
for (int32_t i = 0; i < 5000
000
; ++i) {
pRes = taos_query(pConn,
"SELECT _wstart as ts,max(usage_user) FROM
t_76 WHERE ts >= 1451618560000 AND ts < 1451622160000 INTERVAL(1m)
"
);
"SELECT _wstart as ts,max(usage_user) FROM
host_249 WHERE ts >= 1451618560000 AND ts < 1451622160000 INTERVAL(1m) ;
");
printResult(pRes);
taos_free_result(pRes);
// printf("create table :%d\n", i);
// createNewTable(pConn, i);
}
//
// pRes = taos_query(pConn, "select * from tu");
// if (taos_errno(pRes) != 0) {
// printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
...
...
@@ -727,6 +752,16 @@ TEST(testCase, projection_query_tables) {
taos_free_result(pRes);
taos_close(pConn);
}
#endif
TEST
(
testCase
,
tsbs_perf_test
)
{
TdThread
qid
[
20
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
numOfThreads
;
++
i
)
{
taosThreadCreate
(
&
qid
[
i
],
NULL
,
queryThread
,
NULL
);
}
getchar
();
}
#if 0
TEST(testCase, projection_query_stables) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录