Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
09701c3f
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
260
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
09701c3f
编写于
12月 26, 2019
作者:
C
Cai Yudong
提交者:
Jin Hai
12月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#216 add CLI to get system info (#806)
上级
03ec4107
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
15 deletion
+33
-15
CHANGELOG.md
CHANGELOG.md
+1
-0
core/src/metrics/SystemInfo.cpp
core/src/metrics/SystemInfo.cpp
+24
-7
core/src/metrics/SystemInfo.h
core/src/metrics/SystemInfo.h
+4
-8
core/src/server/delivery/request/CmdRequest.cpp
core/src/server/delivery/request/CmdRequest.cpp
+4
-0
未找到文件。
CHANGELOG.md
浏览文件 @
09701c3f
...
...
@@ -10,6 +10,7 @@ Please mark all change in change log and use the issue from GitHub
-
\#
770 - Server unittest run failed on low-end server
## Feature
-
\#
216 - Add CLI to get server info
-
\#
343 - Add Opentracing
-
\#
665 - Support get/set config via CLI
-
\#
766 - If partition tag is similar, wrong partition is searched
...
...
core/src/metrics/SystemInfo.cpp
浏览文件 @
09701c3f
...
...
@@ -16,17 +16,14 @@
// under the License.
#include "metrics/SystemInfo.h"
#include "thirdparty/nlohmann/json.hpp"
#include "utils/Log.h"
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <sys/times.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <string>
#include <utility>
#include <map>
#ifdef MILVUS_GPU_VERSION
#include <nvml.h>
...
...
@@ -350,5 +347,25 @@ SystemInfo::Octets() {
return
res
;
}
void
SystemInfo
::
GetSysInfoJsonStr
(
std
::
string
&
result
)
{
std
::
map
<
std
::
string
,
std
::
string
>
sys_info_map
;
sys_info_map
[
"memory_total"
]
=
std
::
to_string
(
GetPhysicalMemory
());
sys_info_map
[
"memory_used"
]
=
std
::
to_string
(
GetProcessUsedMemory
());
std
::
vector
<
uint64_t
>
gpu_mem_total
=
GPUMemoryTotal
();
std
::
vector
<
uint64_t
>
gpu_mem_used
=
GPUMemoryUsed
();
for
(
size_t
i
=
0
;
i
<
gpu_mem_total
.
size
();
i
++
)
{
std
::
string
key_total
=
"gpu"
+
std
::
to_string
(
i
)
+
"_memory_total"
;
std
::
string
key_used
=
"gpu"
+
std
::
to_string
(
i
)
+
"_memory_used"
;
sys_info_map
[
key_total
]
=
std
::
to_string
(
gpu_mem_total
[
i
]);
sys_info_map
[
key_used
]
=
std
::
to_string
(
gpu_mem_used
[
i
]);
}
nlohmann
::
json
sys_info_json
(
sys_info_map
);
result
=
sys_info_json
.
dump
();
}
}
// namespace server
}
// namespace milvus
core/src/metrics/SystemInfo.h
浏览文件 @
09701c3f
...
...
@@ -17,15 +17,8 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/sysinfo.h>
#include <sys/times.h>
#include <sys/types.h>
#include <sys/vtimes.h>
#include <chrono>
#include <
unordered_map
>
#include <
string
>
#include <utility>
#include <vector>
...
...
@@ -127,6 +120,9 @@ class SystemInfo {
GPUTemperature
();
std
::
vector
<
float
>
CPUTemperature
();
void
GetSysInfoJsonStr
(
std
::
string
&
result
);
};
}
// namespace server
...
...
core/src/server/delivery/request/CmdRequest.cpp
浏览文件 @
09701c3f
...
...
@@ -16,6 +16,7 @@
// under the License.
#include "server/delivery/request/CmdRequest.h"
#include "metrics/SystemInfo.h"
#include "scheduler/SchedInst.h"
#include "utils/Log.h"
#include "utils/TimeRecorder.h"
...
...
@@ -52,6 +53,9 @@ CmdRequest::OnExecute() {
#else
result_
=
"CPU"
;
#endif
}
else
if
(
cmd_
==
"get_system_info"
)
{
server
::
SystemInfo
&
sys_info_inst
=
server
::
SystemInfo
::
GetInstance
();
sys_info_inst
.
GetSysInfoJsonStr
(
result_
);
}
else
if
(
cmd_
==
"build_commit_id"
)
{
result_
=
LAST_COMMIT_ID
;
}
else
if
(
cmd_
.
substr
(
0
,
10
)
==
"set_config"
||
cmd_
.
substr
(
0
,
10
)
==
"get_config"
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录