Skip to content
Snippets Groups Projects
Commit effd0b30 authored by Ankur Bansal's avatar Ankur Bansal
Browse files

lrdp_v2 : Print Cached memory in memstat

Print Cached memory in memstat

Change-Id: I91cf7319aebc343a92e6f1e7072f09c905dab5c1
parent 8e99c255
No related branches found
No related tags found
No related merge requests found
# Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. # Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 and # it under the terms of the GNU General Public License version 2 and
...@@ -68,6 +68,12 @@ class MemStats(RamParser): ...@@ -68,6 +68,12 @@ class MemStats(RamParser):
other_mem = self.pages_to_mb(other_mem) other_mem = self.pages_to_mb(other_mem)
return other_mem return other_mem
def calculate_cached(self):
vmstat_file_pages = self.ramdump.read_word(
'vm_node_stat[NR_FILE_PAGES]')
cached = self.pages_to_mb(vmstat_file_pages)
return cached
def calculate_vm_node_zone_stat(self): def calculate_vm_node_zone_stat(self):
# Other memory : NR_ANON_MAPPED + NR_FILE_PAGES + NR_PAGETABLE \ # Other memory : NR_ANON_MAPPED + NR_FILE_PAGES + NR_PAGETABLE \
# + NR_KERNEL_STACK_KB # + NR_KERNEL_STACK_KB
...@@ -146,6 +152,7 @@ class MemStats(RamParser): ...@@ -146,6 +152,7 @@ class MemStats(RamParser):
total_slab = self.pages_to_mb(slab_rec + slab_unrec) total_slab = self.pages_to_mb(slab_rec + slab_unrec)
#others #others
other_mem = self.calculate_vm_node_zone_stat() other_mem = self.calculate_vm_node_zone_stat()
cached = self.calculate_cached()
# ion memory # ion memory
ion_mem = self.calculate_ionmem() ion_mem = self.calculate_ionmem()
...@@ -206,6 +213,8 @@ class MemStats(RamParser): ...@@ -206,6 +213,8 @@ class MemStats(RamParser):
"vmalloc ", self.vmalloc_size)) "vmalloc ", self.vmalloc_size))
out_mem_stat.write('\n{0:30}: {1:8} MB'.format( out_mem_stat.write('\n{0:30}: {1:8} MB'.format(
"Others ", other_mem)) "Others ", other_mem))
out_mem_stat.write('\n{0:30}: {1:8} MB'.format(
"Cached ",cached))
def parse(self): def parse(self):
with self.ramdump.open_file('mem_stat.txt') as out_mem_stat: with self.ramdump.open_file('mem_stat.txt') as out_mem_stat:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment