167754Smsmith/*******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: dbstats - Generation and display of ACPI table statistics
467754Smsmith *
567754Smsmith ******************************************************************************/
667754Smsmith
7217365Sjkim/*
8217365Sjkim * Copyright (C) 2000 - 2011, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
4467754Smsmith
45193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
46193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
47193341Sjkim#include <contrib/dev/acpica/include/acdebug.h>
48193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
4967754Smsmith
50102550Siwasaki#ifdef ACPI_DEBUGGER
5167754Smsmith
52102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
5391116Smsmith        ACPI_MODULE_NAME    ("dbstats")
5467754Smsmith
55151937Sjkim/* Local prototypes */
56151937Sjkim
57151937Sjkimstatic void
58151937SjkimAcpiDbCountNamespaceObjects (
59151937Sjkim    void);
60151937Sjkim
61151937Sjkimstatic void
62151937SjkimAcpiDbEnumerateObject (
63151937Sjkim    ACPI_OPERAND_OBJECT     *ObjDesc);
64151937Sjkim
65151937Sjkimstatic ACPI_STATUS
66151937SjkimAcpiDbClassifyOneObject (
67151937Sjkim    ACPI_HANDLE             ObjHandle,
68151937Sjkim    UINT32                  NestingLevel,
69151937Sjkim    void                    *Context,
70151937Sjkim    void                    **ReturnValue);
71151937Sjkim
72167805Sjkim#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
73151937Sjkimstatic void
74151937SjkimAcpiDbListInfo (
75151937Sjkim    ACPI_MEMORY_LIST        *List);
76167805Sjkim#endif
77151937Sjkim
78151937Sjkim
7967754Smsmith/*
8067754Smsmith * Statistics subcommands
8167754Smsmith */
8299679Siwasakistatic ARGUMENT_INFO        AcpiDbStatTypes [] =
8367754Smsmith{
8467754Smsmith    {"ALLOCATIONS"},
8567754Smsmith    {"OBJECTS"},
8667754Smsmith    {"MEMORY"},
8767754Smsmith    {"MISC"},
8867754Smsmith    {"TABLES"},
8967754Smsmith    {"SIZES"},
9083174Smsmith    {"STACK"},
9167754Smsmith    {NULL}           /* Must be null terminated */
9267754Smsmith};
9367754Smsmith
9499679Siwasaki#define CMD_STAT_ALLOCATIONS     0
9599679Siwasaki#define CMD_STAT_OBJECTS         1
9699679Siwasaki#define CMD_STAT_MEMORY          2
9799679Siwasaki#define CMD_STAT_MISC            3
9899679Siwasaki#define CMD_STAT_TABLES          4
9999679Siwasaki#define CMD_STAT_SIZES           5
10099679Siwasaki#define CMD_STAT_STACK           6
10167754Smsmith
10267754Smsmith
103167802Sjkim#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
10467754Smsmith/*******************************************************************************
10567754Smsmith *
106151937Sjkim * FUNCTION:    AcpiDbListInfo
107151937Sjkim *
108151937Sjkim * PARAMETERS:  List            - Memory list/cache to be displayed
109151937Sjkim *
110151937Sjkim * RETURN:      None
111151937Sjkim *
112151937Sjkim * DESCRIPTION: Display information about the input memory list or cache.
113151937Sjkim *
114151937Sjkim ******************************************************************************/
115151937Sjkim
116151937Sjkimstatic void
117151937SjkimAcpiDbListInfo (
118151937Sjkim    ACPI_MEMORY_LIST        *List)
119151937Sjkim{
120151937Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS
121151937Sjkim    UINT32                  Outstanding;
122151937Sjkim#endif
123151937Sjkim
124151937Sjkim    AcpiOsPrintf ("\n%s\n", List->ListName);
125151937Sjkim
126151937Sjkim    /* MaxDepth > 0 indicates a cache object */
127151937Sjkim
128151937Sjkim    if (List->MaxDepth > 0)
129151937Sjkim    {
130151937Sjkim        AcpiOsPrintf (
131167802Sjkim            "    Cache: [Depth    MaxD Avail  Size]                %8.2X %8.2X %8.2X %8.2X\n",
132151937Sjkim            List->CurrentDepth,
133151937Sjkim            List->MaxDepth,
134151937Sjkim            List->MaxDepth - List->CurrentDepth,
135151937Sjkim            (List->CurrentDepth * List->ObjectSize));
136151937Sjkim    }
137151937Sjkim
138151937Sjkim#ifdef ACPI_DBG_TRACK_ALLOCATIONS
139151937Sjkim    if (List->MaxDepth > 0)
140151937Sjkim    {
141151937Sjkim        AcpiOsPrintf (
142167802Sjkim            "    Cache: [Requests Hits Misses ObjSize]             %8.2X %8.2X %8.2X %8.2X\n",
143151937Sjkim            List->Requests,
144151937Sjkim            List->Hits,
145151937Sjkim            List->Requests - List->Hits,
146151937Sjkim            List->ObjectSize);
147151937Sjkim    }
148151937Sjkim
149167802Sjkim    Outstanding = AcpiDbGetCacheInfo (List);
150151937Sjkim
151151937Sjkim    if (List->ObjectSize)
152151937Sjkim    {
153167802Sjkim        AcpiOsPrintf (
154167802Sjkim            "    Mem:   [Alloc    Free Max    CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n",
155167802Sjkim            List->TotalAllocated,
156167802Sjkim            List->TotalFreed,
157167802Sjkim            List->MaxOccupied,
158167802Sjkim            Outstanding * List->ObjectSize,
159167802Sjkim            Outstanding);
160151937Sjkim    }
161151937Sjkim    else
162151937Sjkim    {
163167802Sjkim        AcpiOsPrintf (
164167802Sjkim            "    Mem:   [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
165167802Sjkim            List->TotalAllocated,
166167802Sjkim            List->TotalFreed,
167167802Sjkim            List->MaxOccupied,
168167802Sjkim            List->CurrentTotalSize,
169167802Sjkim            Outstanding,
170167802Sjkim            List->TotalSize);
171151937Sjkim    }
172151937Sjkim#endif
173151937Sjkim}
174167802Sjkim#endif
175151937Sjkim
176151937Sjkim
177151937Sjkim/*******************************************************************************
178151937Sjkim *
17967754Smsmith * FUNCTION:    AcpiDbEnumerateObject
18067754Smsmith *
18167754Smsmith * PARAMETERS:  ObjDesc             - Object to be counted
18267754Smsmith *
18367754Smsmith * RETURN:      None
18467754Smsmith *
18567754Smsmith * DESCRIPTION: Add this object to the global counts, by object type.
18691116Smsmith *              Limited recursion handles subobjects and packages, and this
18791116Smsmith *              is probably acceptable within the AML debugger only.
18867754Smsmith *
18967754Smsmith ******************************************************************************/
19067754Smsmith
191151937Sjkimstatic void
19267754SmsmithAcpiDbEnumerateObject (
19367754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc)
19467754Smsmith{
19567754Smsmith    UINT32                  i;
19667754Smsmith
19767754Smsmith
19867754Smsmith    if (!ObjDesc)
19967754Smsmith    {
20067754Smsmith        return;
20167754Smsmith    }
20267754Smsmith
20367754Smsmith    /* Enumerate this object first */
20467754Smsmith
20583174Smsmith    AcpiGbl_NumObjects++;
20667754Smsmith
207193267Sjkim    if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
20867754Smsmith    {
20967754Smsmith        AcpiGbl_ObjTypeCountMisc++;
21067754Smsmith    }
21167754Smsmith    else
21267754Smsmith    {
213193267Sjkim        AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
21467754Smsmith    }
21567754Smsmith
21667754Smsmith    /* Count the sub-objects */
21767754Smsmith
218193267Sjkim    switch (ObjDesc->Common.Type)
21967754Smsmith    {
22067754Smsmith    case ACPI_TYPE_PACKAGE:
221107325Siwasaki
22291116Smsmith        for (i = 0; i < ObjDesc->Package.Count; i++)
22367754Smsmith        {
22467754Smsmith            AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
22567754Smsmith        }
22667754Smsmith        break;
22767754Smsmith
22867754Smsmith    case ACPI_TYPE_DEVICE:
229107325Siwasaki
230117521Snjl        AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify);
231117521Snjl        AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify);
232123315Snjl        AcpiDbEnumerateObject (ObjDesc->Device.Handler);
23367754Smsmith        break;
23467754Smsmith
23587031Smsmith    case ACPI_TYPE_BUFFER_FIELD:
236107325Siwasaki
23791116Smsmith        if (AcpiNsGetSecondaryObject (ObjDesc))
23887031Smsmith        {
23991116Smsmith            AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
24087031Smsmith        }
24187031Smsmith        break;
24287031Smsmith
24367754Smsmith    case ACPI_TYPE_REGION:
244107325Siwasaki
245107325Siwasaki        AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
246123315Snjl        AcpiDbEnumerateObject (ObjDesc->Region.Handler);
24767754Smsmith        break;
24867754Smsmith
24967754Smsmith    case ACPI_TYPE_POWER:
250107325Siwasaki
251117521Snjl        AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify);
252117521Snjl        AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify);
25367754Smsmith        break;
25467754Smsmith
25567754Smsmith    case ACPI_TYPE_PROCESSOR:
256107325Siwasaki
257117521Snjl        AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify);
258117521Snjl        AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify);
259123315Snjl        AcpiDbEnumerateObject (ObjDesc->Processor.Handler);
26067754Smsmith        break;
26167754Smsmith
26267754Smsmith    case ACPI_TYPE_THERMAL:
263107325Siwasaki
264117521Snjl        AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify);
265117521Snjl        AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify);
266123315Snjl        AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler);
26767754Smsmith        break;
26899679Siwasaki
26999679Siwasaki    default:
27099679Siwasaki        break;
27167754Smsmith    }
27267754Smsmith}
27367754Smsmith
27467754Smsmith
27567754Smsmith/*******************************************************************************
27667754Smsmith *
27767754Smsmith * FUNCTION:    AcpiDbClassifyOneObject
27867754Smsmith *
27967754Smsmith * PARAMETERS:  Callback for WalkNamespace
28067754Smsmith *
28167754Smsmith * RETURN:      Status
28267754Smsmith *
28367754Smsmith * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
28467754Smsmith *              the parent namespace node.
28567754Smsmith *
28667754Smsmith ******************************************************************************/
28767754Smsmith
288151937Sjkimstatic ACPI_STATUS
28967754SmsmithAcpiDbClassifyOneObject (
29067754Smsmith    ACPI_HANDLE             ObjHandle,
29167754Smsmith    UINT32                  NestingLevel,
29267754Smsmith    void                    *Context,
29367754Smsmith    void                    **ReturnValue)
29467754Smsmith{
29567754Smsmith    ACPI_NAMESPACE_NODE     *Node;
29667754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc;
29767754Smsmith    UINT32                  Type;
29867754Smsmith
29967754Smsmith
30083174Smsmith    AcpiGbl_NumNodes++;
30167754Smsmith
30267754Smsmith    Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
30387031Smsmith    ObjDesc = AcpiNsGetAttachedObject (Node);
30467754Smsmith
30567754Smsmith    AcpiDbEnumerateObject (ObjDesc);
30667754Smsmith
30767754Smsmith    Type = Node->Type;
308107325Siwasaki    if (Type > ACPI_TYPE_NS_NODE_MAX)
30967754Smsmith    {
31067754Smsmith        AcpiGbl_NodeTypeCountMisc++;
31167754Smsmith    }
31267754Smsmith    else
31367754Smsmith    {
31467754Smsmith        AcpiGbl_NodeTypeCount [Type]++;
31567754Smsmith    }
31667754Smsmith
31767754Smsmith    return AE_OK;
31867754Smsmith
31967754Smsmith
320151937Sjkim#ifdef ACPI_FUTURE_IMPLEMENTATION
321151937Sjkim
32267754Smsmith    /* TBD: These need to be counted during the initial parsing phase */
323151937Sjkim
32467754Smsmith    if (AcpiPsIsNamedOp (Op->Opcode))
32567754Smsmith    {
32667754Smsmith        NumNodes++;
32767754Smsmith    }
32867754Smsmith
32967754Smsmith    if (IsMethod)
33067754Smsmith    {
33167754Smsmith        NumMethodElements++;
33267754Smsmith    }
33367754Smsmith
33467754Smsmith    NumGrammarElements++;
33567754Smsmith    Op = AcpiPsGetDepthNext (Root, Op);
33667754Smsmith
337151937Sjkim    SizeOfParseTree   = (NumGrammarElements - NumMethodElements) *
338151937Sjkim                            (UINT32) sizeof (ACPI_PARSE_OBJECT);
339151937Sjkim    SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
340151937Sjkim    SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
341151937Sjkim    SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
342151937Sjkim#endif
34367754Smsmith}
34467754Smsmith
34567754Smsmith
34667754Smsmith/*******************************************************************************
34767754Smsmith *
34867754Smsmith * FUNCTION:    AcpiDbCountNamespaceObjects
34967754Smsmith *
35067754Smsmith * PARAMETERS:  None
35167754Smsmith *
352151937Sjkim * RETURN:      None
35367754Smsmith *
35467754Smsmith * DESCRIPTION: Count and classify the entire namespace, including all
35567754Smsmith *              namespace nodes and attached objects.
35667754Smsmith *
35767754Smsmith ******************************************************************************/
35867754Smsmith
359151937Sjkimstatic void
36067754SmsmithAcpiDbCountNamespaceObjects (
36167754Smsmith    void)
36267754Smsmith{
36367754Smsmith    UINT32                  i;
36467754Smsmith
36567754Smsmith
36683174Smsmith    AcpiGbl_NumNodes = 0;
36783174Smsmith    AcpiGbl_NumObjects = 0;
36867754Smsmith
36967754Smsmith    AcpiGbl_ObjTypeCountMisc = 0;
370107325Siwasaki    for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
37167754Smsmith    {
37267754Smsmith        AcpiGbl_ObjTypeCount [i] = 0;
37367754Smsmith        AcpiGbl_NodeTypeCount [i] = 0;
37467754Smsmith    }
37567754Smsmith
376151937Sjkim    (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
377199337Sjkim                ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL);
37867754Smsmith}
37967754Smsmith
38067754Smsmith
38167754Smsmith/*******************************************************************************
38267754Smsmith *
38367754Smsmith * FUNCTION:    AcpiDbDisplayStatistics
38467754Smsmith *
38567754Smsmith * PARAMETERS:  TypeArg         - Subcommand
38667754Smsmith *
38767754Smsmith * RETURN:      Status
38867754Smsmith *
38967754Smsmith * DESCRIPTION: Display various statistics
39067754Smsmith *
39167754Smsmith ******************************************************************************/
39267754Smsmith
39367754SmsmithACPI_STATUS
39467754SmsmithAcpiDbDisplayStatistics (
395114237Snjl    char                    *TypeArg)
39667754Smsmith{
39767754Smsmith    UINT32                  i;
398151937Sjkim    UINT32                  Temp;
39967754Smsmith
40067754Smsmith
40167754Smsmith    if (!TypeArg)
40267754Smsmith    {
40367754Smsmith        AcpiOsPrintf ("The following subcommands are available:\n    ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
40467754Smsmith        return (AE_OK);
40567754Smsmith    }
40667754Smsmith
407151937Sjkim    AcpiUtStrupr (TypeArg);
408151937Sjkim    Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
409151937Sjkim    if (Temp == (UINT32) -1)
41067754Smsmith    {
41167754Smsmith        AcpiOsPrintf ("Invalid or unsupported argument\n");
41267754Smsmith        return (AE_OK);
41367754Smsmith    }
41467754Smsmith
41567754Smsmith
416151937Sjkim    switch (Temp)
41767754Smsmith    {
41899679Siwasaki    case CMD_STAT_ALLOCATIONS:
419151937Sjkim
42080062Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
42177424Smsmith        AcpiUtDumpAllocationInfo ();
42280062Smsmith#endif
42367754Smsmith        break;
42467754Smsmith
42599679Siwasaki    case CMD_STAT_TABLES:
42667754Smsmith
427167802Sjkim        AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
42867754Smsmith        break;
42967754Smsmith
43099679Siwasaki    case CMD_STAT_OBJECTS:
43167754Smsmith
43283174Smsmith        AcpiDbCountNamespaceObjects ();
43383174Smsmith
43467754Smsmith        AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
43567754Smsmith
436151937Sjkim        AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
437151937Sjkim            "ACPI_TYPE", "NODES", "OBJECTS");
43867754Smsmith
439107325Siwasaki        for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
44067754Smsmith        {
44177424Smsmith            AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
44267754Smsmith                AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
44367754Smsmith        }
44467754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
44567754Smsmith            AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
44667754Smsmith
44767754Smsmith        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
44883174Smsmith            AcpiGbl_NumNodes, AcpiGbl_NumObjects);
44967754Smsmith        break;
45067754Smsmith
45199679Siwasaki    case CMD_STAT_MEMORY:
45267754Smsmith
45382367Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS
454167805Sjkim        AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n");
45567754Smsmith
456151937Sjkim        AcpiDbListInfo (AcpiGbl_GlobalList);
457151937Sjkim        AcpiDbListInfo (AcpiGbl_NsNodeList);
458167805Sjkim#endif
45967754Smsmith
460151937Sjkim#ifdef ACPI_USE_LOCAL_CACHE
461193267Sjkim        AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
462151937Sjkim        AcpiDbListInfo (AcpiGbl_OperandCache);
463151937Sjkim        AcpiDbListInfo (AcpiGbl_PsNodeCache);
464151937Sjkim        AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
465151937Sjkim        AcpiDbListInfo (AcpiGbl_StateCache);
46682367Smsmith#endif
46782367Smsmith
46867754Smsmith        break;
46967754Smsmith
47099679Siwasaki    case CMD_STAT_MISC:
47167754Smsmith
47267754Smsmith        AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
473151937Sjkim        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7ld\n",
474151937Sjkim            AcpiGbl_PsFindCount);
475151937Sjkim        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
476151937Sjkim            AcpiGbl_NsLookupCount);
47767754Smsmith
47867754Smsmith        AcpiOsPrintf ("\n");
47967754Smsmith
48067754Smsmith        AcpiOsPrintf ("Mutex usage:\n\n");
481167802Sjkim        for (i = 0; i < ACPI_NUM_MUTEX; i++)
48267754Smsmith        {
483151937Sjkim            AcpiOsPrintf ("%-28s:       % 7ld\n",
484151937Sjkim                AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
48567754Smsmith        }
48667754Smsmith        break;
48767754Smsmith
48867754Smsmith
48999679Siwasaki    case CMD_STAT_SIZES:
49067754Smsmith
49167754Smsmith        AcpiOsPrintf ("\nInternal object sizes:\n\n");
49267754Smsmith
49367754Smsmith        AcpiOsPrintf ("Common           %3d\n", sizeof (ACPI_OBJECT_COMMON));
49471867Smsmith        AcpiOsPrintf ("Number           %3d\n", sizeof (ACPI_OBJECT_INTEGER));
49567754Smsmith        AcpiOsPrintf ("String           %3d\n", sizeof (ACPI_OBJECT_STRING));
49667754Smsmith        AcpiOsPrintf ("Buffer           %3d\n", sizeof (ACPI_OBJECT_BUFFER));
49767754Smsmith        AcpiOsPrintf ("Package          %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
49877424Smsmith        AcpiOsPrintf ("BufferField      %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
49967754Smsmith        AcpiOsPrintf ("Device           %3d\n", sizeof (ACPI_OBJECT_DEVICE));
50067754Smsmith        AcpiOsPrintf ("Event            %3d\n", sizeof (ACPI_OBJECT_EVENT));
50167754Smsmith        AcpiOsPrintf ("Method           %3d\n", sizeof (ACPI_OBJECT_METHOD));
50267754Smsmith        AcpiOsPrintf ("Mutex            %3d\n", sizeof (ACPI_OBJECT_MUTEX));
50367754Smsmith        AcpiOsPrintf ("Region           %3d\n", sizeof (ACPI_OBJECT_REGION));
50467754Smsmith        AcpiOsPrintf ("PowerResource    %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
50567754Smsmith        AcpiOsPrintf ("Processor        %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
50667754Smsmith        AcpiOsPrintf ("ThermalZone      %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
50777424Smsmith        AcpiOsPrintf ("RegionField      %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
50867754Smsmith        AcpiOsPrintf ("BankField        %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
50967754Smsmith        AcpiOsPrintf ("IndexField       %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
51067754Smsmith        AcpiOsPrintf ("Reference        %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
511117521Snjl        AcpiOsPrintf ("Notify           %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
512117521Snjl        AcpiOsPrintf ("AddressSpace     %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
51367754Smsmith        AcpiOsPrintf ("Extra            %3d\n", sizeof (ACPI_OBJECT_EXTRA));
51487031Smsmith        AcpiOsPrintf ("Data             %3d\n", sizeof (ACPI_OBJECT_DATA));
51567754Smsmith
51667754Smsmith        AcpiOsPrintf ("\n");
51767754Smsmith
51899679Siwasaki        AcpiOsPrintf ("ParseObject      %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
51999679Siwasaki        AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
52099679Siwasaki        AcpiOsPrintf ("ParseObjectAsl   %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
52167754Smsmith        AcpiOsPrintf ("OperandObject    %3d\n", sizeof (ACPI_OPERAND_OBJECT));
52267754Smsmith        AcpiOsPrintf ("NamespaceNode    %3d\n", sizeof (ACPI_NAMESPACE_NODE));
523193267Sjkim        AcpiOsPrintf ("AcpiObject       %3d\n", sizeof (ACPI_OBJECT));
52467754Smsmith
52567754Smsmith        break;
52667754Smsmith
52783174Smsmith
52899679Siwasaki    case CMD_STAT_STACK:
529102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT)
53083174Smsmith
531193267Sjkim        Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);
53283174Smsmith
53383174Smsmith        AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
534193267Sjkim        AcpiOsPrintf ("Entry Stack Pointer          %p\n", AcpiGbl_EntryStackPointer);
535193267Sjkim        AcpiOsPrintf ("Lowest Stack Pointer         %p\n", AcpiGbl_LowestStackPointer);
536193267Sjkim        AcpiOsPrintf ("Stack Use                    %X (%u)\n", Temp, Temp);
537193267Sjkim        AcpiOsPrintf ("Deepest Procedure Nesting    %u\n", AcpiGbl_DeepestNesting);
53899679Siwasaki#endif
53983174Smsmith        break;
54099679Siwasaki
54199679Siwasaki    default:
54299679Siwasaki        break;
54367754Smsmith    }
54467754Smsmith
54567754Smsmith    AcpiOsPrintf ("\n");
54667754Smsmith    return (AE_OK);
54767754Smsmith}
54867754Smsmith
549102550Siwasaki#endif /* ACPI_DEBUGGER  */
550