dbstats.c revision 199767f8919635c4928607450d9e0abb932109ce
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbstats")
/* Local prototypes */
static void
void);
static void
static ACPI_STATUS
void *Context,
void **ReturnValue);
#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
static void
#endif
/*
* Statistics subcommands
*/
static ACPI_DB_ARGUMENT_INFO AcpiDbStatTypes [] =
{
{"ALLOCATIONS"},
{"OBJECTS"},
{"MEMORY"},
{"MISC"},
{"TABLES"},
{"SIZES"},
{"STACK"},
{NULL} /* Must be null terminated */
};
#define CMD_STAT_ALLOCATIONS 0
#define CMD_STAT_OBJECTS 1
#define CMD_STAT_MEMORY 2
#define CMD_STAT_MISC 3
#define CMD_STAT_TABLES 4
#define CMD_STAT_SIZES 5
#define CMD_STAT_STACK 6
#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
/*******************************************************************************
*
* FUNCTION: AcpiDbListInfo
*
*
* RETURN: None
*
* DESCRIPTION: Display information about the input memory list or cache.
*
******************************************************************************/
static void
{
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
#endif
/* MaxDepth > 0 indicates a cache object */
{
" Cache: [Depth MaxD Avail Size] "
"%8.2X %8.2X %8.2X %8.2X\n",
}
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
{
" Cache: [Requests Hits Misses ObjSize] "
"%8.2X %8.2X %8.2X %8.2X\n",
List->ObjectSize);
}
if (List->ObjectSize)
{
" Mem: [Alloc Free Max CurSize Outstanding] "
"%8.2X %8.2X %8.2X %8.2X %8.2X\n",
}
else
{
" Mem: [Alloc Free Max CurSize Outstanding Total] "
"%8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
}
#endif
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiDbEnumerateObject
*
* PARAMETERS: ObjDesc - Object to be counted
*
* RETURN: None
*
* DESCRIPTION: Add this object to the global counts, by object type.
* Limited recursion handles subobjects and packages, and this
* is probably acceptable within the AML debugger only.
*
******************************************************************************/
static void
{
UINT32 i;
if (!ObjDesc)
{
return;
}
/* Enumerate this object first */
{
}
else
{
}
/* Count the sub-objects */
{
case ACPI_TYPE_PACKAGE:
{
}
break;
case ACPI_TYPE_DEVICE:
break;
case ACPI_TYPE_BUFFER_FIELD:
if (AcpiNsGetSecondaryObject (ObjDesc))
{
}
break;
case ACPI_TYPE_REGION:
break;
case ACPI_TYPE_POWER:
break;
case ACPI_TYPE_PROCESSOR:
break;
case ACPI_TYPE_THERMAL:
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbClassifyOneObject
*
* PARAMETERS: Callback for WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
* the parent namespace node.
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
if (Type > ACPI_TYPE_NS_NODE_MAX)
{
}
else
{
}
return (AE_OK);
#ifdef ACPI_FUTURE_IMPLEMENTATION
/* TBD: These need to be counted during the initial parsing phase */
{
NumNodes++;
}
if (IsMethod)
{
}
(UINT32) sizeof (ACPI_PARSE_OBJECT);
#endif
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCountNamespaceObjects
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Count and classify the entire namespace, including all
* namespace nodes and attached objects.
*
******************************************************************************/
static void
void)
{
UINT32 i;
AcpiGbl_NumNodes = 0;
AcpiGbl_NumObjects = 0;
for (i = 0; i < (ACPI_TYPE_NS_NODE_MAX -1); i++)
{
AcpiGbl_ObjTypeCount [i] = 0;
AcpiGbl_NodeTypeCount [i] = 0;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayStatistics
*
* PARAMETERS: TypeArg - Subcommand
*
* RETURN: Status
*
* DESCRIPTION: Display various statistics
*
******************************************************************************/
char *TypeArg)
{
UINT32 i;
if (Temp == ACPI_TYPE_NOT_FOUND)
{
AcpiOsPrintf ("Invalid or unsupported argument\n");
return (AE_OK);
}
switch (Temp)
{
case CMD_STAT_ALLOCATIONS:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
#endif
break;
case CMD_STAT_TABLES:
AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
break;
case CMD_STAT_OBJECTS:
AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
"ACPI_TYPE", "NODES", "OBJECTS");
for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
{
AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
}
break;
case CMD_STAT_MEMORY:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n");
#endif
#ifdef ACPI_USE_LOCAL_CACHE
AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
#endif
break;
case CMD_STAT_MISC:
AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n",
AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Mutex usage:\n\n");
for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiOsPrintf ("%-28s: % 7ld\n",
}
break;
case CMD_STAT_SIZES:
AcpiOsPrintf ("\nInternal object sizes:\n\n");
AcpiOsPrintf ("\n");
AcpiOsPrintf ("\n");
break;
case CMD_STAT_STACK:
#if defined(ACPI_DEBUG_OUTPUT)
AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
#endif
break;
default:
break;
}
AcpiOsPrintf ("\n");
return (AE_OK);
}