Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
56e90b12
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
56e90b12
编写于
4月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(tools) add network speed test codes
上级
15ddbe82
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
21 deletion
+37
-21
source/dnode/mgmt/interface/src/dmInt.c
source/dnode/mgmt/interface/src/dmInt.c
+2
-2
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+5
-4
tools/shell/src/shellNettest.c
tools/shell/src/shellNettest.c
+30
-15
未找到文件。
source/dnode/mgmt/interface/src/dmInt.c
浏览文件 @
56e90b12
...
...
@@ -174,8 +174,8 @@ static void dmGetServerStatus(SDnode *pDnode, SServerStatusRsp *pStatus) {
void
dmProcessNettestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
)
{
dDebug
(
"net test req is received"
);
SRpcMsg
rsp
=
{.
handle
=
pRpc
->
handle
,
.
ahandle
=
pRpc
->
ahandle
,
.
code
=
0
};
rsp
.
pCont
=
rpcMallocCont
(
shell
.
args
.
pk
tLen
);
rsp
.
contLen
=
shell
.
args
.
pk
tLen
;
rsp
.
pCont
=
rpcMallocCont
(
pRpc
->
con
tLen
);
rsp
.
contLen
=
pRpc
->
con
tLen
;
rpcSendResponse
(
&
rsp
);
}
...
...
tools/shell/src/shellArguments.c
浏览文件 @
56e90b12
...
...
@@ -242,10 +242,11 @@ static void shellInitArgs(int argc, char *argv[]) {
tstrncpy
(
shell
.
args
.
password
,
TSDB_DEFAULT_PASS
,
sizeof
(
shell
.
args
.
password
));
}
shell
.
args
.
pktLen
=
SHELL_DEF_PKG_LEN
;
shell
.
args
.
pktNum
=
SHELL_DEF_PKG_NUM
;
shell
.
args
.
displayWidth
=
SHELL_DEFAULT_MAX_BINARY_DISPLAY_WIDTH
;
shell
.
args
.
user
=
TSDB_DEFAULT_USER
;
SShellArgs
*
pArgs
=
&
shell
.
args
;
pArgs
->
user
=
TSDB_DEFAULT_USER
;
pArgs
->
pktLen
=
SHELL_DEF_PKG_LEN
;
pArgs
->
pktNum
=
SHELL_DEF_PKG_NUM
;
pArgs
->
displayWidth
=
SHELL_DEFAULT_MAX_BINARY_DISPLAY_WIDTH
;
}
static
int32_t
shellCheckArgs
()
{
...
...
tools/shell/src/shellNettest.c
浏览文件 @
56e90b12
...
...
@@ -17,11 +17,12 @@
#include "shellInt.h"
static
void
shellWorkAsClient
()
{
SRpcInit
rpcInit
=
{
0
};
SEpSet
epSet
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
SRpcMsg
rpcRsp
=
{
0
};
void
*
clientRpc
=
NULL
;
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
SShellArgs
*
pArgs
=
&
shell
.
args
;
SRpcInit
rpcInit
=
{
0
};
SEpSet
epSet
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
SRpcMsg
rpcRsp
=
{
0
};
void
*
clientRpc
=
NULL
;
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
"_pwd"
),
strlen
(
"_pwd"
),
pass
);
rpcInit
.
label
=
"CHK"
;
...
...
@@ -39,18 +40,30 @@ static void shellWorkAsClient() {
printf
(
"failed to init net test client since %s
\n
"
,
terrstr
());
goto
_OVER
;
}
printf
(
"net test client is initialized
\n
"
);
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
shell
.
args
.
host
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
(
uint16_t
)
shell
.
args
.
port
;
if
(
pArgs
->
host
==
NULL
)
{
pArgs
->
host
=
tsFirst
;
}
char
fqdn
[
TSDB_FQDN_LEN
]
=
{
0
};
tstrncpy
(
fqdn
,
pArgs
->
host
,
TSDB_FQDN_LEN
);
strtok
(
fqdn
,
":"
);
if
(
pArgs
->
port
==
0
)
{
pArgs
->
port
=
tsServerPort
;
}
printf
(
"net test client is initialized, the server to connect to is %s:%u
\n
"
,
fqdn
,
pArgs
->
port
);
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
pArgs
->
host
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
(
uint16_t
)
pArgs
->
port
;
int32_t
totalSucc
=
0
;
uint64_t
startTime
=
taosGetTimestampUs
();
for
(
int32_t
i
=
0
;
i
<
shell
.
args
.
pktNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pArgs
->
pktNum
;
++
i
)
{
SRpcMsg
rpcMsg
=
{.
ahandle
=
(
void
*
)
0x9525
,
.
msgType
=
TDMT_DND_NET_TEST
};
rpcMsg
.
pCont
=
rpcMallocCont
(
shell
.
args
.
pktLen
);
rpcMsg
.
contLen
=
shell
.
args
.
pktLen
;
rpcMsg
.
pCont
=
rpcMallocCont
(
pArgs
->
pktLen
);
rpcMsg
.
contLen
=
pArgs
->
pktLen
;
printf
(
"net test request is sent, size:%d
\n
"
,
rpcMsg
.
contLen
);
rpcSendRecv
(
clientRpc
,
&
epSet
,
&
rpcMsg
,
&
rpcRsp
);
...
...
@@ -65,8 +78,8 @@ static void shellWorkAsClient() {
uint64_t
endTime
=
taosGetTimestampUs
();
uint64_t
elT
=
endTime
-
startTime
;
printf
(
"
\n
total succ:%5d/%d
\t
cost:%8.2lf ms
\t
speed:%8.2lf MB/s
\n
"
,
totalSucc
,
shell
.
args
.
pktNum
,
elT
/
1000
.
0
,
shell
.
args
.
pktLen
/
(
elT
/
1000000
.
0
)
/
1024
.
0
/
1024
.
0
*
totalSucc
);
printf
(
"
\n
total succ:%5d/%d
\t
cost:%8.2lf ms
\t
speed:%8.2lf MB/s
\n
"
,
totalSucc
,
pArgs
->
pktNum
,
elT
/
1000
.
0
,
pArgs
->
pktLen
/
(
elT
/
1000000
.
0
)
/
1024
.
0
/
1024
.
0
*
totalSucc
);
_OVER:
if
(
clientRpc
!=
NULL
)
{
...
...
@@ -88,8 +101,10 @@ static void shellProcessMsg(void *p, SRpcMsg *pRpc, SEpSet *pEpSet) {
void
shellNettestHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
)
{
shellExit
();
}
static
void
shellWorkAsServer
()
{
SShellArgs
*
pArgs
=
&
shell
.
args
;
SRpcInit
rpcInit
=
{
0
};
rpcInit
.
localPort
=
shell
.
args
.
port
;
rpcInit
.
localPort
=
pArgs
->
port
;
rpcInit
.
label
=
"CHK"
;
rpcInit
.
numOfThreads
=
tsNumOfRpcThreads
;
rpcInit
.
cfp
=
(
RpcCfp
)
shellProcessMsg
;
...
...
@@ -102,7 +117,7 @@ static void shellWorkAsServer() {
printf
(
"failed to init net test server since %s"
,
terrstr
());
}
printf
(
"net test server is initialized
\n
"
);
printf
(
"net test server is initialized
, port:%u
\n
"
,
pArgs
->
port
);
taosSetSignal
(
SIGTERM
,
shellNettestHandler
);
while
(
1
)
taosMsleep
(
10
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录