ACPI_STATUS AcpiDbDisplayStatistics ( NATIVE_CHAR *TypeArg) { UINT32 i; UINT32 Type; UINT32 Size; if (!AcpiGbl_DSDT) { AcpiOsPrintf ("*** Warning: There is no DSDT loaded\n"); } if (!TypeArg) { AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n"); return (AE_OK); } STRUPR (TypeArg); Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes); if (Type == (UINT32) -1) { AcpiOsPrintf ("Invalid or unsupported argument\n"); return (AE_OK); } switch (Type) { #ifndef PARSER_ONLY case CMD_ALLOCATIONS: #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpAllocationInfo (); #endif break; #endif case CMD_TABLES: AcpiOsPrintf ("ACPI Table Information:\n\n"); if (AcpiGbl_DSDT) { AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length); } break; case CMD_OBJECTS: #ifndef PARSER_ONLY AcpiDbCountNamespaceObjects (); 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 < INTERNAL_TYPE_NODE_MAX; i++) { AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i), AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]); } AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown", AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc); AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:", AcpiGbl_NumNodes, AcpiGbl_NumObjects); #endif break; case CMD_MEMORY: #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 = ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize); } else { Size = 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); } #endif break; case CMD_MISC: AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n"); 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_MTX; i++) { AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount); } break; case CMD_SIZES: AcpiOsPrintf ("\nInternal object sizes:\n\n"); AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON)); AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER)); AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING)); AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER)); AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE)); AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD)); AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE)); AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT)); AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD)); AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX)); AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION)); AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE)); AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR)); AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE)); AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD)); AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD)); AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD)); AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE)); AcpiOsPrintf ("NotifyHandler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER)); AcpiOsPrintf ("AddrHandler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER)); AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA)); AcpiOsPrintf ("\n"); AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJECT)); AcpiOsPrintf ("Parse2Object %3d\n", sizeof (ACPI_PARSE2_OBJECT)); AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT)); AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE)); break; case CMD_STACK: Size = 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 ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting); break; } AcpiOsPrintf ("\n"); return (AE_OK); }
acpi_status acpi_db_display_statistics ( NATIVE_CHAR *type_arg) { u32 i; u32 type; u32 outstanding; u32 size; if (!acpi_gbl_DSDT) { acpi_os_printf ("*** Warning: There is no DSDT loaded\n"); } if (!type_arg) { acpi_os_printf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n"); return (AE_OK); } STRUPR (type_arg); type = acpi_db_match_argument (type_arg, acpi_db_stat_types); if (type == (u32) -1) { acpi_os_printf ("Invalid or unsupported argument\n"); return (AE_OK); } switch (type) { #ifndef PARSER_ONLY case CMD_ALLOCATIONS: #ifdef ACPI_DBG_TRACK_ALLOCATIONS acpi_ut_dump_allocation_info (); #endif break; #endif case CMD_TABLES: acpi_os_printf ("ACPI Table Information:\n\n"); if (acpi_gbl_DSDT) { acpi_os_printf ("DSDT Length:................% 7ld (%X)\n", acpi_gbl_DSDT->length, acpi_gbl_DSDT->length); } break; case CMD_OBJECTS: #ifndef PARSER_ONLY acpi_db_count_namespace_objects (); acpi_os_printf ("\n_objects defined in the current namespace:\n\n"); acpi_os_printf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS"); for (i = 0; i < INTERNAL_TYPE_NODE_MAX; i++) { acpi_os_printf ("%16.16s % 10ld% 10ld\n", acpi_ut_get_type_name (i), acpi_gbl_node_type_count [i], acpi_gbl_obj_type_count [i]); } acpi_os_printf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown", acpi_gbl_node_type_count_misc, acpi_gbl_obj_type_count_misc); acpi_os_printf ("%16.16s % 10ld% 10ld\n", "TOTALS:", acpi_gbl_num_nodes, acpi_gbl_num_objects); #endif break; case CMD_MEMORY: #ifdef ACPI_DBG_TRACK_ALLOCATIONS acpi_os_printf ("\n----Object and Cache Statistics---------------------------------------------\n"); for (i = 0; i < ACPI_NUM_MEM_LISTS; i++) { acpi_os_printf ("\n%s\n", acpi_gbl_memory_lists[i].list_name); if (acpi_gbl_memory_lists[i].max_cache_depth > 0) { acpi_os_printf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n", acpi_gbl_memory_lists[i].cache_depth, acpi_gbl_memory_lists[i].max_cache_depth, acpi_gbl_memory_lists[i].max_cache_depth - acpi_gbl_memory_lists[i].cache_depth, (acpi_gbl_memory_lists[i].cache_depth * acpi_gbl_memory_lists[i].object_size)); acpi_os_printf (" Cache: [Requests Hits Misses Obj_size] % 7d % 7d % 7d % 7d B\n", acpi_gbl_memory_lists[i].cache_requests, acpi_gbl_memory_lists[i].cache_hits, acpi_gbl_memory_lists[i].cache_requests - acpi_gbl_memory_lists[i].cache_hits, acpi_gbl_memory_lists[i].object_size); } outstanding = acpi_gbl_memory_lists[i].total_allocated - acpi_gbl_memory_lists[i].total_freed - acpi_gbl_memory_lists[i].cache_depth; if (acpi_gbl_memory_lists[i].object_size) { size = ROUND_UP_TO_1K (outstanding * acpi_gbl_memory_lists[i].object_size); } else { size = ROUND_UP_TO_1K (acpi_gbl_memory_lists[i].current_total_size); } acpi_os_printf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n", acpi_gbl_memory_lists[i].total_allocated, acpi_gbl_memory_lists[i].total_freed, outstanding, size); } #endif break; case CMD_MISC: acpi_os_printf ("\n_miscellaneous Statistics:\n\n"); acpi_os_printf ("Calls to Acpi_ps_find:.. ........% 7ld\n", acpi_gbl_ps_find_count); acpi_os_printf ("Calls to Acpi_ns_lookup:..........% 7ld\n", acpi_gbl_ns_lookup_count); acpi_os_printf ("\n"); acpi_os_printf ("Mutex usage:\n\n"); for (i = 0; i < NUM_MTX; i++) { acpi_os_printf ("%-28s: % 7ld\n", acpi_ut_get_mutex_name (i), acpi_gbl_acpi_mutex_info[i].use_count); } break; case CMD_SIZES: acpi_os_printf ("\n_internal object sizes:\n\n"); acpi_os_printf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON)); acpi_os_printf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER)); acpi_os_printf ("String %3d\n", sizeof (ACPI_OBJECT_STRING)); acpi_os_printf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER)); acpi_os_printf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE)); acpi_os_printf ("Buffer_field %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD)); acpi_os_printf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE)); acpi_os_printf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT)); acpi_os_printf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD)); acpi_os_printf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX)); acpi_os_printf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION)); acpi_os_printf ("Power_resource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE)); acpi_os_printf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR)); acpi_os_printf ("Thermal_zone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE)); acpi_os_printf ("Region_field %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD)); acpi_os_printf ("Bank_field %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD)); acpi_os_printf ("Index_field %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD)); acpi_os_printf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE)); acpi_os_printf ("Notify_handler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER)); acpi_os_printf ("Addr_handler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER)); acpi_os_printf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA)); acpi_os_printf ("\n"); acpi_os_printf ("Parse_object %3d\n", sizeof (acpi_parse_object)); acpi_os_printf ("Parse2_object %3d\n", sizeof (acpi_parse2_object)); acpi_os_printf ("Operand_object %3d\n", sizeof (acpi_operand_object)); acpi_os_printf ("Namespace_node %3d\n", sizeof (acpi_namespace_node)); break; case CMD_STACK: size = acpi_gbl_entry_stack_pointer - acpi_gbl_lowest_stack_pointer; acpi_os_printf ("\n_subsystem Stack Usage:\n\n"); acpi_os_printf ("Entry Stack Pointer %X\n", acpi_gbl_entry_stack_pointer); acpi_os_printf ("Lowest Stack Pointer %X\n", acpi_gbl_lowest_stack_pointer); acpi_os_printf ("Stack Use %X (%d)\n", size, size); acpi_os_printf ("Deepest Procedure Nesting %d\n", acpi_gbl_deepest_nesting); break; } acpi_os_printf ("\n"); return (AE_OK); }