Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4df259b7
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4df259b7
编写于
12月 19, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
profile schemaless to find the cpu hotspot
上级
47771a05
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
26 deletion
+40
-26
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+1
-1
tests/examples/c/schemaless.c
tests/examples/c/schemaless.c
+39
-25
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
4df259b7
...
...
@@ -1191,7 +1191,7 @@ static int32_t applyChildTableDataPoints(TAOS* taos, char* cTableName, char* sTa
SArray
*
cTablePoints
,
size_t
rowSize
,
SSmlLinesInfo
*
info
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
size_t
childTableDataPoints
=
taosArrayGetSize
(
cTablePoints
);
if
(
childTableDataPoints
==
-
1
)
{
if
(
childTableDataPoints
<
10
)
{
code
=
applyChildTableDataPointsWithInsertSQL
(
taos
,
cTableName
,
sTableName
,
sTableSchema
,
cTablePoints
,
rowSize
,
info
);
}
else
{
code
=
applyChildTableDataPointsWithStmt
(
taos
,
cTableName
,
sTableName
,
sTableSchema
,
cTablePoints
,
rowSize
,
info
);
...
...
tests/examples/c/schemaless.c
浏览文件 @
4df259b7
...
...
@@ -105,6 +105,35 @@ int32_t generateLine(char* line, int lineLen, char* lineTemplate, int protocol,
return
TSDB_CODE_SUCCESS
;
}
int32_t
setupSuperTables
(
TAOS
*
taos
,
char
*
lineTemplate
,
int
protocol
,
int
numSuperTables
,
int
numChildTables
,
int
numRowsPerChildTable
,
int
maxBatchesPerThread
,
int64_t
ts
)
{
printf
(
"setup supertables..."
);
{
char
**
linesStb
=
calloc
(
numSuperTables
,
sizeof
(
char
*
));
for
(
int
i
=
0
;
i
<
numSuperTables
;
i
++
)
{
char
*
lineStb
=
calloc
(
strlen
(
lineTemplate
)
+
128
,
1
);
generateLine
(
lineStb
,
strlen
(
lineTemplate
)
+
128
,
lineTemplate
,
protocol
,
i
,
numSuperTables
*
numChildTables
,
ts
+
numSuperTables
*
numChildTables
*
numRowsPerChildTable
);
linesStb
[
i
]
=
lineStb
;
}
SThreadInsertArgs
args
=
{
0
};
args
.
protocol
=
protocol
;
args
.
batches
=
calloc
(
maxBatchesPerThread
,
sizeof
(
maxBatchesPerThread
));
args
.
taos
=
taos
;
args
.
batches
[
0
].
lines
=
linesStb
;
args
.
batches
[
0
].
numLines
=
numSuperTables
;
insertLines
(
&
args
);
free
(
args
.
batches
);
for
(
int
i
=
0
;
i
<
numSuperTables
;
++
i
)
{
free
(
linesStb
[
i
]);
}
free
(
linesStb
);
}
return
TSDB_CODE_SUCCESS
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
numThreads
=
8
;
int
maxBatchesPerThread
=
1024
;
...
...
@@ -117,9 +146,10 @@ int main(int argc, char* argv[]) {
int
maxLinesPerBatch
=
16384
;
int
protocol
=
TSDB_SML_TELNET_PROTOCOL
;
int
assembleSTables
=
0
;
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"s:c:r:f:t:b:p:hv"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"s:c:r:f:t:b:p:
w:
hv"
))
!=
-
1
)
{
switch
(
opt
)
{
case
's'
:
numSuperTables
=
atoi
(
optarg
);
...
...
@@ -142,6 +172,9 @@ int main(int argc, char* argv[]) {
case
'v'
:
verbose
=
true
;
break
;
case
'a'
:
assembleSTables
=
atoi
(
optarg
);
break
;
case
'p'
:
if
(
optarg
[
0
]
==
't'
)
{
protocol
=
TSDB_SML_TELNET_PROTOCOL
;
...
...
@@ -152,11 +185,11 @@ int main(int argc, char* argv[]) {
}
break
;
case
'h'
:
fprintf
(
stderr
,
"Usage: %s -s supertable -c childtable -r rows -f fields -t threads -b maxlines_per_batch -p [t|l|j] -v
\n
"
,
fprintf
(
stderr
,
"Usage: %s -s supertable -c childtable -r rows -f fields -t threads -b maxlines_per_batch -p [t|l|j] -
a assemble-stables -
v
\n
"
,
argv
[
0
]);
exit
(
0
);
default:
/* '?' */
fprintf
(
stderr
,
"Usage: %s -s supertable -c childtable -r rows -f fields -t threads -b maxlines_per_batch -p [t|l|j] -v
\n
"
,
fprintf
(
stderr
,
"Usage: %s -s supertable -c childtable -r rows -f fields -t threads -b maxlines_per_batch -p [t|l|j] -
a assemble-stables -
v
\n
"
,
argv
[
0
]);
exit
(
-
1
);
}
...
...
@@ -200,28 +233,9 @@ int main(int argc, char* argv[]) {
getTelenetTemplate
(
lineTemplate
,
65535
);
}
printf
(
"setup supertables..."
);
{
char
**
linesStb
=
calloc
(
numSuperTables
,
sizeof
(
char
*
));
for
(
int
i
=
0
;
i
<
numSuperTables
;
i
++
)
{
char
*
lineStb
=
calloc
(
strlen
(
lineTemplate
)
+
128
,
1
);
generateLine
(
lineStb
,
strlen
(
lineTemplate
)
+
128
,
lineTemplate
,
protocol
,
i
,
numSuperTables
*
numChildTables
,
ts
+
numSuperTables
*
numChildTables
*
numRowsPerChildTable
);
linesStb
[
i
]
=
lineStb
;
}
SThreadInsertArgs
args
=
{
0
};
args
.
protocol
=
protocol
;
args
.
batches
=
calloc
(
maxBatchesPerThread
,
sizeof
(
maxBatchesPerThread
));
args
.
taos
=
taos
;
args
.
batches
[
0
].
lines
=
linesStb
;
args
.
batches
[
0
].
numLines
=
numSuperTables
;
insertLines
(
&
args
);
free
(
args
.
batches
);
for
(
int
i
=
0
;
i
<
numSuperTables
;
++
i
)
{
free
(
linesStb
[
i
]);
}
free
(
linesStb
);
if
(
assembleSTables
)
{
setupSuperTables
(
taos
,
lineTemplate
,
protocol
,
numSuperTables
,
numChildTables
,
numRowsPerChildTable
,
maxBatchesPerThread
,
ts
);
}
printf
(
"generate lines...
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录