2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
memtrack_module 구조체 참조
#include <
memtrack.h
>
모든 하드웨어 모듈에는 HAL_MODULE_INFO_SYM이라는 데이터 구조가 있어야 하며 이 데이터 구조의 필드는
hw_module_t
로 시작하고 그 뒤에 모듈별 정보가 나와야 합니다.
memtrack.h
파일의
120
번 줄에 정의되어 있습니다.
(*getMemory)()는 레코드 객체 배열을 예상하고 메모리 크기와 해당 메모리의 연결된 플래그를 사용하여 최대 *num_record 구조체를 채웁니다. 또한 전달 시 *num_records가 충분히 큰 경우 반환할 수 있는 총 레코드 수로 *num_records를 업데이트합니다. 크기가 0인 레코드가 반환될 것으로 예상됩니다. 동일한 메모리 유형의 getMemory 호출 간에 레코드 수가 달라서는 안 되며, pid가 다르더라도 마찬가지입니다.
호출자는 공간을 할당할 레코드 수를 결정하기 위해 종종 *num_records == 0으로 유형 및 pid의 getMemory를 호출합니다. 이 경우 상수를 반환하고 커널 파일을 쿼리하지 않는 HAL의 빠른 경로여야 합니다. 전달된 *num_records가 0이면 레코드가 NULL일 수 있습니다.
이 함수는 스레드로부터 안전해야 하며 동시에 여러 스레드에서 호출될 수 있습니다.
성공하면 0을, 유형이 지원되지 않는 경우에는 -ENODEV를, 다른 오류가 발생하면 -errno를 반환합니다.
memtrack.h
FILE의
151
라인에 정의되어 있습니다.
(*init)()은 memtrack 관리 설정 작업을 실행하며
getMemory()
를 호출하기 전에 한 번 호출됩니다. 성공 시 0을, 오류 시 -errno를 반환합니다.
memtrack.h
FILE의
128
행에 정의되어 있습니다.
이 구조체에 관한 문서는 다음 파일에서 생성되었습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 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)"]]