Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5e77d162
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看板
未验证
提交
5e77d162
编写于
3月 25, 2021
作者:
sangshuduo
提交者:
GitHub
3月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3402] <feature>: taosdemo version. (#5574)
feature completed. Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
f3621188
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
87 addition
and
6 deletion
+87
-6
src/kit/taosdemo/CMakeLists.txt
src/kit/taosdemo/CMakeLists.txt
+47
-0
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+40
-6
未找到文件。
src/kit/taosdemo/CMakeLists.txt
浏览文件 @
5e77d162
...
@@ -3,6 +3,53 @@ PROJECT(TDengine)
...
@@ -3,6 +3,53 @@ PROJECT(TDengine)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
FIND_PACKAGE
(
Git
)
IF
(
GIT_FOUND
)
MESSAGE
(
"Git found"
)
EXECUTE_PROCESS
(
COMMAND
${
GIT_EXECUTABLE
}
log --pretty=oneline -n 1 ../src/kit/taosdemo/taosdemo.c
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDEMO_COMMIT
)
EXECUTE_PROCESS
(
COMMAND bash
"-c"
"echo '
${
TAOSDEMO_COMMIT
}
' | awk '{print $1}' | cut -c -9"
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDEMO_COMMIT_SHA1
)
EXECUTE_PROCESS
(
COMMAND
${
GIT_EXECUTABLE
}
status -z -s ../src/kit/taosdemo/taosdemo.c
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDEMO_STATUS
)
EXECUTE_PROCESS
(
COMMAND bash
"-c"
"echo '
${
TAOSDEMO_STATUS
}
' | awk '{print $1}'"
RESULT_VARIABLE RESULT
OUTPUT_VARIABLE TAOSDEMO_STATUS
)
MESSAGE
(
"taosdemo.c status: "
${
TAOSDEMO_STATUS
}
)
ELSE
()
MESSAGE
(
"Git not found"
)
SET
(
TAOSDEMO_COMMIT_SHA1
"unknown"
)
SET
(
TAOSDEMO_STATUS
"unknown"
)
ENDIF
(
GIT_FOUND
)
STRING
(
STRIP
${
TAOSDEMO_COMMIT_SHA1
}
TAOSDEMO_COMMIT_SHA1
)
MESSAGE
(
"taosdemo's latest commit in short is:"
${
TAOSDEMO_COMMIT_SHA1
}
)
STRING
(
STRIP
${
TAOSDEMO_STATUS
}
TAOSDEMO_STATUS
)
IF
(
TAOSDEMO_STATUS MATCHES
"M"
)
SET
(
TAOSDEMO_STATUS
"modified"
)
ELSE
()
SET
(
TAOSDEMO_STATUS
""
)
ENDIF
()
MESSAGE
(
"taosdemo's status is:"
${
TAOSDEMO_STATUS
}
)
ADD_DEFINITIONS
(
-DTAOSDEMO_COMMIT_SHA1=
"
${
TAOSDEMO_COMMIT_SHA1
}
"
)
ADD_DEFINITIONS
(
-DTAOSDEMO_STATUS=
"
${
TAOSDEMO_STATUS
}
"
)
MESSAGE
(
"VERNUMBER is:"
${
VERNUMBER
}
)
IF
(
VERNUMBER MATCHES
""
)
ADD_DEFINITIONS
(
-DTD_VERNUMBER=
"TDengie-version-unknown"
)
ELSE
()
ADD_DEFINITIONS
(
-DTD_VERNUMBER=
"
${
VERNUMBER
}
"
)
ENDIF
()
IF
(
TD_LINUX
)
IF
(
TD_LINUX
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
taosdemo
${
SRC
}
)
ADD_EXECUTABLE
(
taosdemo
${
SRC
}
)
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
5e77d162
...
@@ -94,6 +94,7 @@ enum TEST_MODE {
...
@@ -94,6 +94,7 @@ enum TEST_MODE {
#define DEFAULT_TIMESTAMP_STEP 1
#define DEFAULT_TIMESTAMP_STEP 1
typedef
enum
CREATE_SUB_TALBE_MOD_EN
{
typedef
enum
CREATE_SUB_TALBE_MOD_EN
{
PRE_CREATE_SUBTBL
,
PRE_CREATE_SUBTBL
,
AUTO_CREATE_SUBTBL
,
AUTO_CREATE_SUBTBL
,
...
@@ -590,6 +591,32 @@ static FILE * g_fpOfInsertResult = NULL;
...
@@ -590,6 +591,32 @@ static FILE * g_fpOfInsertResult = NULL;
static
void
ERROR_EXIT
(
const
char
*
msg
)
{
perror
(
msg
);
exit
(
-
1
);
}
static
void
ERROR_EXIT
(
const
char
*
msg
)
{
perror
(
msg
);
exit
(
-
1
);
}
#ifndef TAOSDEMO_COMMIT_SHA1
#define TAOSDEMO_COMMIT_SHA1 "unknown"
#endif
#ifndef TD_VERNUMBER
#define TD_VERNUMBER "unknown"
#endif
#ifndef TAOSDEMO_STATUS
#define TAOSDEMO_STATUS "unknown"
#endif
static
void
printVersion
()
{
char
tdengine_ver
[]
=
TD_VERNUMBER
;
char
taosdemo_ver
[]
=
TAOSDEMO_COMMIT_SHA1
;
char
taosdemo_status
[]
=
TAOSDEMO_STATUS
;
if
(
strlen
(
taosdemo_status
)
==
0
)
{
printf
(
"taosdemo verison %s-%s
\n
"
,
tdengine_ver
,
taosdemo_ver
);
}
else
{
printf
(
"taosdemo verison %s-%s, status:%s
\n
"
,
tdengine_ver
,
taosdemo_ver
,
taosdemo_status
);
}
}
static
void
printHelp
()
{
static
void
printHelp
()
{
char
indent
[
10
]
=
" "
;
char
indent
[
10
]
=
" "
;
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-f"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-f"
,
indent
,
...
@@ -647,6 +674,8 @@ static void printHelp() {
...
@@ -647,6 +674,8 @@ static void printHelp() {
"Out of order data's range, ms, default is 1000."
);
"Out of order data's range, ms, default is 1000."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-g"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-g"
,
indent
,
"Print debug info."
);
"Print debug info."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-V, --version"
,
indent
,
"Print version info."
);
/* printf("%s%s%s%s\n", indent, "-D", indent,
/* printf("%s%s%s%s\n", indent, "-D", indent,
"if elete database if exists. 0: no, 1: yes, default is 1");
"if elete database if exists. 0: no, 1: yes, default is 1");
*/
*/
...
@@ -788,6 +817,10 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -788,6 +817,10 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
||
arguments
->
method_of_delete
>
3
)
{
||
arguments
->
method_of_delete
>
3
)
{
arguments
->
method_of_delete
=
0
;
arguments
->
method_of_delete
=
0
;
}
}
}
else
if
((
strcmp
(
argv
[
i
],
"--version"
)
==
0
)
||
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)){
printVersion
();
exit
(
0
);
}
else
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
)
{
printHelp
();
printHelp
();
exit
(
0
);
exit
(
0
);
...
@@ -5187,7 +5220,8 @@ static void *readTable(void *sarg) {
...
@@ -5187,7 +5220,8 @@ static void *readTable(void *sarg) {
double
totalT
=
0
;
double
totalT
=
0
;
int
count
=
0
;
int
count
=
0
;
for
(
int
i
=
0
;
i
<
num_of_tables
;
i
++
)
{
for
(
int
i
=
0
;
i
<
num_of_tables
;
i
++
)
{
sprintf
(
command
,
"select %s from %s%d where ts>= %"
PRId64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
sTime
);
sprintf
(
command
,
"select %s from %s%d where ts>= %"
PRId64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
sTime
);
double
t
=
getCurrentTime
();
double
t
=
getCurrentTime
();
TAOS_RES
*
pSql
=
taos_query
(
taos
,
command
);
TAOS_RES
*
pSql
=
taos_query
(
taos
,
command
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录