From 15da6e1f057c70eee476730138788fd73de1b208 Mon Sep 17 00:00:00 2001
From: Li Feng <lifeng2221dd1@zoho.com.cn>
Date: Thu, 28 Jan 2021 16:05:18 +0800
Subject: [PATCH 19/19] metrics: add total_inactive_file metric for memory

Signed-off-by: Li Feng <lifeng2221dd1@zoho.com.cn>
---
 src/lxc/lxccontainer.c | 1 +
 src/lxc/lxccontainer.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 9202b73ff..06552ce5c 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -5919,6 +5919,7 @@ static bool do_lxcapi_get_container_metrics(struct lxc_container *c,  struct lxc
 
 	metrics->cache = metrics_match_get_ull(c, cgroup_ops, "memory.stat", "cache", 1);
 	metrics->cache_total = metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_cache", 1);
+	metrics->inactive_file_total = metrics_match_get_ull(c, cgroup_ops, "memory.stat", "total_inactive_file", 1);
 
 	return true;
 }
diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
index e30bf6161..9abbd09ed 100644
--- a/src/lxc/lxccontainer.h
+++ b/src/lxc/lxccontainer.h
@@ -69,6 +69,8 @@ struct lxc_container_metrics {
     /* Cache usage */
     uint64_t cache;
     uint64_t cache_total;
+    /* total inactive file */
+    uint64_t inactive_file_total;
 };
 
 /*!
-- 
2.25.1

