Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
97c983bb
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看板
提交
97c983bb
编写于
4月 25, 2021
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3937]<test>: add taosdemo performance test compare scripts
上级
183e6ff0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
147 addition
and
0 deletion
+147
-0
tests/perftest-scripts/perftest-taosdemo-compare.sh
tests/perftest-scripts/perftest-taosdemo-compare.sh
+147
-0
未找到文件。
tests/perftest-scripts/perftest-taosdemo-compare.sh
0 → 100755
浏览文件 @
97c983bb
#!/bin/bash
WORK_DIR
=
/home/ubuntu/pxiao
TDENGINE_DIR
=
/home/ubuntu/pxiao/TDengine
NUM_OF_VERSIONS
=
5
CURRENT_VERSION
=
0
today
=
`
date
+
"%Y%m%d"
`
TAOSDEMO_COMPARE_TEST_REPORT
=
$TDENGINE_DIR
/tests/taosdemo-compare-test-report-
$today
.log
# Coloured Echoes
function
red_echo
{
echo
-e
"
\0
33[31m
$@
\0
33[0m"
;
}
function
green_echo
{
echo
-e
"
\0
33[32m
$@
\0
33[0m"
;
}
function
yellow_echo
{
echo
-e
"
\0
33[33m
$@
\0
33[0m"
;
}
function
white_echo
{
echo
-e
"
\0
33[1;37m
$@
\0
33[0m"
;
}
# Coloured Printfs
function
red_printf
{
printf
"
\0
33[31m
$@
\0
33[0m"
;
}
function
green_printf
{
printf
"
\0
33[32m
$@
\0
33[0m"
;
}
function
yellow_printf
{
printf
"
\0
33[33m
$@
\0
33[0m"
;
}
function
white_printf
{
printf
"
\0
33[1;37m
$@
\0
33[0m"
;
}
# Debugging Outputs
function
white_brackets
{
local
args
=
"
$@
"
;
white_printf
"["
;
printf
"
${
args
}
"
;
white_printf
"]"
;
}
function
echoInfo
{
local
args
=
"
$@
"
;
white_brackets
$(
green_printf
"INFO"
)
&&
echo
"
${
args
}
"
;
}
function
echoWarn
{
local
args
=
"
$@
"
;
echo
"
$(
white_brackets
"
$(
yellow_printf
"WARN"
)
"
&&
echo
"
${
args
}
"
;
)
"
1>&2
;
}
function
echoError
{
local
args
=
"
$@
"
;
echo
"
$(
white_brackets
"
$(
red_printf
"ERROR"
)
"
&&
echo
"
${
args
}
"
;
)
"
1>&2
;
}
function
getCurrentVersion
{
echoInfo
"Build TDengine"
cd
$WORK_DIR
/TDengine
git remote update
>
/dev/null
git reset
--hard
HEAD
git checkout master
REMOTE_COMMIT
=
`
git rev-parse
--short
remotes/origin/master
`
LOCAL_COMMIT
=
`
git rev-parse
--short
@
`
echo
" LOCAL:
$LOCAL_COMMIT
"
echo
"REMOTE:
$REMOTE_COMMIT
"
if
[
"
$LOCAL_COMMIT
"
==
"
$REMOTE_COMMIT
"
]
;
then
echo
"repo up-to-date"
else
echo
"repo need to pull"
git pull
>
/dev/null 2>&1
fi
cd
debug
rm
-rf
*
cmake ..
>
/dev/null 2>&1
make
>
/dev/null 2>&1
make
install
>
/dev/null 2>&1
rm
-rf
$WORK_DIR
/taosdemo
cp
-r
$TDENGINE_DIR
/src/kit/taosdemo
$WORK_DIR
CURRENT_VERSION
=
`
taosd
-V
|
grep
version |
awk
'{print $3}'
|
awk
-F
.
'{print $3}'
`
}
function
buildTDengineByVersion
()
{
echoInfo
"build TDengine on branch:
$1
"
git reset
--hard
HEAD
git checkout
$1
git pull
>
/dev/null
rm
-rf
$TDENGINE_DIR
/src/kit/taosdemo
cp
-r
$WORK_DIR
/taosdemo
$TDENGINE_DIR
/src/kit
cd
$TDENGINE_DIR
/debug
rm
-rf
*
cmake ..
>
/dev/null 2>&1
make
>
/dev/null 2>&1
make
install
>
/dev/null 2>&1
}
function
stopTaosd
{
echo
"Stop taosd"
systemctl stop taosd
PID
=
`
ps
-ef
|grep
-w
taosd |
grep
-v
grep
|
awk
'{print $2}'
`
while
[
-n
"
$PID
"
]
do
pkill
-TERM
-x
taosd
sleep
1
PID
=
`
ps
-ef
|grep
-w
taosd |
grep
-v
grep
|
awk
'{print $2}'
`
done
}
function
startTaosd
{
echo
"Start taosd"
rm
-rf
/var/lib/perf/
*
rm
-rf
/var/log/perf/
*
nohup
taosd
-c
/etc/perf/
>
/dev/null 2>&1 &
sleep
10
}
function
runTaosdemoCompare
{
echoInfo
"Stop Taosd"
stopTaosd
getCurrentVersion
release
=
"master"
[
-f
$TAOSDEMO_COMPARE_TEST_REPORT
]
&&
rm
$TAOSDEMO_COMPARE_TEST_REPORT
for
((
i
=
0
;
i<
$NUM_OF_VERSIONS
;
i++
))
do
startTaosd
taos
-s
"drop database if exists demodb;"
taosdemo
-y
-d
demodb
>
taosdemoperf.txt
echoInfo
"==================== taosdemo performance for
$release
===================="
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
CREATE_TABLE_TIME
=
`
grep
'Spent'
taosdemoperf.txt |
awk
'NR==1{print $2}'
`
INSERT_RECORDS_TIME
=
`
grep
'Spent'
taosdemoperf.txt |
awk
'NR==2{print $2}'
`
RECORDS_PER_SECOND
=
`
grep
'Spent'
taosdemoperf.txt |
awk
'NR==2{print $16}'
`
AVG_DELAY
=
`
grep
'delay'
taosdemoperf.txt |
awk
'{print $4}'
|
awk
-Fm
'{print $1}'
`
MAX_DELAY
=
`
grep
'delay'
taosdemoperf.txt |
awk
'{print $6}'
|
awk
-Fm
'{print $1}'
`
MIN_DELAY
=
`
grep
'delay'
taosdemoperf.txt |
awk
'{print $8}'
|
awk
-Fm
'{print $1}'
`
echo
"create table time:
$CREATE_TABLE_TIME
seconds"
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
echo
"insert records time:
$INSERT_RECORDS_TIME
seconds"
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
echo
"records per second:
$RECORDS_PER_SECOND
records/second"
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
echo
"avg delay:
$AVG_DELAY
ms"
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
echo
"max delay:
$MAX_DELAY
ms"
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
echo
"min delay:
$MIN_DELAY
ms"
|
tee
-a
$TAOSDEMO_COMPARE_TEST_REPORT
[
-f
taosdemoperf.txt
]
&&
rm
taosdemoperf.txt
stopTaosd
version
=
`
expr
$CURRENT_VERSION
-
$i
`
release
=
"release/s1
$version
"
buildTDengineByVersion
$release
done
}
function
sendReport
{
echo
"send report"
receiver
=
"develop@taosdata.com"
mimebody
=
"MIME-Version: 1.0
\n
Content-Type: text/html; charset=utf-8
\n
"
cd
$TDENGINE_DIR
sed
-i
's/\x1b\[[0-9;]*m//g'
$TAOSDEMO_COMPARE_TEST_REPORT
BODY_CONTENT
=
`
cat
$TAOSDEMO_COMPARE_TEST_REPORT
`
echo
-e
"to:
${
receiver
}
\n
subject: Coverage test report
${
today
}
, commit ID:
${
LOCAL_COMMIT
}
\n\n
${
today
}
:
\n
${
BODY_CONTENT
}
"
|
\
(
cat
-
&&
uuencode
$TAOSDEMO_COMPARE_TEST_REPORT
taosdemo-compare-test-report-
$today
.log
)
|
\
ssmtp
"
${
receiver
}
"
&&
echo
"Report Sent!"
}
runTaosdemoCompare
sendReport
echoInfo
"End of Taosdemo Compare Test"
|
tee
-a
$WORK_DIR
/cron.log
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录