A partir del 27 de marzo de 2025, te recomendamos que uses android-latest-release
en lugar de aosp-main
para compilar y contribuir a AOSP. Para obtener más información, consulta Cambios en AOSP.
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Referencia de la estructura memtrack_module
#include <
memtrack.h
>
Cada módulo de hardware debe tener una estructura de datos llamada HAL_MODULE_INFO_SYM, y los campos de esta estructura de datos deben comenzar con
hw_module_t
, seguido de información específica del módulo.
Definición en la línea
120
del archivo
memtrack.h
.
(*getMemory)() espera un array de objetos de registro y propaga hasta *num_record estructuras con los tamaños de memoria más las marcas asociadas para esa memoria. También actualiza *num_records con la cantidad total de registros que podría mostrar si *num_records fuera lo suficientemente grande cuando se pasa. Se espera que se devuelvan registros con un tamaño de 0. La cantidad de registros no debe variar entre las llamadas a getMemory para el mismo tipo de memoria, incluso para diferentes pids.
A menudo, el llamador llamará a getMemory para un tipo y un pid con *num_records == 0 para determinar para cuántos registros se debe asignar espacio. En este caso, debe ser una ruta rápida en el HAL, que devuelve una constante y no consulta ningún archivo del kernel. Si el valor de *num_records que se pasa es 0, es posible que los registros sean nulos.
Esta función debe ser segura para subprocesos, ya que se puede llamar desde varios subprocesos al mismo tiempo.
Devuelve 0 si se realiza correctamente, -ENODEV si el tipo no es compatible y -errno en otros errores.
Definición en la línea
151
del archivo
memtrack.h
.
(*init)() realiza acciones de configuración de administración de memtrack y se lo llama una vez antes de cualquier llamada a
getMemory()
. Muestra 0 si se realiza correctamente y -errno si se produce un error.
Definición en la línea
128
del archivo
memtrack.h
.
La documentación de esta struct se generó a partir del siguiente archivo:
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-07-27 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-07-27 (UTC)"],[],[],null,["# Android Hardware Abstraction Layer: memtrack_module Struct Reference\n\nmemtrack_module Struct Reference\n================================\n\n[Data Fields](#pub-attribs) \nmemtrack_module Struct Reference \n\n`\n#include \u003c\n`[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)`\n\u003e\n`\n\n|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| struct [hw_module_t](/reference/hal/structhw__module__t) | [common](/reference/hal/structmemtrack__module#a71ea01183b3998cad6a2301a37a42fc7) |\n| ||\n| int(\\* | [init](/reference/hal/structmemtrack__module#a44c48f5b685ba133e81237bf65fb77f3) )(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module) |\n| ||\n| int(\\* | [getMemory](/reference/hal/structmemtrack__module#ad6da70db99b91b8e08eaff8f4500064a) )(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module, pid_t pid, int type, struct [memtrack_record](/reference/hal/structmemtrack__record) \\*records, size_t \\*num_records) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nEvery hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with\n[hw_module_t](/reference/hal/structhw__module__t)\nfollowed by module specific information.\n\n\nDefinition at line\n[120](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\nField Documentation\n-------------------\n\n\n|-----------------------------------------------------------------|\n| struct [hw_module_t](/reference/hal/structhw__module__t) common |\n\n\nDefinition at line\n[121](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* getMemory)(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module, pid_t pid, int type, struct [memtrack_record](/reference/hal/structmemtrack__record) \\*records, size_t \\*num_records) |\n\n\n(\\*getMemory)() expects an array of record objects and populates up to \\*num_record structures with the sizes of memory plus associated flags for that memory. It also updates \\*num_records with the total number of records it could return if \\*num_records was large enough when passed in. Returning records with size 0 is expected, the number of records should not vary between calls to getMemory for the same memory type, even for different pids.\n\n\nThe caller will often call getMemory for a type and pid with \\*num_records == 0 to determine how many records to allocate room for, this case should be a fast-path in the HAL, returning a constant and not querying any kernel files. If \\*num_records passed in is 0, then records may be NULL.\n\n\nThis function must be thread-safe, it may get called from multiple threads at the same time.\n\n\nReturns 0 on success, -ENODEV if the type is not supported, -errno on other errors.\n\n\nDefinition at line\n[151](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\n|----------------------------------------------------------------------------------------------|\n| int(\\* init)(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module) |\n\n\n(\\*init)() performs memtrack management setup actions and is called once before any calls to\n[getMemory()](/reference/hal/structmemtrack__module#ad6da70db99b91b8e08eaff8f4500064a)\n. Returns 0 on success, -errno on error.\n\n\nDefinition at line\n[128](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)"]]