From d300413d40e7c410f3cc4b34fdd2246aa4459d7b Mon Sep 17 00:00:00 2001 From: zhilan Date: Thu, 20 Jul 2023 15:20:31 +0800 Subject: [PATCH] record cinode and try to make podmem --- source/tools/monitor/unity/collector/plugin/Makefile | 2 +- .../tools/monitor/unity/collector/plugin/podmem/memcg.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/tools/monitor/unity/collector/plugin/Makefile b/source/tools/monitor/unity/collector/plugin/Makefile index 63b7aaf7..4f4007be 100644 --- a/source/tools/monitor/unity/collector/plugin/Makefile +++ b/source/tools/monitor/unity/collector/plugin/Makefile @@ -4,7 +4,7 @@ LDFLAG := -g -fpic -shared OBJS := proto_sender.o LIB := libproto_sender.a -DEPMOD=sample threads kmsg proc_schedstat proc_loadavg unity_nosched unity_irqoff cpudist cpu_bled net_health net_retrans netlink cpufreq gpuinfo pmu_events virtout sum_retrans virtiostat +DEPMOD=sample threads kmsg proc_schedstat proc_loadavg unity_nosched unity_irqoff cpudist cpu_bled net_health net_retrans netlink cpufreq gpuinfo pmu_events virtout sum_retrans virtiostat podmem all: $(LIB) $(DEPMOD) diff --git a/source/tools/monitor/unity/collector/plugin/podmem/memcg.cpp b/source/tools/monitor/unity/collector/plugin/podmem/memcg.cpp index bea1c24f..e740cffe 100644 --- a/source/tools/monitor/unity/collector/plugin/podmem/memcg.cpp +++ b/source/tools/monitor/unity/collector/plugin/podmem/memcg.cpp @@ -133,7 +133,7 @@ static int get_filename(unsigned long dentry, char *filename, int len) return 0; } -int get_top_dentry(unsigned long pfn, int top) +int get_top_dentry(unsigned long pfn, int top, unsigned long cinode) { unsigned long page = PFN_TO_PAGE(pfn); map::iterator iter2; @@ -171,7 +171,7 @@ int get_top_dentry(unsigned long pfn, int top) return 0; cachedset.insert(pair(inode,cached*4)); - history_inodes[inode] = 1; + history_inodes[inode] = cinode; if (cachedset.size() > top) cachedset.erase(--cachedset.end()); } @@ -286,6 +286,7 @@ static int get_dentry_top() info->dirty = 0; info->inactive = 0; info->del = del; + info->cindoe = history_inodes[inode]; info->size = i_size>>10; strncpy(info->filename, end, sizeof(info->filename) - 2); @@ -557,7 +558,7 @@ int scan_pageflags_nooutput(struct options *opt, char *res) shmem = !!(pageflag & (1 <top); + get_top_dentry(pfn, opt->top, inode); } } get_dentry_top(); -- Gitee