Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e1b11fbb
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看板
提交
e1b11fbb
编写于
12月 10, 2019
作者:
L
lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TBASE-816]
上级
2ac3c3f0
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
23 addition
and
22 deletion
+23
-22
src/modules/monitor/src/monitorSystem.c
src/modules/monitor/src/monitorSystem.c
+13
-12
src/os/linux/src/tsystem.c
src/os/linux/src/tsystem.c
+10
-10
未找到文件。
src/modules/monitor/src/monitorSystem.c
浏览文件 @
e1b11fbb
...
...
@@ -14,6 +14,7 @@
*/
#include "monitor.h"
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -376,7 +377,7 @@ void monitorSaveSystemInfo() {
int64_t
ts
=
taosGetTimestampUs
();
char
*
sql
=
monitor
->
sql
;
int
pos
=
snprintf
(
sql
,
SQL_LENGTH
,
"insert into %s.dn_%s values(%
ld"
,
tsMonitorDbName
,
monitor
->
privateIpStr
,
ts
);
int
pos
=
snprintf
(
sql
,
SQL_LENGTH
,
"insert into %s.dn_%s values(%
"
PRId64
,
tsMonitorDbName
,
monitor
->
privateIpStr
,
ts
);
pos
+=
monitorBuildCpuSql
(
sql
+
pos
);
pos
+=
monitorBuildMemorySql
(
sql
+
pos
);
...
...
@@ -402,16 +403,16 @@ void monitorSaveAcctLog(char *acctId, int64_t currentPointsPerSecond, int64_t ma
char
sql
[
1024
]
=
{
0
};
sprintf
(
sql
,
"insert into %s.acct_%s using %s.acct tags('%s') values(now"
", %ld, %ld "
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %ld, %ld"
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %"
PRId64
,
"%"
PRId64
", %d)"
,
tsMonitorDbName
,
acctId
,
tsMonitorDbName
,
acctId
,
currentPointsPerSecond
,
maxPointsPerSecond
,
totalTimeSeries
,
maxTimeSeries
,
totalStorage
,
maxStorage
,
totalQueryTime
,
maxQueryTime
,
totalInbound
,
maxInbound
,
...
...
@@ -431,7 +432,7 @@ void monitorSaveLog(int level, const char *const format, ...) {
return
;
}
int
len
=
snprintf
(
sql
,
(
size_t
)
max_length
,
"import into %s.log values(%
ld
, %d,'"
,
tsMonitorDbName
,
int
len
=
snprintf
(
sql
,
(
size_t
)
max_length
,
"import into %s.log values(%
\"
PRId64
\"
, %d,'"
,
tsMonitorDbName
,
taosGetTimestampUs
(),
level
);
va_start
(
argpointer
,
format
);
...
...
src/os/linux/src/tsystem.c
浏览文件 @
e1b11fbb
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <ifaddrs.h>
#include <locale.h>
#include <netdb.h>
...
...
@@ -99,7 +99,7 @@ bool taosGetProcMemory(float *memoryUsedMB) {
int64_t
memKB
=
0
;
char
tmp
[
10
];
sscanf
(
line
,
"%s %
ld"
,
tmp
,
&
memKB
);
sscanf
(
line
,
"%s %
"
PRId64
,
tmp
,
&
memKB
);
*
memoryUsedMB
=
(
float
)((
double
)
memKB
/
1024
);
tfree
(
line
);
...
...
@@ -124,7 +124,7 @@ bool taosGetSysCpuInfo(SysCpuInfo *cpuInfo) {
}
char
cpu
[
10
]
=
{
0
};
sscanf
(
line
,
"%s %
lu %lu %lu %lu"
,
cpu
,
&
cpuInfo
->
user
,
&
cpuInfo
->
nice
,
&
cpuInfo
->
system
,
&
cpuInfo
->
idle
);
sscanf
(
line
,
"%s %
"
PRIu64
" %"
PRIu64
" %"
PRIu64
" %"
PRIu64
,
cpu
,
&
cpuInfo
->
user
,
&
cpuInfo
->
nice
,
&
cpuInfo
->
system
,
&
cpuInfo
->
idle
);
tfree
(
line
);
fclose
(
fp
);
...
...
@@ -150,7 +150,7 @@ bool taosGetProcCpuInfo(ProcCpuInfo *cpuInfo) {
for
(
int
i
=
0
,
blank
=
0
;
line
[
i
]
!=
0
;
++
i
)
{
if
(
line
[
i
]
==
' '
)
blank
++
;
if
(
blank
==
PROCESS_ITEM
)
{
sscanf
(
line
+
i
+
1
,
"%
lu %lu %lu %lu"
,
&
cpuInfo
->
utime
,
&
cpuInfo
->
stime
,
&
cpuInfo
->
cutime
,
&
cpuInfo
->
cstime
);
sscanf
(
line
+
i
+
1
,
"%
"
PRIu64
" %"
PRIu64
" %"
PRIu64
" %"
PRIu64
,
&
cpuInfo
->
utime
,
&
cpuInfo
->
stime
,
&
cpuInfo
->
cutime
,
&
cpuInfo
->
cstime
);
break
;
}
}
...
...
@@ -420,7 +420,7 @@ bool taosGetCardInfo(int64_t *bytes) {
}
}
if
(
line
!=
NULL
)
{
sscanf
(
line
,
"%s %
ld %ld %ld %ld %ld %ld %ld %ld %ld %ld"
,
nouse0
,
&
rbytes
,
&
rpackts
,
&
nouse1
,
&
nouse2
,
&
nouse3
,
sscanf
(
line
,
"%s %
"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
" %"
PRId64
,
nouse0
,
&
rbytes
,
&
rpackts
,
&
nouse1
,
&
nouse2
,
&
nouse3
,
&
nouse4
,
&
nouse5
,
&
nouse6
,
&
tbytes
,
&
tpackets
);
*
bytes
=
rbytes
+
tbytes
;
tfree
(
line
);
...
...
@@ -488,10 +488,10 @@ bool taosReadProcIO(int64_t *readbyte, int64_t *writebyte) {
break
;
}
if
(
strstr
(
line
,
"rchar:"
)
!=
NULL
)
{
sscanf
(
line
,
"%s %
ld"
,
tmp
,
readbyte
);
sscanf
(
line
,
"%s %
"
PRId64
,
tmp
,
readbyte
);
readIndex
++
;
}
else
if
(
strstr
(
line
,
"wchar:"
)
!=
NULL
)
{
sscanf
(
line
,
"%s %
ld"
,
tmp
,
writebyte
);
sscanf
(
line
,
"%s %
"
PRId64
,
tmp
,
writebyte
);
readIndex
++
;
}
else
{
}
...
...
@@ -564,9 +564,9 @@ void taosGetSystemInfo() {
}
void
tsPrintOsInfo
()
{
pPrint
(
" os pageSize: %
ld
(KB)"
,
tsPageSize
);
pPrint
(
" os openMax: %
ld"
,
tsOpenMax
);
pPrint
(
" os streamMax: %
ld"
,
tsStreamMax
);
pPrint
(
" os pageSize: %
"
PRId64
"
(KB)"
,
tsPageSize
);
pPrint
(
" os openMax: %
"
PRId64
,
tsOpenMax
);
pPrint
(
" os streamMax: %
"
PRId64
,
tsStreamMax
);
pPrint
(
" os numOfCores: %d"
,
tsNumOfCores
);
pPrint
(
" os totalDisk: %f(GB)"
,
tsTotalDataDirGB
);
pPrint
(
" os totalMemory: %d(MB)"
,
tsTotalMemoryMB
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录