dbstats.c revision 107325
167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: dbstats - Generation and display of ACPI table statistics
4107325Siwasaki *              $Revision: 64 $
567754Smsmith *
667754Smsmith ******************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1291116Smsmith * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
1370243Smsmith * All rights reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2767754Smsmith * Code in any form, with the right to sublicense such rights; and
2867754Smsmith *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3067754Smsmith * license (with the right to sublicense), under only those claims of Intel
3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3467754Smsmith * license, and in no event shall the patent license extend to any additions
3567754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3667754Smsmith * is granted directly or by implication, estoppel or otherwise;
3767754Smsmith *
3867754Smsmith * The above copyright and patent license is granted only if the following
3967754Smsmith * conditions are met:
4067754Smsmith *
4167754Smsmith * 3. Conditions
4267754Smsmith *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4467754Smsmith * Redistribution of source code of any substantial portion of the Covered
4567754Smsmith * Code or modification with rights to further distribute source must include
4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
5167754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5267754Smsmith * must include a prominent statement that the modification is derived,
5367754Smsmith * directly or indirectly, from Original Intel Code.
5467754Smsmith *
5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5667754Smsmith * Redistribution of source code of any substantial portion of the Covered
5767754Smsmith * Code or modification without rights to further distribute source must
5867754Smsmith * include the following Disclaimer and Export Compliance provision in the
5967754Smsmith * documentation and/or other materials provided with distribution.  In
6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6267754Smsmith * license from Licensee to its licensee is limited to the intellectual
6367754Smsmith * property embodied in the software Licensee provides to its licensee, and
6467754Smsmith * not to intellectual property embodied in modifications its licensee may
6567754Smsmith * make.
6667754Smsmith *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7067754Smsmith * provision in the documentation and/or other materials provided with the
7167754Smsmith * distribution.
7267754Smsmith *
7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7467754Smsmith * Intel Code.
7567754Smsmith *
7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7867754Smsmith * other dealings in products derived from or relating to the Covered Code
7967754Smsmith * without prior written authorization from Intel.
8067754Smsmith *
8167754Smsmith * 4. Disclaimer and Export Compliance
8267754Smsmith *
8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8467754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8967754Smsmith * PARTICULAR PURPOSE.
9067754Smsmith *
9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9867754Smsmith * LIMITED REMEDY.
9967754Smsmith *
10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10167754Smsmith * software or system incorporating such software without first obtaining any
10267754Smsmith * required license or other approval from the U. S. Department of Commerce or
10367754Smsmith * any other agency or department of the United States Government.  In the
10467754Smsmith * event Licensee exports any such software from the United States or
10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10667754Smsmith * ensure that the distribution and export/re-export of the software is in
10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11067754Smsmith * software, or service, directly or indirectly, to any country for which the
11167754Smsmith * United States government or any agency thereof requires an export license,
11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11367754Smsmith * such license, approval or letter.
11467754Smsmith *
11567754Smsmith *****************************************************************************/
11667754Smsmith
11767754Smsmith
118104470Siwasaki#include "acpi.h"
119104470Siwasaki#include "acdebug.h"
120104470Siwasaki#include "acnamesp.h"
12167754Smsmith
122102550Siwasaki#ifdef ACPI_DEBUGGER
12367754Smsmith
124102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
12591116Smsmith        ACPI_MODULE_NAME    ("dbstats")
12667754Smsmith
12767754Smsmith/*
12867754Smsmith * Statistics subcommands
12967754Smsmith */
13099679Siwasakistatic ARGUMENT_INFO        AcpiDbStatTypes [] =
13167754Smsmith{
13267754Smsmith    {"ALLOCATIONS"},
13367754Smsmith    {"OBJECTS"},
13467754Smsmith    {"MEMORY"},
13567754Smsmith    {"MISC"},
13667754Smsmith    {"TABLES"},
13767754Smsmith    {"SIZES"},
13883174Smsmith    {"STACK"},
13967754Smsmith    {NULL}           /* Must be null terminated */
14067754Smsmith};
14167754Smsmith
14299679Siwasaki#define CMD_STAT_ALLOCATIONS     0
14399679Siwasaki#define CMD_STAT_OBJECTS         1
14499679Siwasaki#define CMD_STAT_MEMORY          2
14599679Siwasaki#define CMD_STAT_MISC            3
14699679Siwasaki#define CMD_STAT_TABLES          4
14799679Siwasaki#define CMD_STAT_SIZES           5
14899679Siwasaki#define CMD_STAT_STACK           6
14967754Smsmith
15067754Smsmith
15167754Smsmith/*******************************************************************************
15267754Smsmith *
15367754Smsmith * FUNCTION:    AcpiDbEnumerateObject
15467754Smsmith *
15567754Smsmith * PARAMETERS:  ObjDesc             - Object to be counted
15667754Smsmith *
15767754Smsmith * RETURN:      None
15867754Smsmith *
15967754Smsmith * DESCRIPTION: Add this object to the global counts, by object type.
16091116Smsmith *              Limited recursion handles subobjects and packages, and this
16191116Smsmith *              is probably acceptable within the AML debugger only.
16267754Smsmith *
16367754Smsmith ******************************************************************************/
16467754Smsmith
16567754Smsmithvoid
16667754SmsmithAcpiDbEnumerateObject (
16767754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc)
16867754Smsmith{
16967754Smsmith    UINT32                  i;
17067754Smsmith
17167754Smsmith
17267754Smsmith    if (!ObjDesc)
17367754Smsmith    {
17467754Smsmith        return;
17567754Smsmith    }
17667754Smsmith
17767754Smsmith
17867754Smsmith    /* Enumerate this object first */
17967754Smsmith
18083174Smsmith    AcpiGbl_NumObjects++;
18167754Smsmith
182107325Siwasaki    if (ACPI_GET_OBJECT_TYPE (ObjDesc) > ACPI_TYPE_NS_NODE_MAX)
18367754Smsmith    {
18467754Smsmith        AcpiGbl_ObjTypeCountMisc++;
18567754Smsmith    }
18667754Smsmith    else
18767754Smsmith    {
18899679Siwasaki        AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++;
18967754Smsmith    }
19067754Smsmith
19167754Smsmith    /* Count the sub-objects */
19267754Smsmith
19399679Siwasaki    switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
19467754Smsmith    {
19567754Smsmith    case ACPI_TYPE_PACKAGE:
196107325Siwasaki
19791116Smsmith        for (i = 0; i < ObjDesc->Package.Count; i++)
19867754Smsmith        {
19967754Smsmith            AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
20067754Smsmith        }
20167754Smsmith        break;
20267754Smsmith
20367754Smsmith    case ACPI_TYPE_DEVICE:
204107325Siwasaki
20567754Smsmith        AcpiDbEnumerateObject (ObjDesc->Device.SysHandler);
20667754Smsmith        AcpiDbEnumerateObject (ObjDesc->Device.DrvHandler);
20767754Smsmith        AcpiDbEnumerateObject (ObjDesc->Device.AddrHandler);
20867754Smsmith        break;
20967754Smsmith
21087031Smsmith    case ACPI_TYPE_BUFFER_FIELD:
211107325Siwasaki
21291116Smsmith        if (AcpiNsGetSecondaryObject (ObjDesc))
21387031Smsmith        {
21491116Smsmith            AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
21587031Smsmith        }
21687031Smsmith        break;
21787031Smsmith
21867754Smsmith    case ACPI_TYPE_REGION:
219107325Siwasaki
220107325Siwasaki        AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
22167754Smsmith        AcpiDbEnumerateObject (ObjDesc->Region.AddrHandler);
22267754Smsmith        break;
22367754Smsmith
22467754Smsmith    case ACPI_TYPE_POWER:
225107325Siwasaki
22667754Smsmith        AcpiDbEnumerateObject (ObjDesc->PowerResource.SysHandler);
22767754Smsmith        AcpiDbEnumerateObject (ObjDesc->PowerResource.DrvHandler);
22867754Smsmith        break;
22967754Smsmith
23067754Smsmith    case ACPI_TYPE_PROCESSOR:
231107325Siwasaki
23267754Smsmith        AcpiDbEnumerateObject (ObjDesc->Processor.SysHandler);
23367754Smsmith        AcpiDbEnumerateObject (ObjDesc->Processor.DrvHandler);
23467754Smsmith        AcpiDbEnumerateObject (ObjDesc->Processor.AddrHandler);
23567754Smsmith        break;
23667754Smsmith
23767754Smsmith    case ACPI_TYPE_THERMAL:
238107325Siwasaki
23967754Smsmith        AcpiDbEnumerateObject (ObjDesc->ThermalZone.SysHandler);
24067754Smsmith        AcpiDbEnumerateObject (ObjDesc->ThermalZone.DrvHandler);
24167754Smsmith        AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddrHandler);
24267754Smsmith        break;
24399679Siwasaki
24499679Siwasaki    default:
24599679Siwasaki        break;
24667754Smsmith    }
24767754Smsmith}
24867754Smsmith
24967754Smsmith
25067754Smsmith/*******************************************************************************
25167754Smsmith *
25267754Smsmith * FUNCTION:    AcpiDbClassifyOneObject
25367754Smsmith *
25467754Smsmith * PARAMETERS:  Callback for WalkNamespace
25567754Smsmith *
25667754Smsmith * RETURN:      Status
25767754Smsmith *
25867754Smsmith * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
25967754Smsmith *              the parent namespace node.
26067754Smsmith *
26167754Smsmith ******************************************************************************/
26267754Smsmith
26367754SmsmithACPI_STATUS
26467754SmsmithAcpiDbClassifyOneObject (
26567754Smsmith    ACPI_HANDLE             ObjHandle,
26667754Smsmith    UINT32                  NestingLevel,
26767754Smsmith    void                    *Context,
26867754Smsmith    void                    **ReturnValue)
26967754Smsmith{
27067754Smsmith    ACPI_NAMESPACE_NODE     *Node;
27167754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
27267754Smsmith    UINT32                  Type;
27367754Smsmith
27467754Smsmith
27583174Smsmith    AcpiGbl_NumNodes++;
27667754Smsmith
27767754Smsmith    Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
27887031Smsmith    ObjDesc = AcpiNsGetAttachedObject (Node);
27967754Smsmith
28067754Smsmith    AcpiDbEnumerateObject (ObjDesc);
28167754Smsmith
28267754Smsmith    Type = Node->Type;
283107325Siwasaki    if (Type > ACPI_TYPE_NS_NODE_MAX)
28467754Smsmith    {
28567754Smsmith        AcpiGbl_NodeTypeCountMisc++;
28667754Smsmith    }
28767754Smsmith
28867754Smsmith    else
28967754Smsmith    {
29067754Smsmith        AcpiGbl_NodeTypeCount [Type]++;
29167754Smsmith    }
29267754Smsmith
29367754Smsmith    return AE_OK;
29467754Smsmith
29567754Smsmith
29667754Smsmith    /* TBD: These need to be counted during the initial parsing phase */
29767754Smsmith    /*
29867754Smsmith    if (AcpiPsIsNamedOp (Op->Opcode))
29967754Smsmith    {
30067754Smsmith        NumNodes++;
30167754Smsmith    }
30267754Smsmith
30367754Smsmith    if (IsMethod)
30467754Smsmith    {
30567754Smsmith        NumMethodElements++;
30667754Smsmith    }
30767754Smsmith
30867754Smsmith    NumGrammarElements++;
30967754Smsmith    Op = AcpiPsGetDepthNext (Root, Op);
31067754Smsmith
31167754Smsmith    SizeOfParseTree             = (NumGrammarElements - NumMethodElements) * (UINT32) sizeof (ACPI_PARSE_OBJECT);
31267754Smsmith    SizeOfMethodTrees           = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
31367754Smsmith    SizeOfNodeEntries           = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
31467754Smsmith    SizeOfAcpiObjects           = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
31567754Smsmith
31667754Smsmith    */
31767754Smsmith}
31867754Smsmith
31967754Smsmith
32067754Smsmith/*******************************************************************************
32167754Smsmith *
32267754Smsmith * FUNCTION:    AcpiDbCountNamespaceObjects
32367754Smsmith *
32467754Smsmith * PARAMETERS:  None
32567754Smsmith *
32667754Smsmith * RETURN:      Status
32767754Smsmith *
32867754Smsmith * DESCRIPTION: Count and classify the entire namespace, including all
32967754Smsmith *              namespace nodes and attached objects.
33067754Smsmith *
33167754Smsmith ******************************************************************************/
33267754Smsmith
33399679Siwasakivoid
33467754SmsmithAcpiDbCountNamespaceObjects (
33567754Smsmith    void)
33667754Smsmith{
33767754Smsmith    UINT32                  i;
33867754Smsmith
33967754Smsmith
34083174Smsmith    AcpiGbl_NumNodes = 0;
34183174Smsmith    AcpiGbl_NumObjects = 0;
34267754Smsmith
34367754Smsmith    AcpiGbl_ObjTypeCountMisc = 0;
344107325Siwasaki    for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
34567754Smsmith    {
34667754Smsmith        AcpiGbl_ObjTypeCount [i] = 0;
34767754Smsmith        AcpiGbl_NodeTypeCount [i] = 0;
34867754Smsmith    }
34967754Smsmith
35099679Siwasaki    (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
35167754Smsmith                        FALSE, AcpiDbClassifyOneObject, NULL, NULL);
35267754Smsmith}
35367754Smsmith
35467754Smsmith
35567754Smsmith/*******************************************************************************
35667754Smsmith *
35767754Smsmith * FUNCTION:    AcpiDbDisplayStatistics
35867754Smsmith *
35967754Smsmith * PARAMETERS:  TypeArg         - Subcommand
36067754Smsmith *
36167754Smsmith * RETURN:      Status
36267754Smsmith *
36367754Smsmith * DESCRIPTION: Display various statistics
36467754Smsmith *
36567754Smsmith ******************************************************************************/
36667754Smsmith
36767754SmsmithACPI_STATUS
36867754SmsmithAcpiDbDisplayStatistics (
36967754Smsmith    NATIVE_CHAR             *TypeArg)
37067754Smsmith{
37167754Smsmith    UINT32                  i;
37267754Smsmith    UINT32                  Type;
37391116Smsmith    UINT32                  Size;
37491116Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
37582367Smsmith    UINT32                  Outstanding;
37691116Smsmith#endif
37767754Smsmith
37867754Smsmith
37967754Smsmith    if (!AcpiGbl_DSDT)
38067754Smsmith    {
38167754Smsmith        AcpiOsPrintf ("*** Warning:  There is no DSDT loaded\n");
38267754Smsmith    }
38367754Smsmith
38467754Smsmith    if (!TypeArg)
38567754Smsmith    {
38667754Smsmith        AcpiOsPrintf ("The following subcommands are available:\n    ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
38767754Smsmith        return (AE_OK);
38867754Smsmith    }
38967754Smsmith
39091116Smsmith    ACPI_STRUPR (TypeArg);
39167754Smsmith    Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
39267754Smsmith    if (Type == (UINT32) -1)
39367754Smsmith    {
39467754Smsmith        AcpiOsPrintf ("Invalid or unsupported argument\n");
39567754Smsmith        return (AE_OK);
39667754Smsmith    }
39767754Smsmith
39867754Smsmith
39967754Smsmith    switch (Type)
40067754Smsmith    {
40199679Siwasaki    case CMD_STAT_ALLOCATIONS:
40280062Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
40377424Smsmith        AcpiUtDumpAllocationInfo ();
40480062Smsmith#endif
40567754Smsmith        break;
40667754Smsmith
40799679Siwasaki    case CMD_STAT_TABLES:
40867754Smsmith
40967754Smsmith        AcpiOsPrintf ("ACPI Table Information:\n\n");
41067754Smsmith        if (AcpiGbl_DSDT)
41167754Smsmith        {
41269746Smsmith            AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
41367754Smsmith        }
41467754Smsmith        break;
41567754Smsmith
41699679Siwasaki    case CMD_STAT_OBJECTS:
41767754Smsmith
41883174Smsmith        AcpiDbCountNamespaceObjects ();
41983174Smsmith
42067754Smsmith        AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
42167754Smsmith
422104470Siwasaki        AcpiOsPrintf ("%16.16s %10.10s %10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
42367754Smsmith
424107325Siwasaki        for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
42567754Smsmith        {
42677424Smsmith            AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
42767754Smsmith                AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
42867754Smsmith        }
42967754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
43067754Smsmith            AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
43167754Smsmith
43267754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
43383174Smsmith            AcpiGbl_NumNodes, AcpiGbl_NumObjects);
43467754Smsmith        break;
43567754Smsmith
43699679Siwasaki    case CMD_STAT_MEMORY:
43767754Smsmith
43882367Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
43982367Smsmith        AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
44067754Smsmith
44182367Smsmith        for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
44282367Smsmith        {
44382367Smsmith            AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
44467754Smsmith
44582367Smsmith            if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
44682367Smsmith            {
44783174Smsmith                AcpiOsPrintf ("    Cache: [Depth Max Avail Size]         % 7d % 7d % 7d % 7d B\n",
44882367Smsmith                        AcpiGbl_MemoryLists[i].CacheDepth,
44983174Smsmith                        AcpiGbl_MemoryLists[i].MaxCacheDepth,
45082367Smsmith                        AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
45182367Smsmith                        (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
45282367Smsmith
45383174Smsmith                AcpiOsPrintf ("    Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
45482367Smsmith                        AcpiGbl_MemoryLists[i].CacheRequests,
45583174Smsmith                        AcpiGbl_MemoryLists[i].CacheHits,
45682367Smsmith                        AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
45783174Smsmith                        AcpiGbl_MemoryLists[i].ObjectSize);
45882367Smsmith            }
45982367Smsmith
46083174Smsmith            Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
46183174Smsmith                            AcpiGbl_MemoryLists[i].TotalFreed -
46282367Smsmith                            AcpiGbl_MemoryLists[i].CacheDepth;
46382367Smsmith
46482367Smsmith            if (AcpiGbl_MemoryLists[i].ObjectSize)
46582367Smsmith            {
46691116Smsmith                Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
46782367Smsmith            }
46882367Smsmith            else
46982367Smsmith            {
47091116Smsmith                Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
47182367Smsmith            }
47282367Smsmith
47383174Smsmith            AcpiOsPrintf ("    Mem:   [Alloc Free Outstanding Size]  % 7d % 7d % 7d % 7d Kb\n",
47482367Smsmith                    AcpiGbl_MemoryLists[i].TotalAllocated,
47582367Smsmith                    AcpiGbl_MemoryLists[i].TotalFreed,
47682367Smsmith                    Outstanding, Size);
47782367Smsmith        }
47882367Smsmith#endif
47982367Smsmith
48067754Smsmith        break;
48167754Smsmith
48299679Siwasaki    case CMD_STAT_MISC:
48367754Smsmith
48467754Smsmith        AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
48567754Smsmith        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7ld\n", AcpiGbl_PsFindCount);
48667754Smsmith        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", AcpiGbl_NsLookupCount);
48767754Smsmith
48867754Smsmith        AcpiOsPrintf ("\n");
48967754Smsmith
49067754Smsmith        AcpiOsPrintf ("Mutex usage:\n\n");
49167754Smsmith        for (i = 0; i < NUM_MTX; i++)
49267754Smsmith        {
49377424Smsmith            AcpiOsPrintf ("%-28s:       % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount);
49467754Smsmith        }
49567754Smsmith        break;
49667754Smsmith
49767754Smsmith
49899679Siwasaki    case CMD_STAT_SIZES:
49967754Smsmith
50067754Smsmith        AcpiOsPrintf ("\nInternal object sizes:\n\n");
50167754Smsmith
50267754Smsmith        AcpiOsPrintf ("Common           %3d\n", sizeof (ACPI_OBJECT_COMMON));
50371867Smsmith        AcpiOsPrintf ("Number           %3d\n", sizeof (ACPI_OBJECT_INTEGER));
50467754Smsmith        AcpiOsPrintf ("String           %3d\n", sizeof (ACPI_OBJECT_STRING));
50567754Smsmith        AcpiOsPrintf ("Buffer           %3d\n", sizeof (ACPI_OBJECT_BUFFER));
50667754Smsmith        AcpiOsPrintf ("Package          %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
50777424Smsmith        AcpiOsPrintf ("BufferField      %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
50867754Smsmith        AcpiOsPrintf ("Device           %3d\n", sizeof (ACPI_OBJECT_DEVICE));
50967754Smsmith        AcpiOsPrintf ("Event            %3d\n", sizeof (ACPI_OBJECT_EVENT));
51067754Smsmith        AcpiOsPrintf ("Method           %3d\n", sizeof (ACPI_OBJECT_METHOD));
51167754Smsmith        AcpiOsPrintf ("Mutex            %3d\n", sizeof (ACPI_OBJECT_MUTEX));
51267754Smsmith        AcpiOsPrintf ("Region           %3d\n", sizeof (ACPI_OBJECT_REGION));
51367754Smsmith        AcpiOsPrintf ("PowerResource    %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
51467754Smsmith        AcpiOsPrintf ("Processor        %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
51567754Smsmith        AcpiOsPrintf ("ThermalZone      %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
51677424Smsmith        AcpiOsPrintf ("RegionField      %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
51767754Smsmith        AcpiOsPrintf ("BankField        %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
51867754Smsmith        AcpiOsPrintf ("IndexField       %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
51967754Smsmith        AcpiOsPrintf ("Reference        %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
52067754Smsmith        AcpiOsPrintf ("NotifyHandler    %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
52167754Smsmith        AcpiOsPrintf ("AddrHandler      %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
52267754Smsmith        AcpiOsPrintf ("Extra            %3d\n", sizeof (ACPI_OBJECT_EXTRA));
52387031Smsmith        AcpiOsPrintf ("Data             %3d\n", sizeof (ACPI_OBJECT_DATA));
52467754Smsmith
52567754Smsmith        AcpiOsPrintf ("\n");
52667754Smsmith
52799679Siwasaki        AcpiOsPrintf ("ParseObject      %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
52899679Siwasaki        AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
52999679Siwasaki        AcpiOsPrintf ("ParseObjectAsl   %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
53067754Smsmith        AcpiOsPrintf ("OperandObject    %3d\n", sizeof (ACPI_OPERAND_OBJECT));
53167754Smsmith        AcpiOsPrintf ("NamespaceNode    %3d\n", sizeof (ACPI_NAMESPACE_NODE));
53267754Smsmith
53367754Smsmith        break;
53467754Smsmith
53583174Smsmith
53699679Siwasaki    case CMD_STAT_STACK:
537102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT)
53883174Smsmith
53999679Siwasaki        Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
54083174Smsmith
54183174Smsmith        AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
54283174Smsmith        AcpiOsPrintf ("Entry Stack Pointer          %X\n", AcpiGbl_EntryStackPointer);
54383174Smsmith        AcpiOsPrintf ("Lowest Stack Pointer         %X\n", AcpiGbl_LowestStackPointer);
54483174Smsmith        AcpiOsPrintf ("Stack Use                    %X (%d)\n", Size, Size);
54583174Smsmith        AcpiOsPrintf ("Deepest Procedure Nesting    %d\n", AcpiGbl_DeepestNesting);
54699679Siwasaki#endif
54783174Smsmith        break;
54899679Siwasaki
54999679Siwasaki    default:
55099679Siwasaki        break;
55167754Smsmith    }
55267754Smsmith
55367754Smsmith    AcpiOsPrintf ("\n");
55467754Smsmith    return (AE_OK);
55567754Smsmith}
55667754Smsmith
55767754Smsmith
558102550Siwasaki#endif /* ACPI_DEBUGGER  */
559