summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/dbstats.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/dbstats.c')
-rw-r--r--sys/contrib/dev/acpica/dbstats.c205
1 files changed, 134 insertions, 71 deletions
diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c
index e1c010f..a4c47e4 100644
--- a/sys/contrib/dev/acpica/dbstats.c
+++ b/sys/contrib/dev/acpica/dbstats.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 70 $
+ * $Revision: 1.79 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,28 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbstats")
+/* Local prototypes */
+
+static void
+AcpiDbCountNamespaceObjects (
+ void);
+
+static void
+AcpiDbEnumerateObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+static ACPI_STATUS
+AcpiDbClassifyOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static void
+AcpiDbListInfo (
+ ACPI_MEMORY_LIST *List);
+
+
/*
* Statistics subcommands
*/
@@ -150,6 +172,74 @@ static ARGUMENT_INFO AcpiDbStatTypes [] =
/*******************************************************************************
*
+ * FUNCTION: AcpiDbListInfo
+ *
+ * PARAMETERS: List - Memory list/cache to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about the input memory list or cache.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDbListInfo (
+ ACPI_MEMORY_LIST *List)
+{
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Outstanding;
+ UINT32 Temp;
+#endif
+
+ AcpiOsPrintf ("\n%s\n", List->ListName);
+
+ /* MaxDepth > 0 indicates a cache object */
+
+ if (List->MaxDepth > 0)
+ {
+ AcpiOsPrintf (
+ " Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
+ List->CurrentDepth,
+ List->MaxDepth,
+ List->MaxDepth - List->CurrentDepth,
+ (List->CurrentDepth * List->ObjectSize));
+ }
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ if (List->MaxDepth > 0)
+ {
+ AcpiOsPrintf (
+ " Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
+ List->Requests,
+ List->Hits,
+ List->Requests - List->Hits,
+ List->ObjectSize);
+ }
+
+ Outstanding = List->TotalAllocated -
+ List->TotalFreed -
+ List->CurrentDepth;
+
+ if (List->ObjectSize)
+ {
+ Temp = ACPI_ROUND_UP_TO_1K (Outstanding * List->ObjectSize);
+ }
+ else
+ {
+ Temp = ACPI_ROUND_UP_TO_1K (List->CurrentTotalSize);
+ }
+
+ AcpiOsPrintf (
+ " Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
+ List->TotalAllocated,
+ List->TotalFreed,
+ Outstanding, Temp);
+#endif
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbEnumerateObject
*
* PARAMETERS: ObjDesc - Object to be counted
@@ -162,7 +252,7 @@ static ARGUMENT_INFO AcpiDbStatTypes [] =
*
******************************************************************************/
-void
+static void
AcpiDbEnumerateObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
@@ -174,7 +264,6 @@ AcpiDbEnumerateObject (
return;
}
-
/* Enumerate this object first */
AcpiGbl_NumObjects++;
@@ -260,7 +349,7 @@ AcpiDbEnumerateObject (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbClassifyOneObject (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -284,7 +373,6 @@ AcpiDbClassifyOneObject (
{
AcpiGbl_NodeTypeCountMisc++;
}
-
else
{
AcpiGbl_NodeTypeCount [Type]++;
@@ -293,8 +381,10 @@ AcpiDbClassifyOneObject (
return AE_OK;
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+
/* TBD: These need to be counted during the initial parsing phase */
- /*
+
if (AcpiPsIsNamedOp (Op->Opcode))
{
NumNodes++;
@@ -308,12 +398,12 @@ AcpiDbClassifyOneObject (
NumGrammarElements++;
Op = AcpiPsGetDepthNext (Root, Op);
- SizeOfParseTree = (NumGrammarElements - NumMethodElements) * (UINT32) sizeof (ACPI_PARSE_OBJECT);
- SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
- SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
- SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
-
- */
+ SizeOfParseTree = (NumGrammarElements - NumMethodElements) *
+ (UINT32) sizeof (ACPI_PARSE_OBJECT);
+ SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
+ SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
+ SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
+#endif
}
@@ -323,14 +413,14 @@ AcpiDbClassifyOneObject (
*
* PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Count and classify the entire namespace, including all
* namespace nodes and attached objects.
*
******************************************************************************/
-void
+static void
AcpiDbCountNamespaceObjects (
void)
{
@@ -347,8 +437,8 @@ AcpiDbCountNamespaceObjects (
AcpiGbl_NodeTypeCount [i] = 0;
}
- (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- FALSE, AcpiDbClassifyOneObject, NULL, NULL);
+ (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL);
}
@@ -369,11 +459,7 @@ AcpiDbDisplayStatistics (
char *TypeArg)
{
UINT32 i;
- UINT32 Type;
- UINT32 Size;
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- UINT32 Outstanding;
-#endif
+ UINT32 Temp;
if (!AcpiGbl_DSDT)
@@ -387,18 +473,19 @@ AcpiDbDisplayStatistics (
return (AE_OK);
}
- ACPI_STRUPR (TypeArg);
- Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
- if (Type == (UINT32) -1)
+ AcpiUtStrupr (TypeArg);
+ Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
+ if (Temp == (UINT32) -1)
{
AcpiOsPrintf ("Invalid or unsupported argument\n");
return (AE_OK);
}
- switch (Type)
+ switch (Temp)
{
case CMD_STAT_ALLOCATIONS:
+
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiUtDumpAllocationInfo ();
#endif
@@ -409,7 +496,8 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("ACPI Table Information:\n\n");
if (AcpiGbl_DSDT)
{
- AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
+ AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n",
+ AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
}
break;
@@ -419,7 +507,8 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
- AcpiOsPrintf ("%16.16s %10.10s %10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
+ AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
+ "ACPI_TYPE", "NODES", "OBJECTS");
for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
{
@@ -438,43 +527,15 @@ AcpiDbDisplayStatistics (
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
- for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
- {
- AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
-
- if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
- {
- AcpiOsPrintf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
- AcpiGbl_MemoryLists[i].CacheDepth,
- AcpiGbl_MemoryLists[i].MaxCacheDepth,
- AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
- (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
-
- AcpiOsPrintf (" Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
- AcpiGbl_MemoryLists[i].CacheRequests,
- AcpiGbl_MemoryLists[i].CacheHits,
- AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
- AcpiGbl_MemoryLists[i].ObjectSize);
- }
-
- Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
- AcpiGbl_MemoryLists[i].TotalFreed -
- AcpiGbl_MemoryLists[i].CacheDepth;
-
- if (AcpiGbl_MemoryLists[i].ObjectSize)
- {
- Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
- }
- else
- {
- Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
- }
-
- AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
- AcpiGbl_MemoryLists[i].TotalAllocated,
- AcpiGbl_MemoryLists[i].TotalFreed,
- Outstanding, Size);
- }
+ AcpiDbListInfo (AcpiGbl_GlobalList);
+ AcpiDbListInfo (AcpiGbl_NsNodeList);
+
+#ifdef ACPI_USE_LOCAL_CACHE
+ AcpiDbListInfo (AcpiGbl_OperandCache);
+ AcpiDbListInfo (AcpiGbl_PsNodeCache);
+ AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
+ AcpiDbListInfo (AcpiGbl_StateCache);
+#endif
#endif
break;
@@ -482,15 +543,18 @@ AcpiDbDisplayStatistics (
case CMD_STAT_MISC:
AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
- AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", AcpiGbl_PsFindCount);
- AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", AcpiGbl_NsLookupCount);
+ AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n",
+ AcpiGbl_PsFindCount);
+ AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
+ AcpiGbl_NsLookupCount);
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Mutex usage:\n\n");
for (i = 0; i < NUM_MUTEX; i++)
{
- AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
+ AcpiOsPrintf ("%-28s: % 7ld\n",
+ AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
}
break;
@@ -536,12 +600,12 @@ AcpiDbDisplayStatistics (
case CMD_STAT_STACK:
#if defined(ACPI_DEBUG_OUTPUT)
- Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
+ Temp = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
- AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size);
+ AcpiOsPrintf ("Stack Use %X (%d)\n", Temp, Temp);
AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
#endif
break;
@@ -554,5 +618,4 @@ AcpiDbDisplayStatistics (
return (AE_OK);
}
-
#endif /* ACPI_DEBUGGER */
OpenPOWER on IntegriCloud