summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2012-10-05 12:54:47 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-11-07 14:18:17 -0600
commit20812c9a9c7c1a46a425d5cd5b207d88f81a6ba1 (patch)
treefbbd37b9140ff44fd392315d606023b9f90d55f5
parentbf56ed5337bbc85eec044f2659eefbc2ad17f73f (diff)
downloadblackbird-hostboot-20812c9a9c7c1a46a425d5cd5b207d88f81a6ba1.tar.gz
blackbird-hostboot-20812c9a9c7c1a46a425d5cd5b207d88f81a6ba1.zip
PageMgr and MemStats debug tool enhancements.
Change-Id: I138b4ccd7930912336487bdf3247d581e4a51b94 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/6777 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rwxr-xr-xsrc/build/debug/Hostboot/MemStats.pm131
-rwxr-xr-x[-rw-r--r--]src/build/debug/Hostboot/PageMgr.pm51
2 files changed, 150 insertions, 32 deletions
diff --git a/src/build/debug/Hostboot/MemStats.pm b/src/build/debug/Hostboot/MemStats.pm
index 00ffd01ee..e2caa46ac 100755
--- a/src/build/debug/Hostboot/MemStats.pm
+++ b/src/build/debug/Hostboot/MemStats.pm
@@ -1,33 +1,59 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/debug/Hostboot/MemStats.pm $
+# $Source: src/build/debug/Hostboot/MemStats.pm $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
use strict;
package Hostboot::MemStats;
use Exporter;
our @EXPORT_OK = ('main');
+use constant HEAPMGR_INSTANCE_NAME =>
+ "Singleton<HeapManager>::instance()::instance";
+use constant HEAPMGR_CHUNK_OFFSET => 0;
+#use constant HEAPMGR_BIGCHUNK_OFFSET => 0;
+use constant HEAPMGR_NUMBER_OF_BUCKETS => 12;
+use constant MIN_BUCKET_SIZE => 16;
+use constant FIB_START_INCR => 16;
+
sub main
{
+ my ($packName, $args) = @_;
+
+ my $countchunks = 0;
+ if (defined $args->{"count"})
+ {
+ ::userDisplay "counting chunks";
+ $countchunks = 1;
+ }
+ my $showchunks = 0;
+ if (defined $args->{"show"})
+ {
+ ::userDisplay "showing chunks";
+ $showchunks = 1;
+ }
+
+ my ($heap_manager_addr, $symSize) =
+ ::findSymbolAddress(HEAPMGR_INSTANCE_NAME);
+
my @page_manager_addr =
::findSymbolAddress("Singleton<PageManager>::instance()::instance");
@@ -43,12 +69,12 @@ sub main
my $page_coal =
::read64 ::findSymbolAddress("PageManager::cv_coalesce_count");
- my $big_heap_pages_used =
+ my $big_heap_pages_used =
::read32 ::findSymbolAddress("HeapManager::cv_largeheap_page_count");
my $big_heap_max =
::read32 ::findSymbolAddress("HeapManager::cv_largeheap_page_max");
-
+
my $small_heap_pages_used =
::read32 ::findSymbolAddress("HeapManager::cv_smallheap_page_count");
@@ -79,7 +105,8 @@ sub main
::userDisplay " Free pages Low mark: $free_min\n";
::userDisplay " Page chunks coalesced: $page_coal\n";
::userDisplay "\nHeap:\n";
- ::userDisplay " Pages used by heap: $heap_total\n";
+ ::userDisplay " Pages used by heap: $heap_total ".
+ "(B:$big_heap_pages_used,S:$small_heap_pages_used)\n";
::userDisplay " Max. Pages used by heap: $heap_max\n";
::userDisplay " heap free bytes/chunks $heap_free/$heap_free_chunks (valid only after a coalescing)\n";
::userDisplay " Heap chunks coalesced: $heap_coal\n";
@@ -88,6 +115,54 @@ sub main
::userDisplay " RW page requests: $castout_rw\n";
::userDisplay "===================================================\n";
+ if( $showchunks )
+ {
+ ::userDisplay "Show Buckets - ";
+ #Show the entire heap
+ ::userDisplay(sprintf("HeapManager at 0x%X\n",$heap_manager_addr));
+ my $bucketsize = MIN_BUCKET_SIZE;
+ my $oldbucketsize = MIN_BUCKET_SIZE;
+ for (my $bucket = 0; $bucket < HEAPMGR_NUMBER_OF_BUCKETS; $bucket++)
+ {
+ my $stackAddr =
+ ::read32($heap_manager_addr + HEAPMGR_CHUNK_OFFSET +
+ (8 * $bucket) + 4);
+ ::userDisplay(sprintf("%d : stackaddr=0x%.8X\n",
+ $bucket,$stackAddr) );
+
+ showPagesInStack($stackAddr,$bucket,$bucketsize);
+
+ my $tmpsize = $bucketsize;
+ $bucketsize = $bucketsize + $oldbucketsize;
+ $oldbucketsize = $tmpsize;
+ }
+ }
+
+ if( $countchunks )
+ {
+ ::userDisplay "Show Buckets - ";
+ #Show the entire heap
+ ::userDisplay( sprintf("HeapManager at 0x%X\n",$heap_manager_addr) );
+ my $bucketsize = MIN_BUCKET_SIZE;
+ my $oldbucketsize = MIN_BUCKET_SIZE;
+ for (my $bucket = 0; $bucket < HEAPMGR_NUMBER_OF_BUCKETS; $bucket++)
+ {
+ my $stackAddr =
+ ::read32($heap_manager_addr + HEAPMGR_CHUNK_OFFSET +
+ (8 * $bucket) + 4);
+
+ my $numchunks = countChunks($stackAddr);
+
+ ::userDisplay(
+ sprintf("Bucket %d(=%d) has %d chunks = %d bytes\n",
+ $bucket,$bucketsize,$numchunks,
+ $bucketsize*$numchunks));
+
+ my $tmpsize = $bucketsize;
+ $bucketsize = $bucketsize + $oldbucketsize;
+ $oldbucketsize = $tmpsize;
+ }
+ }
}
sub helpInfo
@@ -97,3 +172,25 @@ sub helpInfo
intro => ["Displays Hostboot memory usage information."],
);
}
+
+sub showPagesInStack
+{
+ my $stack = shift;
+ my $bucket = shift;
+ my $bucketsize = shift;
+ ::userDisplay(sprintf "..stack=0x%.8X-0x%.8X : %d=%d bytes\n",
+ $stack,$stack+$bucketsize,$bucket,$bucketsize);
+
+ return 0 if (0 == $stack);
+
+ return 1 + showPagesInStack(::read64($stack+8),$bucket,$bucketsize);
+}
+
+sub countChunks
+{
+ my $stack = shift;
+
+ return 0 if (0 == $stack);
+
+ return 1 + countChunks(::read64($stack+8));
+}
diff --git a/src/build/debug/Hostboot/PageMgr.pm b/src/build/debug/Hostboot/PageMgr.pm
index 0a279f6b6..db25a47d6 100644..100755
--- a/src/build/debug/Hostboot/PageMgr.pm
+++ b/src/build/debug/Hostboot/PageMgr.pm
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/debug/Hostboot/PageMgr.pm $
+# $Source: src/build/debug/Hostboot/PageMgr.pm $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2012
+# COPYRIGHT International Business Machines Corp. 2012,2013
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
use strict;
@@ -35,7 +35,6 @@ use constant PAGEMGR_PAGES_AVAIL_OFFSET => 0;
use constant PAGEMGR_BUCKETS_OFFSET => 8;
use constant PAGEMGR_NUMBER_OF_BUCKETS => 16;
-
sub main
{
my ($packName, $args) = @_;
@@ -46,6 +45,11 @@ sub main
{
$debug = 1;
}
+ my $showpages = 0;
+ if (defined $args->{"showpages"})
+ {
+ $showpages = 1;
+ }
# Find the PageManager
my ($symAddr, $symSize) = ::findSymbolAddress(PAGEMGR_INSTANCE_NAME);
@@ -76,6 +80,10 @@ sub main
::userDisplay "Bucket $bucket has $stackCount blocks for ".
"$size pages.\n" if $debug;
+
+ if( $debug && $showpages ) {
+ showPagesInStack($stackAddr,(1 << $bucket));
+ }
}
::userDisplay "Pages in buckets: ".$pagesInBuckets."\n";
@@ -97,6 +105,19 @@ sub countItemsInStack
return 1 + countItemsInStack(::read64($stack));
}
+sub showPagesInStack
+{
+ my $stack = shift;
+ my $bucketsize = shift;
+
+ return 0 if (0 == $stack);
+
+ ::userDisplay(sprintf "..mem=0x%.16X..0x%.16X : %d\n",
+ $stack, $stack+4096*$bucketsize, $bucketsize );
+
+ return 1 + showPagesInStack(::read64($stack),$bucketsize);
+}
+
sub helpInfo
{
my %info = (
OpenPOWER on IntegriCloud