Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
vendor
qcom-opensource
tools
Commits
6d5492a4
Commit
6d5492a4
authored
8 years ago
by
Linux Build Service Account
Committed by
Gerrit - the friendly Code Review server
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "lrdp-v2: memstat: kernel 4.9 based changes for memstat"
parents
13513e03
0b5b1d77
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux-ramdump-parser-v2/parsers/memstat.py
+44
-14
44 additions, 14 deletions
linux-ramdump-parser-v2/parsers/memstat.py
with
44 additions
and
14 deletions
linux-ramdump-parser-v2/parsers/memstat.py
+
44
−
14
View file @
6d5492a4
# Copyright (c) 2016 The Linux Foundation. All rights reserved.
# Copyright (c) 2016
-2017
The Linux Foundation. All rights reserved.
#
# 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
...
...
@@ -50,7 +50,7 @@ class MemStats(RamParser):
list_walker
.
walk
(
vmlist
,
self
.
list_func
)
self
.
vmalloc_size
=
self
.
bytes_to_mb
(
self
.
vmalloc_size
)
def
calculate_
others
(
self
):
def
calculate_
vm_stat
(
self
):
# Other memory : NR_ANON_PAGES + NR_FILE_PAGES + NR_PAGETABLE \
# + NR_KERNEL_STACK - NR_SWAPCACHE
vmstat_anon_pages
=
self
.
ramdump
.
read_word
(
...
...
@@ -68,6 +68,22 @@ class MemStats(RamParser):
other_mem
=
self
.
pages_to_mb
(
other_mem
)
return
other_mem
def
calculate_vm_node_zone_stat
(
self
):
# Other memory : NR_ANON_MAPPED + NR_FILE_PAGES + NR_PAGETABLE \
# + NR_KERNEL_STACK_KB
vmstat_anon_pages
=
self
.
ramdump
.
read_word
(
'
vm_node_stat[NR_ANON_MAPPED]
'
)
vmstat_file_pages
=
self
.
ramdump
.
read_word
(
'
vm_node_stat[NR_FILE_PAGES]
'
)
vmstat_pagetbl
=
self
.
ramdump
.
read_word
(
'
vm_zone_stat[NR_PAGETABLE]
'
)
vmstat_kernelstack
=
self
.
ramdump
.
read_word
(
'
vm_zone_stat[NR_KERNEL_STACK_KB]
'
)
other_mem
=
(
vmstat_anon_pages
+
vmstat_file_pages
+
vmstat_pagetbl
+
(
vmstat_kernelstack
/
4
))
other_mem
=
self
.
pages_to_mb
(
other_mem
)
return
other_mem
def
calculate_ionmem
(
self
):
number_of_ion_heaps
=
self
.
ramdump
.
read_int
(
'
num_heaps
'
)
heap_addr
=
self
.
ramdump
.
read_word
(
'
heaps
'
)
...
...
@@ -98,16 +114,33 @@ class MemStats(RamParser):
total_mem
=
self
.
ramdump
.
read_word
(
'
totalram_pages
'
)
total_mem
=
self
.
pages_to_mb
(
total_mem
)
# Free Memory
total_free
=
self
.
ramdump
.
read_word
(
'
vm_stat[NR_FREE_PAGES]
'
)
total_free
=
self
.
pages_to_mb
(
total_free
)
if
(
self
.
ramdump
.
kernel_version
<
(
4
,
9
,
0
)):
# Free Memory
total_free
=
self
.
ramdump
.
read_word
(
'
vm_stat[NR_FREE_PAGES]
'
)
total_free
=
self
.
pages_to_mb
(
total_free
)
# slab Memory
slab_rec
=
\
self
.
ramdump
.
read_word
(
'
vm_stat[NR_SLAB_RECLAIMABLE]
'
)
slab_unrec
=
\
self
.
ramdump
.
read_word
(
'
vm_stat[NR_SLAB_UNRECLAIMABLE]
'
)
total_slab
=
self
.
pages_to_mb
(
slab_rec
+
slab_unrec
)
# slab Memory
slab_rec
=
\
self
.
ramdump
.
read_word
(
'
vm_stat[NR_SLAB_RECLAIMABLE]
'
)
slab_unrec
=
\
self
.
ramdump
.
read_word
(
'
vm_stat[NR_SLAB_UNRECLAIMABLE]
'
)
total_slab
=
self
.
pages_to_mb
(
slab_rec
+
slab_unrec
)
#others
other_mem
=
self
.
calculate_vm_stat
()
else
:
# Free Memory
total_free
=
self
.
ramdump
.
read_word
(
'
vm_zone_stat[NR_FREE_PAGES]
'
)
total_free
=
self
.
pages_to_mb
(
total_free
)
# slab Memory
slab_rec
=
\
self
.
ramdump
.
read_word
(
'
vm_zone_stat[NR_SLAB_RECLAIMABLE]
'
)
slab_unrec
=
\
self
.
ramdump
.
read_word
(
'
vm_zone_stat[NR_SLAB_UNRECLAIMABLE]
'
)
total_slab
=
self
.
pages_to_mb
(
slab_rec
+
slab_unrec
)
#others
other_mem
=
self
.
calculate_vm_node_zone_stat
()
# ion memory
ion_mem
=
self
.
calculate_ionmem
()
...
...
@@ -136,9 +169,6 @@ class MemStats(RamParser):
# vmalloc area
self
.
calculate_vmalloc
()
# Others
other_mem
=
self
.
calculate_others
()
# Output prints
out_mem_stat
.
write
(
'
{0:30}: {1:8} MB
'
.
format
(
"
Total RAM
"
,
total_mem
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment