Skip to content
Snippets Groups Projects
Commit 12aebfe6 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "linux-ramdump-parser-v2: Make the page print outs more useful"

parents c1a01fec a02a2754
No related branches found
No related tags found
No related merge requests found
# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
# Copyright (c) 2012-2014, 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
......@@ -28,6 +28,9 @@ class Pagetypeinfo(RamParser):
zname = ramdump.read_cstring(zname_addr, 12)
is_corrupt = False
total_bytes = 0
total_pages = 0
total_orders = [0]*11
total_orders_str = 'Total pages: '
for mtype in range(0, migrate_types):
mname_addr = ramdump.read_word(migratetype_names + mtype * 4)
......@@ -35,6 +38,7 @@ class Pagetypeinfo(RamParser):
pageinfo = ('zone {0:8} type {1:12} '.format(zname, mname))
nums = ''
total_type_bytes = 0
total_type_pages = 0
for order in range(0, 11):
area = zone + free_area_offset + order * free_area_size
......@@ -57,12 +61,18 @@ class Pagetypeinfo(RamParser):
nums = nums + ('{0:6}'.format(pg_count))
total_type_bytes = total_type_bytes + \
pg_count * 4096 * (2 ** order)
total_type_pages = total_type_pages + pg_count * (2 ** order)
total_orders[order] += pg_count
print_out_str(pageinfo + nums +
' = {0} MB'.format(total_type_bytes / (1024 * 1024)))
' = {0} MB {1} pages'.format(total_type_bytes / (1024 * 1024), total_type_pages))
total_bytes = total_bytes + total_type_bytes
total_pages = total_pages + total_type_pages
for order in range(0, 11):
total_orders_str += '{0:6}'.format(total_orders[order])
print_out_str(total_orders_str)
print_out_str('Approximate total for zone {0}: {1} MB\n'.format(
zname, total_bytes / (1024 * 1024)))
print_out_str('Approximate total for zone {0}: {1} MB, {2} pages\n'.format(
zname, total_bytes / (1024 * 1024), total_pages))
if is_corrupt:
print_out_str(
'!!! Numbers may not be accurate due to list corruption!')
......
# Copyright (c) 2013, The Linux Foundation. All rights reserved.
# Copyright (c) 2013-2014, 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
......@@ -66,3 +66,4 @@ class ZoneInfo(RamParser):
for i in xrange(0, max_zone_stats):
print_out_str('{0:30}: {1:8}'.format(vmstat_names[i], self.ramdump.read_word(
self.ramdump.array_index(vmstats_addr, 'atomic_long_t', i))))
print_out_str('Total system pages: {0}'.format(self.ramdump.read_word(self.ramdump.addr_lookup('totalram_pages'))))
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