linux/drivers/acpi/acpica/dbstats.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/*******************************************************************************
 *
 * Module Name: dbstats - Generation and display of ACPI table statistics
 *
 ******************************************************************************/

#include <acpi/acpi.h>
#include "accommon.h"
#include "acdebug.h"
#include "acnamesp.h"

#define _COMPONENT
ACPI_MODULE_NAME("dbstats")

/* Local prototypes */
static void acpi_db_count_namespace_objects(void);

static void acpi_db_enumerate_object(union acpi_operand_object *obj_desc);

static acpi_status
acpi_db_classify_one_object(acpi_handle obj_handle,
			    u32 nesting_level,
			    void *context, void **return_value);

#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
static void acpi_db_list_info(struct acpi_memory_list *list);
#endif

/*
 * Statistics subcommands
 */
static struct acpi_db_argument_info acpi_db_stat_types[] =;

#define CMD_STAT_ALLOCATIONS
#define CMD_STAT_OBJECTS
#define CMD_STAT_MEMORY
#define CMD_STAT_MISC
#define CMD_STAT_TABLES
#define CMD_STAT_SIZES
#define CMD_STAT_STACK

#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
/*******************************************************************************
 *
 * FUNCTION:    acpi_db_list_info
 *
 * PARAMETERS:  list            - Memory list/cache to be displayed
 *
 * RETURN:      None
 *
 * DESCRIPTION: Display information about the input memory list or cache.
 *
 ******************************************************************************/

static void acpi_db_list_info(struct acpi_memory_list *list)
{
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
	u32 outstanding;
#endif

	acpi_os_printf("\n%s\n", list->list_name);

	/* max_depth > 0 indicates a cache object */

	if (list->max_depth > 0) {
		acpi_os_printf
		    ("    Cache: [Depth    MaxD Avail  Size]                "
		     "%8.2X %8.2X %8.2X %8.2X\n", list->current_depth,
		     list->max_depth, list->max_depth - list->current_depth,
		     (list->current_depth * list->object_size));
	}
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
	if (list->max_depth > 0) {
		acpi_os_printf
		    ("    Cache: [Requests Hits Misses ObjSize]             "
		     "%8.2X %8.2X %8.2X %8.2X\n", list->requests, list->hits,
		     list->requests - list->hits, list->object_size);
	}

	outstanding = acpi_db_get_cache_info(list);

	if (list->object_size) {
		acpi_os_printf
		    ("    Mem:   [Alloc    Free Max    CurSize Outstanding] "
		     "%8.2X %8.2X %8.2X %8.2X %8.2X\n", list->total_allocated,
		     list->total_freed, list->max_occupied,
		     outstanding * list->object_size, outstanding);
	} else {
		acpi_os_printf
		    ("    Mem:   [Alloc Free Max CurSize Outstanding Total] "
		     "%8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
		     list->total_allocated, list->total_freed,
		     list->max_occupied, list->current_total_size, outstanding,
		     list->total_size);
	}
#endif
}
#endif

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_enumerate_object
 *
 * PARAMETERS:  obj_desc            - Object to be counted
 *
 * RETURN:      None
 *
 * DESCRIPTION: Add this object to the global counts, by object type.
 *              Limited recursion handles subobjects and packages, and this
 *              is probably acceptable within the AML debugger only.
 *
 ******************************************************************************/

static void acpi_db_enumerate_object(union acpi_operand_object *obj_desc)
{}

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_classify_one_object
 *
 * PARAMETERS:  Callback for walk_namespace
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Enumerate both the object descriptor (including subobjects) and
 *              the parent namespace node.
 *
 ******************************************************************************/

static acpi_status
acpi_db_classify_one_object(acpi_handle obj_handle,
			    u32 nesting_level,
			    void *context, void **return_value)
{}

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_count_namespace_objects
 *
 * PARAMETERS:  None
 *
 * RETURN:      None
 *
 * DESCRIPTION: Count and classify the entire namespace, including all
 *              namespace nodes and attached objects.
 *
 ******************************************************************************/

static void acpi_db_count_namespace_objects(void)
{}

/*******************************************************************************
 *
 * FUNCTION:    acpi_db_display_statistics
 *
 * PARAMETERS:  type_arg        - Subcommand
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Display various statistics
 *
 ******************************************************************************/

acpi_status acpi_db_display_statistics(char *type_arg)
{}