13446Smrj /*******************************************************************************
23446Smrj *
33446Smrj * Module Name: dbstats - Generation and display of ACPI table statistics
43446Smrj *
53446Smrj ******************************************************************************/
63446Smrj
73446Smrj /******************************************************************************
83446Smrj *
93446Smrj * 1. Copyright Notice
103446Smrj *
119980SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
123446Smrj * All rights reserved.
133446Smrj *
143446Smrj * 2. License
153446Smrj *
163446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property
173446Smrj * rights. You may have additional license terms from the party that provided
183446Smrj * you this software, covering your right to use that party's intellectual
193446Smrj * property rights.
203446Smrj *
213446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
223446Smrj * copy of the source code appearing in this file ("Covered Code") an
233446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the
243446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy,
253446Smrj * make derivatives, distribute, use and display any portion of the Covered
263446Smrj * Code in any form, with the right to sublicense such rights; and
273446Smrj *
283446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
293446Smrj * license (with the right to sublicense), under only those claims of Intel
303446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell,
313446Smrj * offer to sell, and import the Covered Code and derivative works thereof
323446Smrj * solely to the minimum extent necessary to exercise the above copyright
333446Smrj * license, and in no event shall the patent license extend to any additions
343446Smrj * to or modifications of the Original Intel Code. No other license or right
353446Smrj * is granted directly or by implication, estoppel or otherwise;
363446Smrj *
373446Smrj * The above copyright and patent license is granted only if the following
383446Smrj * conditions are met:
393446Smrj *
403446Smrj * 3. Conditions
413446Smrj *
423446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source.
433446Smrj * Redistribution of source code of any substantial portion of the Covered
443446Smrj * Code or modification with rights to further distribute source must include
453446Smrj * the above Copyright Notice, the above License, this list of Conditions,
463446Smrj * and the following Disclaimer and Export Compliance provision. In addition,
473446Smrj * Licensee must cause all Covered Code to which Licensee contributes to
483446Smrj * contain a file documenting the changes Licensee made to create that Covered
493446Smrj * Code and the date of any change. Licensee must include in that file the
503446Smrj * documentation of any changes made by any predecessor Licensee. Licensee
513446Smrj * must include a prominent statement that the modification is derived,
523446Smrj * directly or indirectly, from Original Intel Code.
533446Smrj *
543446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
553446Smrj * Redistribution of source code of any substantial portion of the Covered
563446Smrj * Code or modification without rights to further distribute source must
573446Smrj * include the following Disclaimer and Export Compliance provision in the
583446Smrj * documentation and/or other materials provided with distribution. In
593446Smrj * addition, Licensee may not authorize further sublicense of source of any
603446Smrj * portion of the Covered Code, and must include terms to the effect that the
613446Smrj * license from Licensee to its licensee is limited to the intellectual
623446Smrj * property embodied in the software Licensee provides to its licensee, and
633446Smrj * not to intellectual property embodied in modifications its licensee may
643446Smrj * make.
653446Smrj *
663446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any
673446Smrj * substantial portion of the Covered Code or modification must reproduce the
683446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance
693446Smrj * provision in the documentation and/or other materials provided with the
703446Smrj * distribution.
713446Smrj *
723446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original
733446Smrj * Intel Code.
743446Smrj *
753446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by
763446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or
773446Smrj * other dealings in products derived from or relating to the Covered Code
783446Smrj * without prior written authorization from Intel.
793446Smrj *
803446Smrj * 4. Disclaimer and Export Compliance
813446Smrj *
823446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
833446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
843446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
853446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
863446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
873446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
883446Smrj * PARTICULAR PURPOSE.
893446Smrj *
903446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
913446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
923446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
933446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
943446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
953446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
963446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
973446Smrj * LIMITED REMEDY.
983446Smrj *
993446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this
1003446Smrj * software or system incorporating such software without first obtaining any
1013446Smrj * required license or other approval from the U. S. Department of Commerce or
1023446Smrj * any other agency or department of the United States Government. In the
1033446Smrj * event Licensee exports any such software from the United States or
1043446Smrj * re-exports any such software from a foreign destination, Licensee shall
1053446Smrj * ensure that the distribution and export/re-export of the software is in
1063446Smrj * compliance with all laws, regulations, orders, or other restrictions of the
1073446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1083446Smrj * any of its subsidiaries will export/re-export any technical data, process,
1093446Smrj * software, or service, directly or indirectly, to any country for which the
1103446Smrj * United States government or any agency thereof requires an export license,
1113446Smrj * other governmental approval, or letter of assurance, without first obtaining
1123446Smrj * such license, approval or letter.
1133446Smrj *
1143446Smrj *****************************************************************************/
1153446Smrj
1163446Smrj
1173446Smrj #include "acpi.h"
1189980SDana.Myers@Sun.COM #include "accommon.h"
1193446Smrj #include "acdebug.h"
1203446Smrj #include "acnamesp.h"
1213446Smrj
1223446Smrj #ifdef ACPI_DEBUGGER
1233446Smrj
1243446Smrj #define _COMPONENT ACPI_CA_DEBUGGER
1253446Smrj ACPI_MODULE_NAME ("dbstats")
1263446Smrj
1273446Smrj /* Local prototypes */
1283446Smrj
1293446Smrj static void
1303446Smrj AcpiDbCountNamespaceObjects (
1313446Smrj void);
1323446Smrj
1333446Smrj static void
1343446Smrj AcpiDbEnumerateObject (
1353446Smrj ACPI_OPERAND_OBJECT *ObjDesc);
1363446Smrj
1373446Smrj static ACPI_STATUS
1383446Smrj AcpiDbClassifyOneObject (
1393446Smrj ACPI_HANDLE ObjHandle,
1403446Smrj UINT32 NestingLevel,
1413446Smrj void *Context,
1423446Smrj void **ReturnValue);
1433446Smrj
1447851SDana.Myers@Sun.COM #if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
1453446Smrj static void
1463446Smrj AcpiDbListInfo (
1473446Smrj ACPI_MEMORY_LIST *List);
1487851SDana.Myers@Sun.COM #endif
1493446Smrj
1503446Smrj
1513446Smrj /*
1523446Smrj * Statistics subcommands
1533446Smrj */
1543446Smrj static ARGUMENT_INFO AcpiDbStatTypes [] =
1553446Smrj {
1563446Smrj {"ALLOCATIONS"},
1573446Smrj {"OBJECTS"},
1583446Smrj {"MEMORY"},
1593446Smrj {"MISC"},
1603446Smrj {"TABLES"},
1613446Smrj {"SIZES"},
1623446Smrj {"STACK"},
1633446Smrj {NULL} /* Must be null terminated */
1643446Smrj };
1653446Smrj
1663446Smrj #define CMD_STAT_ALLOCATIONS 0
1673446Smrj #define CMD_STAT_OBJECTS 1
1683446Smrj #define CMD_STAT_MEMORY 2
1693446Smrj #define CMD_STAT_MISC 3
1703446Smrj #define CMD_STAT_TABLES 4
1713446Smrj #define CMD_STAT_SIZES 5
1723446Smrj #define CMD_STAT_STACK 6
1733446Smrj
1743446Smrj
1753446Smrj #if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
1763446Smrj /*******************************************************************************
1773446Smrj *
1783446Smrj * FUNCTION: AcpiDbListInfo
1793446Smrj *
1803446Smrj * PARAMETERS: List - Memory list/cache to be displayed
1813446Smrj *
1823446Smrj * RETURN: None
1833446Smrj *
1843446Smrj * DESCRIPTION: Display information about the input memory list or cache.
1853446Smrj *
1863446Smrj ******************************************************************************/
1873446Smrj
1883446Smrj static void
AcpiDbListInfo(ACPI_MEMORY_LIST * List)1893446Smrj AcpiDbListInfo (
1903446Smrj ACPI_MEMORY_LIST *List)
1913446Smrj {
1923446Smrj #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1933446Smrj UINT32 Outstanding;
1943446Smrj #endif
1953446Smrj
1963446Smrj AcpiOsPrintf ("\n%s\n", List->ListName);
1973446Smrj
1983446Smrj /* MaxDepth > 0 indicates a cache object */
1993446Smrj
2003446Smrj if (List->MaxDepth > 0)
2013446Smrj {
2023446Smrj AcpiOsPrintf (
2037851SDana.Myers@Sun.COM " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n",
2043446Smrj List->CurrentDepth,
2053446Smrj List->MaxDepth,
2063446Smrj List->MaxDepth - List->CurrentDepth,
2073446Smrj (List->CurrentDepth * List->ObjectSize));
2083446Smrj }
2093446Smrj
2103446Smrj #ifdef ACPI_DBG_TRACK_ALLOCATIONS
2113446Smrj if (List->MaxDepth > 0)
2123446Smrj {
2133446Smrj AcpiOsPrintf (
2147851SDana.Myers@Sun.COM " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X\n",
2153446Smrj List->Requests,
2163446Smrj List->Hits,
2173446Smrj List->Requests - List->Hits,
2183446Smrj List->ObjectSize);
2193446Smrj }
2203446Smrj
2217851SDana.Myers@Sun.COM Outstanding = AcpiDbGetCacheInfo (List);
2223446Smrj
2233446Smrj if (List->ObjectSize)
2243446Smrj {
2257851SDana.Myers@Sun.COM AcpiOsPrintf (
2267851SDana.Myers@Sun.COM " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n",
2277851SDana.Myers@Sun.COM List->TotalAllocated,
2287851SDana.Myers@Sun.COM List->TotalFreed,
2297851SDana.Myers@Sun.COM List->MaxOccupied,
2307851SDana.Myers@Sun.COM Outstanding * List->ObjectSize,
2317851SDana.Myers@Sun.COM Outstanding);
2323446Smrj }
2333446Smrj else
2343446Smrj {
2357851SDana.Myers@Sun.COM AcpiOsPrintf (
2367851SDana.Myers@Sun.COM " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
2377851SDana.Myers@Sun.COM List->TotalAllocated,
2387851SDana.Myers@Sun.COM List->TotalFreed,
2397851SDana.Myers@Sun.COM List->MaxOccupied,
2407851SDana.Myers@Sun.COM List->CurrentTotalSize,
2417851SDana.Myers@Sun.COM Outstanding,
2427851SDana.Myers@Sun.COM List->TotalSize);
2433446Smrj }
2443446Smrj #endif
2453446Smrj }
2463446Smrj #endif
2473446Smrj
2483446Smrj
2493446Smrj /*******************************************************************************
2503446Smrj *
2513446Smrj * FUNCTION: AcpiDbEnumerateObject
2523446Smrj *
2533446Smrj * PARAMETERS: ObjDesc - Object to be counted
2543446Smrj *
2553446Smrj * RETURN: None
2563446Smrj *
2573446Smrj * DESCRIPTION: Add this object to the global counts, by object type.
2583446Smrj * Limited recursion handles subobjects and packages, and this
2593446Smrj * is probably acceptable within the AML debugger only.
2603446Smrj *
2613446Smrj ******************************************************************************/
2623446Smrj
2633446Smrj static void
AcpiDbEnumerateObject(ACPI_OPERAND_OBJECT * ObjDesc)2643446Smrj AcpiDbEnumerateObject (
2653446Smrj ACPI_OPERAND_OBJECT *ObjDesc)
2663446Smrj {
2673446Smrj UINT32 i;
2683446Smrj
2693446Smrj
2703446Smrj if (!ObjDesc)
2713446Smrj {
2723446Smrj return;
2733446Smrj }
2743446Smrj
2753446Smrj /* Enumerate this object first */
2763446Smrj
2773446Smrj AcpiGbl_NumObjects++;
2783446Smrj
2799980SDana.Myers@Sun.COM if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
2803446Smrj {
2813446Smrj AcpiGbl_ObjTypeCountMisc++;
2823446Smrj }
2833446Smrj else
2843446Smrj {
2859980SDana.Myers@Sun.COM AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
2863446Smrj }
2873446Smrj
2883446Smrj /* Count the sub-objects */
2893446Smrj
2909980SDana.Myers@Sun.COM switch (ObjDesc->Common.Type)
2913446Smrj {
2923446Smrj case ACPI_TYPE_PACKAGE:
2933446Smrj
2943446Smrj for (i = 0; i < ObjDesc->Package.Count; i++)
2953446Smrj {
2963446Smrj AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
2973446Smrj }
2983446Smrj break;
2993446Smrj
3003446Smrj case ACPI_TYPE_DEVICE:
3013446Smrj
3023446Smrj AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify);
3033446Smrj AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify);
3043446Smrj AcpiDbEnumerateObject (ObjDesc->Device.Handler);
3053446Smrj break;
3063446Smrj
3073446Smrj case ACPI_TYPE_BUFFER_FIELD:
3083446Smrj
3093446Smrj if (AcpiNsGetSecondaryObject (ObjDesc))
3103446Smrj {
3113446Smrj AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
3123446Smrj }
3133446Smrj break;
3143446Smrj
3153446Smrj case ACPI_TYPE_REGION:
3163446Smrj
3173446Smrj AcpiGbl_ObjTypeCount [ACPI_TYPE_LOCAL_REGION_FIELD ]++;
3183446Smrj AcpiDbEnumerateObject (ObjDesc->Region.Handler);
3193446Smrj break;
3203446Smrj
3213446Smrj case ACPI_TYPE_POWER:
3223446Smrj
3233446Smrj AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify);
3243446Smrj AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify);
3253446Smrj break;
3263446Smrj
3273446Smrj case ACPI_TYPE_PROCESSOR:
3283446Smrj
3293446Smrj AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify);
3303446Smrj AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify);
3313446Smrj AcpiDbEnumerateObject (ObjDesc->Processor.Handler);
3323446Smrj break;
3333446Smrj
3343446Smrj case ACPI_TYPE_THERMAL:
3353446Smrj
3363446Smrj AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify);
3373446Smrj AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify);
3383446Smrj AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler);
3393446Smrj break;
3403446Smrj
3413446Smrj default:
3423446Smrj break;
3433446Smrj }
3443446Smrj }
3453446Smrj
3463446Smrj
3473446Smrj /*******************************************************************************
3483446Smrj *
3493446Smrj * FUNCTION: AcpiDbClassifyOneObject
3503446Smrj *
3513446Smrj * PARAMETERS: Callback for WalkNamespace
3523446Smrj *
3533446Smrj * RETURN: Status
3543446Smrj *
3553446Smrj * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
3563446Smrj * the parent namespace node.
3573446Smrj *
3583446Smrj ******************************************************************************/
3593446Smrj
3603446Smrj static ACPI_STATUS
AcpiDbClassifyOneObject(ACPI_HANDLE ObjHandle,UINT32 NestingLevel,void * Context,void ** ReturnValue)3613446Smrj AcpiDbClassifyOneObject (
3623446Smrj ACPI_HANDLE ObjHandle,
3633446Smrj UINT32 NestingLevel,
3643446Smrj void *Context,
3653446Smrj void **ReturnValue)
3663446Smrj {
3673446Smrj ACPI_NAMESPACE_NODE *Node;
3683446Smrj ACPI_OPERAND_OBJECT *ObjDesc;
3693446Smrj UINT32 Type;
3703446Smrj
3713446Smrj
3723446Smrj AcpiGbl_NumNodes++;
3733446Smrj
3743446Smrj Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
3753446Smrj ObjDesc = AcpiNsGetAttachedObject (Node);
3763446Smrj
3773446Smrj AcpiDbEnumerateObject (ObjDesc);
3783446Smrj
3793446Smrj Type = Node->Type;
3803446Smrj if (Type > ACPI_TYPE_NS_NODE_MAX)
3813446Smrj {
3823446Smrj AcpiGbl_NodeTypeCountMisc++;
3833446Smrj }
3843446Smrj else
3853446Smrj {
3863446Smrj AcpiGbl_NodeTypeCount [Type]++;
3873446Smrj }
3883446Smrj
3893446Smrj return AE_OK;
3903446Smrj
3913446Smrj
3923446Smrj #ifdef ACPI_FUTURE_IMPLEMENTATION
3933446Smrj
3943446Smrj /* TBD: These need to be counted during the initial parsing phase */
3953446Smrj
3963446Smrj if (AcpiPsIsNamedOp (Op->Opcode))
3973446Smrj {
3983446Smrj NumNodes++;
3993446Smrj }
4003446Smrj
4013446Smrj if (IsMethod)
4023446Smrj {
4033446Smrj NumMethodElements++;
4043446Smrj }
4053446Smrj
4063446Smrj NumGrammarElements++;
4073446Smrj Op = AcpiPsGetDepthNext (Root, Op);
4083446Smrj
4093446Smrj SizeOfParseTree = (NumGrammarElements - NumMethodElements) *
4103446Smrj (UINT32) sizeof (ACPI_PARSE_OBJECT);
4113446Smrj SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
4123446Smrj SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
4133446Smrj SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
4143446Smrj #endif
4153446Smrj }
4163446Smrj
4173446Smrj
4183446Smrj /*******************************************************************************
4193446Smrj *
4203446Smrj * FUNCTION: AcpiDbCountNamespaceObjects
4213446Smrj *
4223446Smrj * PARAMETERS: None
4233446Smrj *
4243446Smrj * RETURN: None
4253446Smrj *
4263446Smrj * DESCRIPTION: Count and classify the entire namespace, including all
4273446Smrj * namespace nodes and attached objects.
4283446Smrj *
4293446Smrj ******************************************************************************/
4303446Smrj
4313446Smrj static void
AcpiDbCountNamespaceObjects(void)4323446Smrj AcpiDbCountNamespaceObjects (
4333446Smrj void)
4343446Smrj {
4353446Smrj UINT32 i;
4363446Smrj
4373446Smrj
4383446Smrj AcpiGbl_NumNodes = 0;
4393446Smrj AcpiGbl_NumObjects = 0;
4403446Smrj
4413446Smrj AcpiGbl_ObjTypeCountMisc = 0;
4423446Smrj for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
4433446Smrj {
4443446Smrj AcpiGbl_ObjTypeCount [i] = 0;
4453446Smrj AcpiGbl_NodeTypeCount [i] = 0;
4463446Smrj }
4473446Smrj
4483446Smrj (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
449*11225SDana.Myers@Sun.COM ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL);
4503446Smrj }
4513446Smrj
4523446Smrj
4533446Smrj /*******************************************************************************
4543446Smrj *
4553446Smrj * FUNCTION: AcpiDbDisplayStatistics
4563446Smrj *
4573446Smrj * PARAMETERS: TypeArg - Subcommand
4583446Smrj *
4593446Smrj * RETURN: Status
4603446Smrj *
4613446Smrj * DESCRIPTION: Display various statistics
4623446Smrj *
4633446Smrj ******************************************************************************/
4643446Smrj
4653446Smrj ACPI_STATUS
AcpiDbDisplayStatistics(char * TypeArg)4663446Smrj AcpiDbDisplayStatistics (
4673446Smrj char *TypeArg)
4683446Smrj {
4693446Smrj UINT32 i;
4703446Smrj UINT32 Temp;
4713446Smrj
4723446Smrj
4733446Smrj if (!TypeArg)
4743446Smrj {
4753446Smrj AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
4763446Smrj return (AE_OK);
4773446Smrj }
4783446Smrj
4793446Smrj AcpiUtStrupr (TypeArg);
4803446Smrj Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
4813446Smrj if (Temp == (UINT32) -1)
4823446Smrj {
4833446Smrj AcpiOsPrintf ("Invalid or unsupported argument\n");
4843446Smrj return (AE_OK);
4853446Smrj }
4863446Smrj
4873446Smrj
4883446Smrj switch (Temp)
4893446Smrj {
4903446Smrj case CMD_STAT_ALLOCATIONS:
4913446Smrj
4923446Smrj #ifdef ACPI_DBG_TRACK_ALLOCATIONS
4933446Smrj AcpiUtDumpAllocationInfo ();
4943446Smrj #endif
4953446Smrj break;
4963446Smrj
4973446Smrj case CMD_STAT_TABLES:
4983446Smrj
4997851SDana.Myers@Sun.COM AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
5003446Smrj break;
5013446Smrj
5023446Smrj case CMD_STAT_OBJECTS:
5033446Smrj
5043446Smrj AcpiDbCountNamespaceObjects ();
5053446Smrj
5063446Smrj AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
5073446Smrj
5083446Smrj AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
5093446Smrj "ACPI_TYPE", "NODES", "OBJECTS");
5103446Smrj
5113446Smrj for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
5123446Smrj {
5133446Smrj AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
5143446Smrj AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
5153446Smrj }
5163446Smrj AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
5173446Smrj AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
5183446Smrj
5193446Smrj AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
5203446Smrj AcpiGbl_NumNodes, AcpiGbl_NumObjects);
5213446Smrj break;
5223446Smrj
5233446Smrj case CMD_STAT_MEMORY:
5243446Smrj
5253446Smrj #ifdef ACPI_DBG_TRACK_ALLOCATIONS
5267851SDana.Myers@Sun.COM AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n");
5273446Smrj
5283446Smrj AcpiDbListInfo (AcpiGbl_GlobalList);
5293446Smrj AcpiDbListInfo (AcpiGbl_NsNodeList);
5307851SDana.Myers@Sun.COM #endif
5313446Smrj
5323446Smrj #ifdef ACPI_USE_LOCAL_CACHE
5337851SDana.Myers@Sun.COM AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
5343446Smrj AcpiDbListInfo (AcpiGbl_OperandCache);
5353446Smrj AcpiDbListInfo (AcpiGbl_PsNodeCache);
5363446Smrj AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
5373446Smrj AcpiDbListInfo (AcpiGbl_StateCache);
5383446Smrj #endif
5393446Smrj
5403446Smrj break;
5413446Smrj
5423446Smrj case CMD_STAT_MISC:
5433446Smrj
5443446Smrj AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
5453446Smrj AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n",
5463446Smrj AcpiGbl_PsFindCount);
5473446Smrj AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
5483446Smrj AcpiGbl_NsLookupCount);
5493446Smrj
5503446Smrj AcpiOsPrintf ("\n");
5513446Smrj
5523446Smrj AcpiOsPrintf ("Mutex usage:\n\n");
5533446Smrj for (i = 0; i < ACPI_NUM_MUTEX; i++)
5543446Smrj {
5553446Smrj AcpiOsPrintf ("%-28s: % 7ld\n",
5563446Smrj AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
5573446Smrj }
5583446Smrj break;
5593446Smrj
5603446Smrj
5613446Smrj case CMD_STAT_SIZES:
5623446Smrj
5633446Smrj AcpiOsPrintf ("\nInternal object sizes:\n\n");
5643446Smrj
5653446Smrj AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
5663446Smrj AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
5673446Smrj AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
5683446Smrj AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
5693446Smrj AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
5703446Smrj AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
5713446Smrj AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE));
5723446Smrj AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT));
5733446Smrj AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD));
5743446Smrj AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX));
5753446Smrj AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION));
5763446Smrj AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
5773446Smrj AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
5783446Smrj AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
5793446Smrj AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
5803446Smrj AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
5813446Smrj AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
5823446Smrj AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
5833446Smrj AcpiOsPrintf ("Notify %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
5843446Smrj AcpiOsPrintf ("AddressSpace %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
5853446Smrj AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
5863446Smrj AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
5873446Smrj
5883446Smrj AcpiOsPrintf ("\n");
5893446Smrj
5903446Smrj AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
5913446Smrj AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
5923446Smrj AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
5933446Smrj AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT));
5943446Smrj AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
5957851SDana.Myers@Sun.COM AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT));
5963446Smrj
5973446Smrj break;
5983446Smrj
5993446Smrj
6003446Smrj case CMD_STAT_STACK:
6013446Smrj #if defined(ACPI_DEBUG_OUTPUT)
6023446Smrj
6037851SDana.Myers@Sun.COM Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);
6043446Smrj
6053446Smrj AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
6067851SDana.Myers@Sun.COM AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer);
6077851SDana.Myers@Sun.COM AcpiOsPrintf ("Lowest Stack Pointer %p\n", AcpiGbl_LowestStackPointer);
6087851SDana.Myers@Sun.COM AcpiOsPrintf ("Stack Use %X (%u)\n", Temp, Temp);
6097851SDana.Myers@Sun.COM AcpiOsPrintf ("Deepest Procedure Nesting %u\n", AcpiGbl_DeepestNesting);
6103446Smrj #endif
6113446Smrj break;
6123446Smrj
6133446Smrj default:
6143446Smrj break;
6153446Smrj }
6163446Smrj
6173446Smrj AcpiOsPrintf ("\n");
6183446Smrj return (AE_OK);
6193446Smrj }
6203446Smrj
6213446Smrj #endif /* ACPI_DEBUGGER */
622