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.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
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.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
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 *
159 * RETURN: None
160 *
161 * DESCRIPTION: Add this object to the global counts, by object type.
162 * Limited recursion handles subobjects and packages, and this
163 * is probably acceptable within the AML debugger only.
164 *
165 ******************************************************************************/
166
167void
168AcpiDbEnumerateObject (
169 ACPI_OPERAND_OBJECT *ObjDesc)
170{
171 UINT32 i;
172
173
174 if (!ObjDesc)
175 {
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 *
157 * RETURN: None
158 *
159 * DESCRIPTION: Add this object to the global counts, by object type.
160 * Limited recursion handles subobjects and packages, and this
161 * is probably acceptable within the AML debugger only.
162 *
163 ******************************************************************************/
164
165void
166AcpiDbEnumerateObject (
167 ACPI_OPERAND_OBJECT *ObjDesc)
168{
169 UINT32 i;
170
171
172 if (!ObjDesc)
173 {
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
204 case ACPI_TYPE_DEVICE:
205 AcpiDbEnumerateObject (ObjDesc->Device.SysHandler);
206 AcpiDbEnumerateObject (ObjDesc->Device.DrvHandler);
207 AcpiDbEnumerateObject (ObjDesc->Device.AddrHandler);
208 break;
209
210 case ACPI_TYPE_BUFFER_FIELD:
211 if (AcpiNsGetSecondaryObject (ObjDesc))
212 {
213 AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
214 }
215 break;
216
217 case ACPI_TYPE_REGION:
218 AcpiGbl_ObjTypeCount [INTERNAL_TYPE_REGION_FIELD ]++;
219 AcpiDbEnumerateObject (ObjDesc->Region.AddrHandler);
220 break;
221
222 case ACPI_TYPE_POWER:
223 AcpiDbEnumerateObject (ObjDesc->PowerResource.SysHandler);
224 AcpiDbEnumerateObject (ObjDesc->PowerResource.DrvHandler);
225 break;
226
227 case ACPI_TYPE_PROCESSOR:
228 AcpiDbEnumerateObject (ObjDesc->Processor.SysHandler);
229 AcpiDbEnumerateObject (ObjDesc->Processor.DrvHandler);
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
202 case ACPI_TYPE_DEVICE:
203 AcpiDbEnumerateObject (ObjDesc->Device.SysHandler);
204 AcpiDbEnumerateObject (ObjDesc->Device.DrvHandler);
205 AcpiDbEnumerateObject (ObjDesc->Device.AddrHandler);
206 break;
207
208 case ACPI_TYPE_BUFFER_FIELD:
209 if (AcpiNsGetSecondaryObject (ObjDesc))
210 {
211 AcpiGbl_ObjTypeCount [ACPI_TYPE_BUFFER_FIELD]++;
212 }
213 break;
214
215 case ACPI_TYPE_REGION:
216 AcpiGbl_ObjTypeCount [INTERNAL_TYPE_REGION_FIELD ]++;
217 AcpiDbEnumerateObject (ObjDesc->Region.AddrHandler);
218 break;
219
220 case ACPI_TYPE_POWER:
221 AcpiDbEnumerateObject (ObjDesc->PowerResource.SysHandler);
222 AcpiDbEnumerateObject (ObjDesc->PowerResource.DrvHandler);
223 break;
224
225 case ACPI_TYPE_PROCESSOR:
226 AcpiDbEnumerateObject (ObjDesc->Processor.SysHandler);
227 AcpiDbEnumerateObject (ObjDesc->Processor.DrvHandler);
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 *
246 * FUNCTION: AcpiDbClassifyOneObject
247 *
248 * PARAMETERS: Callback for WalkNamespace
249 *
250 * RETURN: Status
251 *
252 * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
253 * the parent namespace node.
254 *
255 ******************************************************************************/
256
257ACPI_STATUS
258AcpiDbClassifyOneObject (
259 ACPI_HANDLE ObjHandle,
260 UINT32 NestingLevel,
261 void *Context,
262 void **ReturnValue)
263{
264 ACPI_NAMESPACE_NODE *Node;
265 ACPI_OPERAND_OBJECT *ObjDesc;
266 UINT32 Type;
267
268
269 AcpiGbl_NumNodes++;
270
271 Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
272 ObjDesc = AcpiNsGetAttachedObject (Node);
273
274 AcpiDbEnumerateObject (ObjDesc);
275
276 Type = Node->Type;
277 if (Type > INTERNAL_TYPE_NODE_MAX)
278 {
279 AcpiGbl_NodeTypeCountMisc++;
280 }
281
282 else
283 {
284 AcpiGbl_NodeTypeCount [Type]++;
285 }
286
287 return AE_OK;
288
289
290 /* TBD: These need to be counted during the initial parsing phase */
291 /*
292 if (AcpiPsIsNamedOp (Op->Opcode))
293 {
294 NumNodes++;
295 }
296
297 if (IsMethod)
298 {
299 NumMethodElements++;
300 }
301
302 NumGrammarElements++;
303 Op = AcpiPsGetDepthNext (Root, Op);
304
305 SizeOfParseTree = (NumGrammarElements - NumMethodElements) * (UINT32) sizeof (ACPI_PARSE_OBJECT);
306 SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
307 SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
308 SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
309
310 */
311}
312
313
314/*******************************************************************************
315 *
316 * FUNCTION: AcpiDbCountNamespaceObjects
317 *
318 * PARAMETERS: None
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 *
247 * FUNCTION: AcpiDbClassifyOneObject
248 *
249 * PARAMETERS: Callback for WalkNamespace
250 *
251 * RETURN: Status
252 *
253 * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
254 * the parent namespace node.
255 *
256 ******************************************************************************/
257
258ACPI_STATUS
259AcpiDbClassifyOneObject (
260 ACPI_HANDLE ObjHandle,
261 UINT32 NestingLevel,
262 void *Context,
263 void **ReturnValue)
264{
265 ACPI_NAMESPACE_NODE *Node;
266 ACPI_OPERAND_OBJECT *ObjDesc;
267 UINT32 Type;
268
269
270 AcpiGbl_NumNodes++;
271
272 Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
273 ObjDesc = AcpiNsGetAttachedObject (Node);
274
275 AcpiDbEnumerateObject (ObjDesc);
276
277 Type = Node->Type;
278 if (Type > INTERNAL_TYPE_NODE_MAX)
279 {
280 AcpiGbl_NodeTypeCountMisc++;
281 }
282
283 else
284 {
285 AcpiGbl_NodeTypeCount [Type]++;
286 }
287
288 return AE_OK;
289
290
291 /* TBD: These need to be counted during the initial parsing phase */
292 /*
293 if (AcpiPsIsNamedOp (Op->Opcode))
294 {
295 NumNodes++;
296 }
297
298 if (IsMethod)
299 {
300 NumMethodElements++;
301 }
302
303 NumGrammarElements++;
304 Op = AcpiPsGetDepthNext (Root, Op);
305
306 SizeOfParseTree = (NumGrammarElements - NumMethodElements) * (UINT32) sizeof (ACPI_PARSE_OBJECT);
307 SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
308 SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
309 SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
310
311 */
312}
313
314
315/*******************************************************************************
316 *
317 * FUNCTION: AcpiDbCountNamespaceObjects
318 *
319 * PARAMETERS: None
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
356 *
357 * PARAMETERS: TypeArg - Subcommand
358 *
359 * RETURN: Status
360 *
361 * DESCRIPTION: Display various statistics
362 *
363 ******************************************************************************/
364
365ACPI_STATUS
366AcpiDbDisplayStatistics (
367 NATIVE_CHAR *TypeArg)
368{
369 UINT32 i;
370 UINT32 Type;
371 UINT32 Size;
372#ifdef ACPI_DBG_TRACK_ALLOCATIONS
373 UINT32 Outstanding;
374#endif
375
376
377 if (!AcpiGbl_DSDT)
378 {
379 AcpiOsPrintf ("*** Warning: There is no DSDT loaded\n");
380 }
381
382 if (!TypeArg)
383 {
384 AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
385 return (AE_OK);
386 }
387
388 ACPI_STRUPR (TypeArg);
389 Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
390 if (Type == (UINT32) -1)
391 {
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
355 *
356 * PARAMETERS: TypeArg - Subcommand
357 *
358 * RETURN: Status
359 *
360 * DESCRIPTION: Display various statistics
361 *
362 ******************************************************************************/
363
364ACPI_STATUS
365AcpiDbDisplayStatistics (
366 NATIVE_CHAR *TypeArg)
367{
368 UINT32 i;
369 UINT32 Type;
370 UINT32 Size;
371#ifdef ACPI_DBG_TRACK_ALLOCATIONS
372 UINT32 Outstanding;
373#endif
374
375
376 if (!AcpiGbl_DSDT)
377 {
378 AcpiOsPrintf ("*** Warning: There is no DSDT loaded\n");
379 }
380
381 if (!TypeArg)
382 {
383 AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
384 return (AE_OK);
385 }
386
387 ACPI_STRUPR (TypeArg);
388 Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
389 if (Type == (UINT32) -1)
390 {
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");
425
426 for (i = 0; i < INTERNAL_TYPE_NODE_MAX; i++)
427 {
428 AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
429 AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
430 }
431 AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
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");
424
425 for (i = 0; i < INTERNAL_TYPE_NODE_MAX; i++)
426 {
427 AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
428 AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
429 }
430 AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
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
449 if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
450 {
451 AcpiOsPrintf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
452 AcpiGbl_MemoryLists[i].CacheDepth,
453 AcpiGbl_MemoryLists[i].MaxCacheDepth,
454 AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
455 (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
456
457 AcpiOsPrintf (" Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
458 AcpiGbl_MemoryLists[i].CacheRequests,
459 AcpiGbl_MemoryLists[i].CacheHits,
460 AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
461 AcpiGbl_MemoryLists[i].ObjectSize);
462 }
463
464 Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
465 AcpiGbl_MemoryLists[i].TotalFreed -
466 AcpiGbl_MemoryLists[i].CacheDepth;
467
468 if (AcpiGbl_MemoryLists[i].ObjectSize)
469 {
470 Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
471 }
472 else
473 {
474 Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
475 }
476
477 AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
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
448 if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
449 {
450 AcpiOsPrintf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
451 AcpiGbl_MemoryLists[i].CacheDepth,
452 AcpiGbl_MemoryLists[i].MaxCacheDepth,
453 AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
454 (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
455
456 AcpiOsPrintf (" Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
457 AcpiGbl_MemoryLists[i].CacheRequests,
458 AcpiGbl_MemoryLists[i].CacheHits,
459 AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
460 AcpiGbl_MemoryLists[i].ObjectSize);
461 }
462
463 Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
464 AcpiGbl_MemoryLists[i].TotalFreed -
465 AcpiGbl_MemoryLists[i].CacheDepth;
466
467 if (AcpiGbl_MemoryLists[i].ObjectSize)
468 {
469 Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
470 }
471 else
472 {
473 Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
474 }
475
476 AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
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));
511 AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
512 AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE));
513 AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT));
514 AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD));
515 AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX));
516 AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION));
517 AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
518 AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
519 AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
520 AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
521 AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
522 AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
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));
510 AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
511 AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE));
512 AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT));
513 AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD));
514 AcpiOsPrintf ("Mutex %3d\n", sizeof (ACPI_OBJECT_MUTEX));
515 AcpiOsPrintf ("Region %3d\n", sizeof (ACPI_OBJECT_REGION));
516 AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
517 AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
518 AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
519 AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
520 AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
521 AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
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 */