Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
97e7bea6
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
97e7bea6
编写于
2月 23, 2021
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2984] <fix>: combine taosdemo and taosdemox. add perf statistics.
上级
4f39518d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
5 deletion
+60
-5
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+60
-5
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
97e7bea6
...
...
@@ -373,6 +373,7 @@ typedef struct SDbs_S {
// statistics
int64_t
totalRowsInserted
;
int64_t
totalAffectedRows
;
}
SDbs
;
typedef
struct
SuperQueryInfo_S
{
...
...
@@ -447,6 +448,14 @@ typedef struct SThreadInfo_S {
// statistics
int64_t
totalRowsInserted
;
int64_t
totalAffectedRows
;
// insert delay statistics
int64_t
cntDelay
;
int64_t
totalDelay
;
int64_t
avgDelay
;
int64_t
maxDelay
;
int64_t
minDelay
;
}
threadInfo
;
typedef
struct
curlMemInfo_S
{
...
...
@@ -2209,6 +2218,7 @@ void startMultiThreadCreateChildTable(char* cols, int threads, int ntables, char
last
=
t_info
->
end_table_id
+
1
;
t_info
->
use_metric
=
1
;
t_info
->
cols
=
cols
;
t_info
->
minDelay
=
INT16_MAX
;
pthread_create
(
pids
+
i
,
NULL
,
createTable
,
t_info
);
}
...
...
@@ -3716,10 +3726,22 @@ void syncWriteForNumberOfTblInOneSql(threadInfo *winfo, FILE *fp, char* sampleDa
if
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"taosc"
,
5
))
{
//printf("multi table===== sql: %s \n\n", buffer);
//int64_t t1 = taosGetTimestampMs();
int64_t
startTs
;
int64_t
endTs
;
startTs
=
taosGetTimestampUs
();
int
affectedRows
=
queryDbExec
(
winfo
->
taos
,
buffer
,
INSERT_TYPE
);
if
(
0
>
affectedRows
)
{
goto
free_and_statistics
;
}
}
else
{
endTs
=
taosGetTimestampUs
();
int64_t
delay
=
endTs
-
startTs
;
if
(
delay
>
winfo
->
maxDelay
)
winfo
->
maxDelay
=
delay
;
if
(
delay
<
winfo
->
minDelay
)
winfo
->
minDelay
=
delay
;
winfo
->
cntDelay
++
;
winfo
->
totalDelay
+=
delay
;
//winfo->avgDelay = (double)winfo->totalDelay / winfo->cntDelay;
}
totalAffectedRows
+=
affectedRows
;
int64_t
currentPrintTime
=
taosGetTimestampMs
();
...
...
@@ -3938,9 +3960,21 @@ void *syncWrite(void *sarg) {
if
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"taosc"
,
5
))
{
//printf("===== sql: %s \n\n", buffer);
//int64_t t1 = taosGetTimestampMs();
int64_t
startTs
;
int64_t
endTs
;
startTs
=
taosGetTimestampUs
();
int
affectedRows
=
queryDbExec
(
winfo
->
taos
,
buffer
,
INSERT_TYPE
);
if
(
0
>
affectedRows
){
goto
free_and_statistics_2
;
}
else
{
endTs
=
taosGetTimestampUs
();
int64_t
delay
=
endTs
-
startTs
;
if
(
delay
>
winfo
->
maxDelay
)
winfo
->
maxDelay
=
delay
;
if
(
delay
<
winfo
->
minDelay
)
winfo
->
minDelay
=
delay
;
winfo
->
cntDelay
++
;
winfo
->
totalDelay
+=
delay
;
//winfo->avgDelay = (double)winfo->totalDelay / winfo->cntDelay;
}
totalAffectedRows
+=
affectedRows
;
...
...
@@ -4164,6 +4198,7 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision, SSu
t_info
->
superTblInfo
=
superTblInfo
;
t_info
->
start_time
=
start_time
;
t_info
->
minDelay
=
INT16_MAX
;
if
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"taosc"
,
5
))
{
//t_info->taos = taos;
...
...
@@ -4202,6 +4237,12 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision, SSu
pthread_join
(
pids
[
i
],
NULL
);
}
int64_t
totalDelay
=
0
;
int64_t
maxDelay
=
0
;
int64_t
minDelay
=
INT16_MAX
;
int64_t
cntDelay
=
0
;
double
avgDelay
=
0
;
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
t_info
=
infos
+
i
;
...
...
@@ -4210,6 +4251,11 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision, SSu
superTblInfo
->
totalAffectedRows
+=
t_info
->
totalAffectedRows
;
superTblInfo
->
totalRowsInserted
+=
t_info
->
totalRowsInserted
;
totalDelay
+=
t_info
->
totalDelay
;
cntDelay
+=
t_info
->
cntDelay
;
if
(
t_info
->
maxDelay
>
maxDelay
)
maxDelay
=
t_info
->
maxDelay
;
if
(
t_info
->
minDelay
<
minDelay
)
minDelay
=
t_info
->
minDelay
;
#ifdef TD_LOWA_CURL
if
(
t_info
->
curl_handle
)
{
curl_easy_cleanup
(
t_info
->
curl_handle
);
...
...
@@ -4217,17 +4263,26 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision, SSu
#endif
}
avgDelay
=
(
double
)
totalDelay
/
cntDelay
;
double
end
=
getCurrentTime
();
printf
(
"Spent %.4f seconds to insert rows: %"
PRId64
", affected rows: %"
PRId64
" with %d thread(s) into %s.%s
\n\n
"
,
end
-
start
,
superTblInfo
->
totalRowsInserted
,
superTblInfo
->
totalAffectedRows
,
threads
,
db_name
,
superTblInfo
->
sTblName
);
fprintf
(
g_fpOfInsertResult
,
"Spent %.4f seconds to insert rows: %"
PRId64
", affected rows: %"
PRId64
" with %d thread(s) into %s.%s
\n\n
"
,
end
-
start
,
superTblInfo
->
totalRowsInserted
,
superTblInfo
->
totalAffectedRows
,
threads
,
db_name
,
superTblInfo
->
sTblName
);
printf
(
"insert delay, avg: %10.6fms, max: %10.6fms, min: %10.6fms
\n\n
"
,
avgDelay
/
1000
.
0
,
(
double
)
maxDelay
/
1000
.
0
,
(
double
)
minDelay
/
1000
.
0
);
fprintf
(
g_fpOfInsertResult
,
"insert delay, avg:%10.6fms, max: %10.6fms, min: %10.6fms
\n\n
"
,
avgDelay
/
1000
.
0
,
(
double
)
maxDelay
/
1000
.
0
,
(
double
)
minDelay
/
1000
.
0
);
//taos_close(taos);
free
(
pids
);
free
(
infos
);
printf
(
"Spent %.4f seconds to insert rows: %"
PRId64
", affected rows: %"
PRId64
" with %d thread(s) into %s.%s
\n\n
"
,
end
-
start
,
superTblInfo
->
totalRowsInserted
,
superTblInfo
->
totalAffectedRows
,
threads
,
db_name
,
superTblInfo
->
sTblName
);
fprintf
(
g_fpOfInsertResult
,
"Spent %.4f seconds to insert rows: %"
PRId64
", affected rows: %"
PRId64
" with %d thread(s) into %s.%s
\n\n
"
,
end
-
start
,
superTblInfo
->
totalRowsInserted
,
superTblInfo
->
totalAffectedRows
,
threads
,
db_name
,
superTblInfo
->
sTblName
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录