Deleted Added
full compact
dbstats.c (91116) dbstats.c (99679)
1/*******************************************************************************
2 *
3 * Module Name: dbstats - Generation and display of ACPI table statistics
1/*******************************************************************************
2 *
3 * Module Name: dbstats - Generation and display of ACPI table statistics
4 * $Revision: 55 $
4 * $Revision: 60 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

--- 99 unchanged lines hidden (view full) ---

112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#include <acpi.h>
119#include <acdebug.h>
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.

--- 99 unchanged lines hidden (view full) ---

112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#include <acpi.h>
119#include <acdebug.h>
120#include <amlcode.h>
121#include <acparser.h>
122#include <acnamesp.h>
123
124#ifdef ENABLE_DEBUGGER
125
126#define _COMPONENT ACPI_DEBUGGER
127 ACPI_MODULE_NAME ("dbstats")
128
129/*
130 * Statistics subcommands
131 */
120#include <acnamesp.h>
121
122#ifdef ENABLE_DEBUGGER
123
124#define _COMPONENT ACPI_DEBUGGER
125 ACPI_MODULE_NAME ("dbstats")
126
127/*
128 * Statistics subcommands
129 */
132ARGUMENT_INFO AcpiDbStatTypes [] =
130static ARGUMENT_INFO AcpiDbStatTypes [] =
133{
134 {"ALLOCATIONS"},
135 {"OBJECTS"},
136 {"MEMORY"},
137 {"MISC"},
138 {"TABLES"},
139 {"SIZES"},
140 {"STACK"},
141 {NULL} /* Must be null terminated */
142};
143
131{
132 {"ALLOCATIONS"},
133 {"OBJECTS"},
134 {"MEMORY"},
135 {"MISC"},
136 {"TABLES"},
137 {"SIZES"},
138 {"STACK"},
139 {NULL} /* Must be null terminated */
140};
141
144#define CMD_ALLOCATIONS 0
145#define CMD_OBJECTS 1
146#define CMD_MEMORY 2
147#define CMD_MISC 3
148#define CMD_TABLES 4
149#define CMD_SIZES 5
150#define CMD_STACK 6
142#define CMD_STAT_ALLOCATIONS 0
143#define CMD_STAT_OBJECTS 1
144#define CMD_STAT_MEMORY 2
145#define CMD_STAT_MISC 3
146#define CMD_STAT_TABLES 4
147#define CMD_STAT_SIZES 5
148#define CMD_STAT_STACK 6
151
152
153/*******************************************************************************
154 *
155 * FUNCTION: AcpiDbEnumerateObject
156 *
157 * PARAMETERS: ObjDesc - Object to be counted
158 *

--- 17 unchanged lines hidden (view full) ---

176 return;
177 }
178
179
180 /* Enumerate this object first */
181
182 AcpiGbl_NumObjects++;
183
149
150
151/*******************************************************************************
152 *
153 * FUNCTION: AcpiDbEnumerateObject
154 *
155 * PARAMETERS: ObjDesc - Object to be counted
156 *

--- 17 unchanged lines hidden (view full) ---

174 return;
175 }
176
177
178 /* Enumerate this object first */
179
180 AcpiGbl_NumObjects++;
181
184 if (ObjDesc->Common.Type > INTERNAL_TYPE_NODE_MAX)
182 if (ACPI_GET_OBJECT_TYPE (ObjDesc) > INTERNAL_TYPE_NODE_MAX)
185 {
186 AcpiGbl_ObjTypeCountMisc++;
187 }
188 else
189 {
183 {
184 AcpiGbl_ObjTypeCountMisc++;
185 }
186 else
187 {
190 AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
188 AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++;
191 }
192
193 /* Count the sub-objects */
194
189 }
190
191 /* Count the sub-objects */
192
195 switch (ObjDesc->Common.Type)
193 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
196 {
197 case ACPI_TYPE_PACKAGE:
198 for (i = 0; i < ObjDesc->Package.Count; i++)
199 {
200 AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
201 }
202 break;
203

--- 26 unchanged lines hidden (view full) ---

230 AcpiDbEnumerateObject (ObjDesc->Processor.AddrHandler);
231 break;
232
233 case ACPI_TYPE_THERMAL:
234 AcpiDbEnumerateObject (ObjDesc->ThermalZone.SysHandler);
235 AcpiDbEnumerateObject (ObjDesc->ThermalZone.DrvHandler);
236 AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddrHandler);
237 break;
194 {
195 case ACPI_TYPE_PACKAGE:
196 for (i = 0; i < ObjDesc->Package.Count; i++)
197 {
198 AcpiDbEnumerateObject (ObjDesc->Package.Elements[i]);
199 }
200 break;
201

--- 26 unchanged lines hidden (view full) ---

228 AcpiDbEnumerateObject (ObjDesc->Processor.AddrHandler);
229 break;
230
231 case ACPI_TYPE_THERMAL:
232 AcpiDbEnumerateObject (ObjDesc->ThermalZone.SysHandler);
233 AcpiDbEnumerateObject (ObjDesc->ThermalZone.DrvHandler);
234 AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddrHandler);
235 break;
236
237 default:
238 break;
238 }
239}
240
241
242#ifndef PARSER_ONLY
243
244/*******************************************************************************
245 *

--- 73 unchanged lines hidden (view full) ---

319 *
320 * RETURN: Status
321 *
322 * DESCRIPTION: Count and classify the entire namespace, including all
323 * namespace nodes and attached objects.
324 *
325 ******************************************************************************/
326
239 }
240}
241
242
243#ifndef PARSER_ONLY
244
245/*******************************************************************************
246 *

--- 73 unchanged lines hidden (view full) ---

320 *
321 * RETURN: Status
322 *
323 * DESCRIPTION: Count and classify the entire namespace, including all
324 * namespace nodes and attached objects.
325 *
326 ******************************************************************************/
327
327ACPI_STATUS
328void
328AcpiDbCountNamespaceObjects (
329 void)
330{
331 UINT32 i;
332
333
334 AcpiGbl_NumNodes = 0;
335 AcpiGbl_NumObjects = 0;
336
337 AcpiGbl_ObjTypeCountMisc = 0;
338 for (i = 0; i < (INTERNAL_TYPE_NODE_MAX -1); i++)
339 {
340 AcpiGbl_ObjTypeCount [i] = 0;
341 AcpiGbl_NodeTypeCount [i] = 0;
342 }
343
329AcpiDbCountNamespaceObjects (
330 void)
331{
332 UINT32 i;
333
334
335 AcpiGbl_NumNodes = 0;
336 AcpiGbl_NumObjects = 0;
337
338 AcpiGbl_ObjTypeCountMisc = 0;
339 for (i = 0; i < (INTERNAL_TYPE_NODE_MAX -1); i++)
340 {
341 AcpiGbl_ObjTypeCount [i] = 0;
342 AcpiGbl_NodeTypeCount [i] = 0;
343 }
344
344 AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
345 (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
345 FALSE, AcpiDbClassifyOneObject, NULL, NULL);
346 FALSE, AcpiDbClassifyOneObject, NULL, NULL);
346
347 return (AE_OK);
348}
349
350#endif
351
352
353/*******************************************************************************
354 *
355 * FUNCTION: AcpiDbDisplayStatistics

--- 36 unchanged lines hidden (view full) ---

392 AcpiOsPrintf ("Invalid or unsupported argument\n");
393 return (AE_OK);
394 }
395
396
397 switch (Type)
398 {
399#ifndef PARSER_ONLY
347}
348
349#endif
350
351
352/*******************************************************************************
353 *
354 * FUNCTION: AcpiDbDisplayStatistics

--- 36 unchanged lines hidden (view full) ---

391 AcpiOsPrintf ("Invalid or unsupported argument\n");
392 return (AE_OK);
393 }
394
395
396 switch (Type)
397 {
398#ifndef PARSER_ONLY
400 case CMD_ALLOCATIONS:
399 case CMD_STAT_ALLOCATIONS:
401#ifdef ACPI_DBG_TRACK_ALLOCATIONS
402 AcpiUtDumpAllocationInfo ();
403#endif
404 break;
405#endif
406
400#ifdef ACPI_DBG_TRACK_ALLOCATIONS
401 AcpiUtDumpAllocationInfo ();
402#endif
403 break;
404#endif
405
407 case CMD_TABLES:
406 case CMD_STAT_TABLES:
408
409 AcpiOsPrintf ("ACPI Table Information:\n\n");
410 if (AcpiGbl_DSDT)
411 {
412 AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
413 }
414 break;
415
407
408 AcpiOsPrintf ("ACPI Table Information:\n\n");
409 if (AcpiGbl_DSDT)
410 {
411 AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
412 }
413 break;
414
416 case CMD_OBJECTS:
415 case CMD_STAT_OBJECTS:
417
418#ifndef PARSER_ONLY
419
420 AcpiDbCountNamespaceObjects ();
421
422 AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
423
424 AcpiOsPrintf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");

--- 7 unchanged lines hidden (view full) ---

432 AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
433
434 AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
435 AcpiGbl_NumNodes, AcpiGbl_NumObjects);
436
437#endif
438 break;
439
416
417#ifndef PARSER_ONLY
418
419 AcpiDbCountNamespaceObjects ();
420
421 AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
422
423 AcpiOsPrintf ("%16.16s % 10.10s % 10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");

--- 7 unchanged lines hidden (view full) ---

431 AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
432
433 AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
434 AcpiGbl_NumNodes, AcpiGbl_NumObjects);
435
436#endif
437 break;
438
440 case CMD_MEMORY:
439 case CMD_STAT_MEMORY:
441
442#ifdef ACPI_DBG_TRACK_ALLOCATIONS
443 AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
444
445 for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
446 {
447 AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
448

--- 29 unchanged lines hidden (view full) ---

478 AcpiGbl_MemoryLists[i].TotalAllocated,
479 AcpiGbl_MemoryLists[i].TotalFreed,
480 Outstanding, Size);
481 }
482#endif
483
484 break;
485
440
441#ifdef ACPI_DBG_TRACK_ALLOCATIONS
442 AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
443
444 for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
445 {
446 AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
447

--- 29 unchanged lines hidden (view full) ---

477 AcpiGbl_MemoryLists[i].TotalAllocated,
478 AcpiGbl_MemoryLists[i].TotalFreed,
479 Outstanding, Size);
480 }
481#endif
482
483 break;
484
486 case CMD_MISC:
485 case CMD_STAT_MISC:
487
488 AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
489 AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", AcpiGbl_PsFindCount);
490 AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", AcpiGbl_NsLookupCount);
491
492 AcpiOsPrintf ("\n");
493
494 AcpiOsPrintf ("Mutex usage:\n\n");
495 for (i = 0; i < NUM_MTX; i++)
496 {
497 AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount);
498 }
499 break;
500
501
486
487 AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
488 AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", AcpiGbl_PsFindCount);
489 AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", AcpiGbl_NsLookupCount);
490
491 AcpiOsPrintf ("\n");
492
493 AcpiOsPrintf ("Mutex usage:\n\n");
494 for (i = 0; i < NUM_MTX; i++)
495 {
496 AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount);
497 }
498 break;
499
500
502 case CMD_SIZES:
501 case CMD_STAT_SIZES:
503
504 AcpiOsPrintf ("\nInternal object sizes:\n\n");
505
506 AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
507 AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
508 AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
509 AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
510 AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));

--- 12 unchanged lines hidden (view full) ---

523 AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
524 AcpiOsPrintf ("NotifyHandler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
525 AcpiOsPrintf ("AddrHandler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
526 AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
527 AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
528
529 AcpiOsPrintf ("\n");
530
502
503 AcpiOsPrintf ("\nInternal object sizes:\n\n");
504
505 AcpiOsPrintf ("Common %3d\n", sizeof (ACPI_OBJECT_COMMON));
506 AcpiOsPrintf ("Number %3d\n", sizeof (ACPI_OBJECT_INTEGER));
507 AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING));
508 AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER));
509 AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE));

--- 12 unchanged lines hidden (view full) ---

522 AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
523 AcpiOsPrintf ("NotifyHandler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
524 AcpiOsPrintf ("AddrHandler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
525 AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
526 AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
527
528 AcpiOsPrintf ("\n");
529
531 AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJECT));
532 AcpiOsPrintf ("Parse2Object %3d\n", sizeof (ACPI_PARSE2_OBJECT));
530 AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
531 AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
532 AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
533 AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT));
534 AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
535
536 break;
537
538
533 AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT));
534 AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
535
536 break;
537
538
539 case CMD_STACK:
539 case CMD_STAT_STACK:
540#if defined(ACPI_DEBUG)
540
541
541 Size = AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer;
542 Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
542
543 AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
544 AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
545 AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
546 AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size);
547 AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
543
544 AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
545 AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
546 AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
547 AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size);
548 AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
549#endif
548 break;
550 break;
551
552 default:
553 break;
549 }
550
551 AcpiOsPrintf ("\n");
552 return (AE_OK);
553}
554
555
556#endif /* ENABLE_DEBUGGER */
554 }
555
556 AcpiOsPrintf ("\n");
557 return (AE_OK);
558}
559
560
561#endif /* ENABLE_DEBUGGER */