1 Star 0 Fork 44

firstadream/lxc

forked from src-openEuler/lxc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0030-remove-unused-meminfo-stats.patch 2.03 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxiaoyu 提交于 2023-04-21 09:49 . remove unused meminfo stats
From 4daa1572b9f129ba46cefb13683de90b49404872 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <[email protected]>
Date: Tue, 18 Apr 2023 15:22:21 +0800
Subject: [PATCH] remove unused meminfo stats
Signed-off-by: zhangxiaoyu <[email protected]>
---
src/lxc/lxccontainer.c | 10 ----------
src/lxc/lxccontainer.h | 2 --
2 files changed, 12 deletions(-)
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index afbeb3c..cc6c5cd 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -6053,16 +6053,6 @@ static bool do_lxcapi_get_container_metrics(struct lxc_container *c, struct lxc
metrics->cpu_use_nanos = metrics_get_ull(c, cgroup_ops, "cpuacct.usage");
metrics->pids_current = metrics_get_ull(c, cgroup_ops, "pids.current");
- uint64_t usage_bytes;
- uint64_t workingset;
- usage_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1) +
- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1) +
- metrics_match_get_ull(c, cgroup_ops, "memory.stat", "swap", 1);
- // workingset = usage - inactive_file
- workingset = usage_bytes - metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1);
- // Avaliable bytes = limit - workingset
- metrics->avaliable_bytes = metrics_get_ull(c, cgroup_ops, "memory.limit_in_bytes") - workingset;
- metrics->usage_bytes = usage_bytes;
metrics->rss_bytes = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "rss", 1);
metrics->page_faults = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "pgfault", 1);
metrics->major_page_faults = metrics_match_get_ull(c,cgroup_ops, "memory.stat", "pgmajfault", 1);
diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
index 68dfec9..96db5e6 100644
--- a/src/lxc/lxccontainer.h
+++ b/src/lxc/lxccontainer.h
@@ -68,8 +68,6 @@ struct lxc_container_metrics {
/* Memory usage */
uint64_t mem_used;
uint64_t mem_limit;
- uint64_t avaliable_bytes;
- uint64_t usage_bytes;
uint64_t rss_bytes;
uint64_t page_faults;
uint64_t major_page_faults;
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/firstadream/lxc.git
[email protected]:firstadream/lxc.git
firstadream
lxc
lxc
master

搜索帮助