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

lrdp_v2 : correct total ion memory calculation in memstat.py

Use correct API to calculate the total ion memory allocation.
On 64bit platforms, the amount of memory allocated by ion can
exceed 32 bits.

Change-Id: I3a99392a921a288e3581bb842bb9989bd7c0d696
parent c6aca324
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,8 @@ class MemStats(RamParser): ...@@ -90,6 +90,8 @@ class MemStats(RamParser):
offset_total_allocated = \ offset_total_allocated = \
self.ramdump.field_offset( self.ramdump.field_offset(
'struct ion_heap', 'total_allocated') 'struct ion_heap', 'total_allocated')
size = self.ramdump.sizeof(
'((struct ion_heap *)0x0)->total_allocated')
if self.ramdump.arm64: if self.ramdump.arm64:
addressspace = 8 addressspace = 8
else: else:
...@@ -99,9 +101,12 @@ class MemStats(RamParser): ...@@ -99,9 +101,12 @@ class MemStats(RamParser):
for i in range(0, number_of_ion_heaps): for i in range(0, number_of_ion_heaps):
heap_addr_array.append(heap_addr + i * addressspace) heap_addr_array.append(heap_addr + i * addressspace)
temp = self.ramdump.read_word(heap_addr_array[i]) temp = self.ramdump.read_word(heap_addr_array[i])
if size == 4:
total_allocated = self.ramdump.read_int( total_allocated = self.ramdump.read_int(
temp + temp + offset_total_allocated)
offset_total_allocated) if size == 8:
total_allocated = self.ramdump.read_u64(
temp + offset_total_allocated)
if total_allocated is None: if total_allocated is None:
total_allocated = 0 total_allocated = 0
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment