Package: android.hardware.memtrack@1.0

IMemtrack

interface IMemtrack

The Memory Tracker HAL is designed to return information about device-specific memory usage.The primary goal is to be able to track memory that is not trackable in any other way, for example texture memory that is allocated by a process, but not mapped in to that process's address space.A secondary goal is to be able to categorize memory used by a process into GL, graphics, etc.All memory sizes must be in real memory usage, accounting for stride, bit depth, rounding up to page size, etc.

Constructor for the interface should be used to perform memtrack management setup actions and is called once before any calls to getMemory().

Methods

getMemory

getMemory (int32_t pid, MemtrackType type)
generates (MemtrackStatus retval, vec<MemtrackRecord> records)

getMemory() populates MemtrackRecord vector with the sizes of memory plus associated flags for that memory.

This function must be thread-safe, it may get called from multiple threads at the same time.

A process collecting memory statistics will call getMemory for each combination of pid and memory type.For each memory type that it recognizes, the HAL must fill out an array of memtrack_record structures breaking down the statistics of that memory type as much as possible.For example, getMemory(< pid>, GL)might return :{&nbsp ;{4096, ACCOUNTED | PRIVATE | SYSTEM}, {40960, UNACCOUNTED | PRIVATE | SYSTEM}, {8192, ACCOUNTED | PRIVATE | DEDICATED}, {8192, UNACCOUNTED | PRIVATE | DEDICATED}&nbsp ;}If the HAL cannot differentiate between SYSTEM and DEDICATED memory, it could return :{&nbsp ;{12288, ACCOUNTED | PRIVATE}, {49152, UNACCOUNTED | PRIVATE}&nbsp ;}

Memory must not overlap between types.For example, a graphics buffer that has been mapped into the GPU as a surface must show up when GRAPHICS is requested and not when GL is requested.

Details
Parameters
pid
process for which memory information is requested
type
memory type that information is being requested about
Generates
retval
SUCCESS on success, TYPE_NOT_FOUND if the type is not supported.
records
vector of MemtrackRecord containing memory information