A partir de 27 de março de 2025, recomendamos usar android-latest-release
em vez de aosp-main
para criar e contribuir com o AOSP. Para mais informações, consulte Mudanças no AOSP.
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Referência da estrutura memtrack_module
#include <
memtrack.h
>
Cada módulo de hardware precisa ter uma estrutura de dados chamada HAL_MODULE_INFO_SYM, e os campos dessa estrutura precisam começar com
hw_module_t
seguidos de informações específicas do módulo.
Definição na linha
120
do arquivo
memtrack.h
.
(*getMemory)() espera uma matriz de objetos de registro e preenche até *num_record estruturas com os tamanhos de memória e as flags associadas a ela. Ele também atualiza *num_records com o número total de registros que ele pode retornar se *num_records for grande o suficiente quando transmitido. É esperado que registros com tamanho 0 sejam retornados. O número de registros não deve variar entre as chamadas para getMemory para o mesmo tipo de memória, mesmo para pids diferentes.
O autor da chamada geralmente chama getMemory para um tipo e pid com *num_records == 0 para determinar quantos registros alocar. Esse caso precisa ser um caminho rápido no HAL, retornando uma constante e não consultando nenhum arquivo do kernel. Se *num_records transmitido for 0, os registros poderão ser NULL.
Essa função precisa ser segura para linhas de execução e pode ser chamada de várias linhas de execução ao mesmo tempo.
Retorna 0 em caso de sucesso, -ENODEV se o tipo não tiver suporte e -errno em outros erros.
Definição na linha
151
do arquivo
memtrack.h
.
(*init)() executa ações de configuração de gerenciamento de memtrack e é chamado uma vez antes de qualquer chamada para
getMemory()
. Retorna 0 em caso de sucesso e -errno em caso de erro.
Definição na linha
128
do arquivo
memtrack.h
.
A documentação desse struct foi gerada com base no seguinte arquivo:
O conteúdo e os exemplos de código nesta página estão sujeitos às licenças descritas na Licença de conteúdo. Java e OpenJDK são marcas registradas da Oracle e/ou suas afiliadas.
Última atualização 2025-07-27 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)"]]