summaryrefslogtreecommitdiffstats
path: root/src/build/debug/Hostboot/MemStats.pm
blob: 00ffd01eef275e17775cad4d4ae52295e53bcb09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#  IBM_PROLOG_BEGIN_TAG
#  This is an automatically generated prolog.
#
#  $Source: src/build/debug/Hostboot/MemStats.pm $
#
#  IBM CONFIDENTIAL
#
#  COPYRIGHT International Business Machines Corp. 2011-2012
#
#  p1
#
#  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.
#
#  Origin: 30
#
#  IBM_PROLOG_END_TAG
use strict;

package Hostboot::MemStats;
use Exporter;
our @EXPORT_OK = ('main');

sub main
{
    my @page_manager_addr =
        ::findSymbolAddress("Singleton<PageManager>::instance()::instance");

    my $free_pages =
        ::read64 @page_manager_addr;

    my $total_pages =
        ::read64 ($page_manager_addr[0] + 8, 8);

    my $free_min =
        ::read64 ::findSymbolAddress("PageManager::cv_low_page_count");

    my $page_coal =
        ::read64 ::findSymbolAddress("PageManager::cv_coalesce_count");

    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");

    my $heap_coal =
        ::read32 ::findSymbolAddress("HeapManager::cv_coalesce_count");

    my $heap_free =
        ::read32 ::findSymbolAddress("HeapManager::cv_free_bytes");

    my $heap_free_chunks =
        ::read32 ::findSymbolAddress("HeapManager::cv_free_chunks");

    my $heap_total = $big_heap_pages_used + $small_heap_pages_used;
    my $heap_max = $big_heap_max + $small_heap_pages_used;


    my $castout_ro =
        ::read32 ::findSymbolAddress("Block::cv_ro_evict_req");

    my $castout_rw =
        ::read32 ::findSymbolAddress("Block::cv_rw_evict_req");


    ::userDisplay "===================================================\n";
    ::userDisplay "MemStats:\n";
    ::userDisplay "    Total pages available:   $total_pages\n";
    ::userDisplay "    Free pages:              $free_pages\n";
    ::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 "    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";
    ::userDisplay "\nVirtual Memory Manager page eviction requests:\n";
    ::userDisplay "    RO page requests:        $castout_ro\n";
    ::userDisplay "    RW page requests:        $castout_rw\n";
    ::userDisplay "===================================================\n";

}

sub helpInfo
{
    my %info = (
        name => "MemStats",
        intro => ["Displays Hostboot memory usage information."],
    );
}
OpenPOWER on IntegriCloud