From 253cf2d3da85378442c88347b65f98a8ee8cdf64 Mon Sep 17 00:00:00 2001
From: Ankur Bansal <ankban@codeaurora.org>
Date: Wed, 24 Oct 2018 11:46:52 +0530
Subject: [PATCH] lrdp_v2 : Print Unaccounted memory in memstat

Print Unaccounted memory in memstat

Change-Id: I79f0472943acc80a114cb8517b7696245fd8eb2d
Signed-off-by: Ankur Bansal <ankban@codeaurora.org>
---
 linux-ramdump-parser-v2/parsers/memstat.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/linux-ramdump-parser-v2/parsers/memstat.py b/linux-ramdump-parser-v2/parsers/memstat.py
index 8477b2a..02c0b10 100644
--- a/linux-ramdump-parser-v2/parsers/memstat.py
+++ b/linux-ramdump-parser-v2/parsers/memstat.py
@@ -222,6 +222,11 @@ class MemStats(RamParser):
         # vmalloc area
         self.calculate_vmalloc()
 
+        accounted_mem = total_free + total_slab + ion_mem + kgsl_memory + \
+                        self.vmalloc_size + other_mem
+
+        unaccounted_mem = total_mem - accounted_mem
+
         # Output prints
         out_mem_stat.write('{0:30}: {1:8} MB'.format(
                                 "Total RAM", total_mem))
@@ -241,6 +246,8 @@ class MemStats(RamParser):
                             "Others  ", other_mem))
         out_mem_stat.write('\n{0:30}: {1:8} MB'.format(
                             "Cached  ",cached))
+        out_mem_stat.write('\n\n{0:30}: {1:8} MB'.format(
+                            "Total Unaccounted Memory ",unaccounted_mem))
 
     def parse(self):
         with self.ramdump.open_file('mem_stat.txt') as out_mem_stat:
-- 
GitLab