aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/dbexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/dbexec.c')
-rw-r--r--sys/contrib/dev/acpica/dbexec.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c
index b0f9dc5f6f1e..9a14b8636b22 100644
--- a/sys/contrib/dev/acpica/dbexec.c
+++ b/sys/contrib/dev/acpica/dbexec.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 27 $
+ * $Revision: 29 $
*
******************************************************************************/
@@ -259,6 +259,40 @@ AcpiDbExecuteSetup (
/*******************************************************************************
*
+ * FUNCTION: AcpiDbGetOutstandingAllocations
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Current global allocation count minus cache entries
+ *
+ * DESCRIPTION: Determine the current number of "outstanding" allocations --
+ * those allocations that have not been freed and also are not
+ * in one of the various object caches.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDbGetOutstandingAllocations (void)
+{
+ UINT32 i;
+ UINT32 Outstanding = 0;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+ for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++)
+ {
+ Outstanding += (AcpiGbl_MemoryLists[i].TotalAllocated -
+ AcpiGbl_MemoryLists[i].TotalFreed -
+ AcpiGbl_MemoryLists[i].CacheDepth);
+ }
+#endif
+
+ return (Outstanding);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbExecute
*
* PARAMETERS: Name - Name of method to execute
@@ -284,15 +318,12 @@ AcpiDbExecute (
#ifdef ACPI_DEBUG
UINT32 PreviousAllocations;
- UINT32 PreviousSize;
UINT32 Allocations;
- UINT32 Size;
/* Memory allocation tracking */
- PreviousAllocations = AcpiGbl_CurrentAllocCount;
- PreviousSize = AcpiGbl_CurrentAllocSize;
+ PreviousAllocations = AcpiDbGetOutstandingAllocations ();
#endif
Info.Name = Name;
@@ -302,20 +333,25 @@ AcpiDbExecute (
AcpiDbExecuteSetup (&Info);
Status = AcpiDbExecuteMethod (&Info, &ReturnObj);
+ /*
+ * Allow any handlers in separate threads to complete.
+ * (Such as Notify handlers invoked from AML executed above).
+ */
+ AcpiOsSleep (0, 10);
+
#ifdef ACPI_DEBUG
/* Memory allocation tracking */
- Allocations = AcpiGbl_CurrentAllocCount - PreviousAllocations;
- Size = AcpiGbl_CurrentAllocSize - PreviousSize;
+ Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations;
AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT);
if (Allocations > 0)
{
- AcpiOsPrintf ("Outstanding: %ld allocations of total size %ld after execution\n",
- Allocations, Size);
+ AcpiOsPrintf ("Outstanding: %ld allocations after execution\n",
+ Allocations);
}
#endif